View Full Version : starting session from activation e-mail

04-30-2006, 04:11 PM
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

<?php require_once('../Connections/connConn.php'); ?>
// Load the tNG classes

//Start log out user
$logout = new tNG_Logout();
//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 from 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.

ralph l mayo
04-30-2006, 07:51 PM
all you need now is session_start() then you add things to the session by setting fields of the $_SESSION superglobal. You can use session_encode() to get a string representation of the session suitable for storing in the database. When they come back from the activation email select it from the database again and use session_decode().

How you connect each person to their session data is up to you. If they're required to log in you can use whatever you've got going on now for your userid, if not, you can use the session_id(), and format your email so that the link back contains your.php?si=session_id()