On Thu, 21 Oct 2004 11:39:23 +0200, Reinhart Viane <rv@xxxxxxxx> wrote: > Hey all, i'm new to this list so forgive me if i make any huge > mistakes. > I'm in a beginning stage of learning php and i hope you guys can help me > out with this question: > > in a file named checkuser i do this when a users logs in: > PHP Code > // Register some session variables! > session_register('userid'); > $_SESSION['userid'] = $userid; > session_register('first_name'); > $_SESSION['first_name'] = $first_name; > session_register('last_name'); > $_SESSION['last_name'] = $last_name; > session_register('email_address'); > $_SESSION['email_address'] = $email_address; > session_register('user_level'); > $_SESSION['user_level'] = $user_level; > > Now let's say user 1 logs in, his session is registered (with userid > from database is 5 and first_name is XXX) > Then another user logs in, again his session is registered (with userid > from database is 1 and first_name is YYY) > > Now user 1 leaves the pages (closes the browser) and user 2 uploads a > document (with my own script). > > When the document is succesfully uploaded i display this: > PHP Code > echo ($_SESSION['first_name']).", the document has been succesfully > added"; > echo ($_SESSION['userid']); > > This results in the folowing output: > YYY, the document has been succesfully added > 5 > > Meaning the $_SESSION['first_name'] is correct, but the > $_SESSION['userid'] is the one of the user who logged out... > > Now when using user_id in all places it seems to work correctly... > > Is userid something that is defined by the server when making sessions? > > If not, i don't have any clue what is going wrong... > Can someone help me on this? So i know what is wrong? > > Thx in advance > > Reinhart Viane > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > Where does the value $userid come from is it the result of a query i.e. SELECT userid FROM users WHERE username='$_POST['username']' AND passwd='$_POST['password']' or do you have a form (text/hidden) with that value? You mention userid and user_id maybe a typo, but those would be different. You can see all session variables (for testing) by adding: echo "<pre>\n"; print_r($_SESSION); echo "</pre>\n"; -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php