Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations sizbut on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

starting session from activation e-mail

Status
Not open for further replies.

matanzas

Technical User
Apr 15, 2006
184
CA
My experience with dynamic web applications is very new so, as always any assistance will be greatly appreciated

I want to conduct an interview with a user by having them fill in details over several pages on mysite.com. They do not have to fill in the interview pages in any particular order.

So that the details are entered into the correct record in the database I understand that a session must be set up when the user starts. I want this to start at the page a new user is directed to from an account activation e-mail.

Once the user comes to this opening page he/she would have 10 different pages that they could go to (they don't have to do the interview in order any) and I want the information that they entered on the last visit to appear in the form field (if anything is there)

This is the beginning of the page the e-mail directs the user to
Code:
<?php require_once('../Connections/connConn.php'); ?>
<?php
// Load the tNG classes
require_once('../includes/tng/tNG.inc.php');

//Start log out user
$logout = new tNG_Logout();
$logout->setLogoutType("link");
$logout->setPageRedirect("/index.html");
$logout->Execute();
//End log out user
mysql_select_db($database_connBSD, $connBSD);
$query_rsUsers = "SELECT * FROM users";
$rsUsers = mysql_query($query_rsUsers, $connBSD) or die(mysql_error());
$row_rsUsers = mysql_fetch_assoc($rsUsers);
$totalRows_rsUsers = mysql_num_rows($rsUsers);
?>

Essentially my question is how do I start a session on th epage opened by an activation e-mail?

After reading various sources I considered that session_register() might be the answer but seeing that it is depricated indicates to me that there is either a better way or, it is just plain wrong.

Any help is appreciated.
Thanks
 
The actuall method of initiating a session, is [blue]session_start[/blue].

Check out the entry at the PHP online manual.
You have then 2 options:
1. Know when the user exits the interview, and have everything that you stored in the session, uploded to a DB,
or
2. Upload to the DB when they leave a question page, and then retrieve it. when they open it again.




----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.
 
Thanks for the reply:
This is the session_start() code I have on another page for another purpose. It is for taking details from a form to populate various fields in a series of pages. I understood that the success of the session depends upon the $_POST

Are you saying that something like this would work on the page that the e-mail opens?

If so, what would the $_POST be?
Code:
<?
		session_start();
		if (isset($_POST['action'])): //the name of your submit button
        $_SESSION['customer_name'] = $_POST['customer_name'];		endif;
?>
 
It does not require a Post. That particular piece of code just checks that the form has been submitted before creating the session. But you can just as well create the session regardless.

You could if you want to check for a valid interview user, add a value to the link in the email that you check and then create the session. Suppose he link in th email is:


You can add a code like: [red]?interviewcode=12345[/red]
then the check for it and start the session.

Code:
if($_GET['interviewcode']=="somecodeyouhave"){
session_start();
$_SESSION['user']="someuser";

}

----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.
 
Thanks for the explanation,

re: valid user, the only link on the page opend by the email is an thank you page with a single link to the interview. THe pages within the interview all have a restricted access server behavior to them which sends you to the new account signup page.

I'll work on it and report back.
 
Glad to have helped.



----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top