Re: [PHP] Sessions From: 1LT John W. Holmes (holmes072000 <email protected>)
Date: 10/24/02

> Now we're on another topic I don't quite understand. I would like to use
> session as well at some point to store say a user id so that a person
> could carry it with them from page to page then when they logout the
> session is killed or deleted after an expiration if they browse to an off
> site location without doing a logout.
>
> If I use session_start() after someone authenticates I should then be able
> to do session_register('$id') and that persons username is kept as a
> record in that person's session. Now comes the part I don't quite
> understand. As far as I have tested the above, I can then go to a seperate
> page and do session_start() again and be able to pull the $id variable
> from that session. As far as I can tell this is all done server side
> without cookies or doing anything with the session id in the URL. How does
> PHP know that a specific session is this or that person's session?

By the Session_ID passed in a cookie or in the URL. :)

FYI: It would be a good idea to have register_globals OFF and use the
$_SESSION array. It really makes things easier. You don't have to register
variables and you know the variable you're using is always coming from the
session. That may not be the case if you're just using $id.

---John Holmes...

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php