Re: Session not destroying properly
| From: | Robert Cooper | Date: | Wed, 07 Mar 2001 06:57:07 +0000 |
| Subject: | Re: Session not destroying properly | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-42860@lists.php.net to get a copy of this message | ||
I'm running the following to kill a session, and haven't had any problems with it yet...
<?
session_start();
session_unset();
session_destroy();
echo "Session gone.";
etc...
At 05:16 PM 3/7/01 +1030, you wrote:
try session_start(); before the if statement - otherwise it will always be FALSE...btw the 'unset()' is redundant i think. ----- Original Message ----- From: "Mike Yuen" <myuen@ucalgary.ca> To: "trogers" <trogers@ats.com.au> Cc: "Yasuo Ohgaki" <yohgaki@hotmail.com>; <php-general@lists.php.net> Sent: Wednesday, March 07, 2001 5:11 PM Subject: Re: [PHP] Session not destroying properly 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"); } 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 loginnoton entry to the login page as the data will already be overwritten bytheprevious session value. I use unset($name); unset($password); ... Tom At 04:24 PM 6/03/01 +0900, Yasuo Ohgaki wrote:testDo you use custom session handlers? Try session_unset() also. It may help. Regards, Yasuo OhgakiGot a problem with sessions. On my index page, there's a place for people to login. Well, when Ifirstwith two different user names (ie: mike and jlo) it reverts to thetheone 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 fromcorrectlast entry, I erase it, enter in a new username "jlo" and thesessionpassword 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 aotherwise,exists (particularly the Username), if it exists, destroy itwrongcontinue on. Obviously it's not destroying it once we enter in aphp-list-admin@lists.php.netusername 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 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 -- 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