Re: how can php applications use session control to track multiple users?

From: Date: Sun, 25 Aug 2002 00:07:12 +0000
Subject: Re: how can php applications use session control to track multiple users?
Groups: php.general 
Request: Send a blank email to php-general+get-113994@lists.php.net to get a copy of this message
>I know you can use session_register to register varialbes, >but how do you use sessions for multiple users? > >Ex. > >$valid_user = $username; // let's say $username has "JSmith" >session_register("valid_user"); > >but if another user (SWhite) logins, then the valid_user now >has the value of "SWhite" and the earlier user "JSmith" is >gone. So, how do you make the sessions looks like: > >JSmith|s:6:"JSmith";SWhite|s:6:"SWhite"; > >Is this the way how people usually implment to track multiple >users? No, no, no, no, no. :-) The entire *POINT* of session variables is to keep JSmith and SWhite *separate* When JSmith gets *their* session_register('valid_user') they get a Cookie sent to their browser. When SWhite gets *their* session_register('valid_user') they get a *different* Cookie. When either one of them comes back, their browser presents the Cookie, and PHP "knows" which one is JSmith and which one is SWhite because they have different Cookies. If this is all giving you a big headache, you could just say "It's magic" and go on with life :-) But PHP is not going to "mix" two users together. -- Like Music? http://l-i-e.com/artists.htm

« previous php.general (#113994) next »