|
Posted by tomb on 07/11/07 21:32
Every example I find on the web, and in the books I've purchased,
clearly explains how to setup a session handler for MySql, and usually
provides a very clear example of a main page that checks to see if a
particular $_SESSION value exists, and if not redirects to a login page
where the session is started, and the $_SESSION value is set. This is
great, makes perfect sense. But what about after that? What happens on
the next page the person goes to? What happens to the $_SESSION
values? Mine go away.
Is there somewhere to find what to do so that I can access the $_SESSION
values, and continue to validate this user is really allowed into the
next page?
I have in my php.ini the following:
session.save_handler="user"
session.use_only_cookies="1"
session.gc_maxlifetime="3600"
Then, I have an include file with this:
session_set_save_handler("sess_open", "sess_close", "sess_read",
"sess_write", "sess_destroy", "sess_gc");
session_start();
$sessid = session_id();
if(!$sessid)
die("Failed to start session");
The handlers are from one of my books and do make the entry into the
database when I login. After successful login, I am redirected to a
subdirectory to the index.php file there. That file includes my
database connection variables, and the sessions include file described
above. The $sessid variable has a value in it - it doesn't die. But my
$_SESSION object has no values in it at all. I'm obviously missing
something, but none of the instructors explain how to go beyond the
login page!
Please help.....
Tom
[Back to original message]
|