Re: Session Not Saving?
| From: | Chris Shiflett | Date: | Sun, 29 Sep 2002 17:15:56 +0000 |
| Subject: | Re: Session Not Saving? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-118086@lists.php.net to get a copy of this message | ||
I'm not sure why you are trying to use session_is_registered() to validate a user, but you should get rid of that.
With sessions, you want to start the session on every page you need session management. If you have a session module that you include everywhere, you can do this by registering each session variable, as that will implicitly start the session as well.
If you want to greet a user by name, simply have a session variable called "first_name" or something. Then, if it's not blank, greet them.
I'm not sure if that helps, but you at least need to rethink what you are trying to do.
Chris
Stephen Craton wrote:
Here's the code that checks to see if the user is valid: function check_valid() { global $valid_user; if (session_is_registered("valid_user")) {echo "<font size='2'>Welcome $valid_user!</font>";} else {echo "You are not logged in."; exit; } }