Re: Session not destroying properly

From: Date: Wed, 07 Mar 2001 16:07:56 +0000
Subject: Re: Session not destroying properly
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-42911@lists.php.net to get a copy of this message
I'm using PostgreSQL for session storage. I forgot to unset session vars occasionally, so I wrote a little script to view sessions and its contents. If you are using DB for session, how about write a little script to view session? It will be very helpful to debug session related problems. If you are using file as session storage, you can view session files to view contents of sessions. Anyway, you have $HTTP_SESSION_VARS, right? You might need to unset the array also, since track-vars will be always enabled with PHP4. I thought session_unregister(), unregister and unset() from globals($GLOBAL) and $HTTP_SESSION_VARS. (I don't register globals, so I'm not sure about this. Anyone?) > Thanks for the suggestion, I tried that and it still doesn't seem to be > working. > Here's what i've got so far on my page (index.php). > > <?PHP > if(session_is_registered("CUserName")) > { > session_destroy(); > unset($CUserName); > header("Location: $PHP_SELF"); By the way, Location header requires absolute URI. Most browser works with relative URI, though. Regards, --- Yasuo Ohgaki > } > else > { > session_register("CUserName"); > $CUserNameSession="CUserName"; > } > //SNIP > ?> > > Hope you can see something I don't. Thanks, > Mike > > On Tue, 6 Mar 2001, trogers wrote: > > > > > Hi > > You will need to kill the session data on the exit of your failed login not > > on entry to the login page as the data will already be overwritten by the > > previous session value. > > I use > > unset($name); > > unset($password); > > ... > > > > Tom > > > > > > At 04:24 PM 6/03/01 +0900, Yasuo Ohgaki wrote: > > >Do you use custom session handlers? > > >Try session_unset() also. It may help. > > > > > >Regards, > > >Yasuo Ohgaki > > > > > > > > > > Got a problem with sessions. > > > > > > > > On my index page, there's a place for people to login. Well, when I test > > > > with two different user names (ie: mike and jlo) it reverts to the first > > > > one when login fails. For example: > > > > I enter in the username "myuen" and a wrong password. I get my > > > > "Password/Username invalid" message which is what I want. > > > > > > > > The page refreshes, the username slot already has myuen in it from the > > > > last entry, I erase it, enter in a new username "jlo" and the correct > > > > password and it will not log me in. > > > > > > > > I know once you attempt to login, it saves the username as a session > > > > variable. On my index.php page, I have a script that checks if a session > > > > exists (particularly the Username), if it exists, destroy it otherwise, > > > > continue on. Obviously it's not destroying it once we enter in a wrong > > > > username and try to login again. > > > > > > > > Any ideas on how to fix this? > > > > > > > > Here's my coding: > > > > <?PHP > > > > if(session_is_registered("CUserName")) > > > > session_destroy(); > > > > > > > > session_register("CUserName"); > > > > $CUserNameSession="CUserName"; > > > > > > > > //SNIP > > > > ?> > > > > > > > > >-- > > >PHP General Mailing List (http://www.php.net/) > > >To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > > >For additional commands, e-mail: php-general-help@lists.php.net > > >To contact the list administrators, e-mail: php-list-admin@lists.php.net > > > > > >

« previous php.general (#42911) next »