clearing a session variable

From: Date: Fri, 11 Apr 2003 15:08:43 +0000
Subject: clearing a session variable
Groups: php.general 
Request: Send a blank email to php-general+get-143516@lists.php.net to get a copy of this message
Hi, all -- I have a simple password variable, stored in a session, that I need to be able to clear; if the person enters the wrong password then I have it and he can't go anywhere! Unfortunately, I haven't found how to really clear a variable so that it doesn't come back again. The code looks about like ... session_start ; session_register('pw') ; ... if ( $pw != $passwordcom ) # passwordcom is read from a config { if ( $pw != "" ) { print "Invalid Password<br>\n" ; } print "Enter password<br>\n" ; print "<form method='post'>\n" ; print "<input type='password' name='pw'><br>\n" ; print "<input type='submit' value=' ENTER '">\n" ; print "</form>" ; exit ; } ... and it would seem that that should work, sending the $pw to the script again, but every time I run it I see that the $pw that it's checking is the first one that was entered. How do I clear out the old one and send the new one? I imagine I need to do something in the session, but what? TIA & HAND :-D -- David T-G * There is too much animal courage in (play) davidtg@justpickone.org * society and not sufficient moral courage. (work) davidtgwork@justpickone.org -- Mary Baker Eddy, "Science and Health" http://justpickone.org/davidtg/ Shpx gur Pbzzhavpngvbaf Qrprapl Npg!

« previous php.general (#143516) next »