RE: [PHP] Problems with sessions

From: Date: Tue, 13 May 2003 20:06:19 +0000
Subject: RE: [PHP] Problems with sessions
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-147485@lists.php.net to get a copy of this message
Assuming you are not stumbling on the usual gotcha's {like trying to provide session "save_handler" routines, and your /tmp directory is world writable) you might make sure you are referencing $authenticated as a global variable; i.e. if you are inside a function, you will need to declare $authenticated as a Global. The variable contents should be accessible in any page after the session_start() has been exercised in that page. Sounds like you have the right idea, that this is useful to pass data between pages. hope this helps, Warren Vail warren@vailtech.net -----Original Message----- From: Tomás Liendo [mailto:tomasjliendo@hotmail.com] Sent: Tuesday, May 13, 2003 12:47 PM To: php-general@lists.php.net Subject: [PHP] Problems with sessions Hi people, I need your help: I don't understand sessions very well. I'm programming a typical login system. The user input his user name and password, and I check this information in a MySQL database. If the user and password exists, I do the following: session_start(); session_register("authenticated"); $authenticated="yes"; Then, the user has a menu (made with Flash) and can go to diferents pages (each page is a diferent php file). In each one of those pages I check that the user is authenticated: if($authenticated!="yes") { echo "Login error"; } else { ... But $authenticated never has the value yes. I suppose that this is because the $authenticated doesn't conserve the value between pages, but this the characteristic of a session variable. Or not? Ahead of time, thank you very much, Tom. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

« previous php.general (#147485) next »