Bug #16540 Updated: variables still exist after loading to a new page

From: Date: Sun, 07 Jul 2002 17:33:34 +0000
Subject: Bug #16540 Updated: variables still exist after loading to a new page
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-13412@lists.php.net to get a copy of this message
ID: 16540 Updated by: sniper@php.net Reported By: webmaster@ckeren.com -Status: Feedback +Status: Bogus Bug Type: Variables related Operating System: win2K PHP Version: 4.1.2 New Comment: Sorry, but the bug system is not the appropriate forum for asking support questions. Your problem does not imply a bug in PHP itself. For a list of more appropriate places to ask for help using PHP, please visit http://www.php.net/support.php Thank you for your interest in PHP. Please read this page: http://www.php.net/manual/en/function.setcookie.php And especially the paragraph about common pitfalls.. Previous Comments: ------------------------------------------------------------------------ [2002-07-07 12:40:34] derick@php.net Please try the latest non-stable snapshot from http://snaps.php.net and update this bugreport with the results of your problem with this new development version. Derick ------------------------------------------------------------------------ [2002-05-12 03:19:42] mfischer@php.net Feedback was given, just no one responded -> reopening. ------------------------------------------------------------------------ [2002-05-12 00:00:03] php-bugs@lists.php.net No feedback was provided for this bug for over a month, so it is being suspended automatically. If you are able to provide the information that was originally requested, please do so and change the status of the bug back to "Open". ------------------------------------------------------------------------ [2002-04-11 22:43:02] webmaster@ckeren.com ok here is the simpler script, please try it and you'll see very clearly where the bug is. It should work but logically it doesn't. That is because php doesn't flush the variables after loading a new page which normally it should. Instead it passess the variables with an empty string MAGICALY. ********************* Start of line $header = "<html><head><title>BUGS</title></head><body><center><br><br><br><br>"; $log = "<br><form action=\"$PHP_SELF\" method=post>Username: <input type=text name=\"user\" size=25 maxlength=20><input type=submit></form>"; if((isset($HTTP_POST_VARS["user"]) || isset($HTTP_COOKIE_VARS["user"]))) { if(!isset($p)) { $m = 30; //m variable represent minutes $lifetime = time() + ($m * 60); //lifetime variable represent the setcookie("user", $user, $lifetime); //set the user variable value into cookie echo $header; //Just to print html header //Print contents of restricted area echo "this is <b>Restricted area</b><br><br>click <a href=\"$PHP_SELF?p=logout\">here</a> to logout"; } else if(isset($p) && $p == "logout") { setcookie("user"); //delete user cookie echo $header; echo "<font color=\"#FF0000\">Here is the bug: the variable user suppoused to be disapeared after clicking the link below.<br>And logically since there is no any existing variables it suppoused to display login form instead <b>restricted area</b></font><br><br>"; echo "you have been loged out click <a href=\"$PHP_SELF\">here</a> to login again"; } else { setcookie("user"); //delete user cookie echo $header; echo "Bad username or password"; echo $log; } } else echo $header.$log; if(isset($user)) echo "<br><br>username: \"$user\" , cookie user: ".@$HTTP_COOKIE_VARS["user"]; echo "</center></body></html>"; ********************* End of line ------------------------------------------------------------------------ [2002-04-11 11:00:58] sander@php.net OK, but can you strip your sample script down to only a couple of lines. Your script is waaaaaay to long, and then the bug is likely to be caused by programming errors. Reopening. ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/16540 -- Edit this bug report at http://bugs.php.net/?id=16540&edit=1

« previous php.bugs (#13412) next »