Bug #17106 Updated: Session variable disappears

From: Date: Sat, 15 Jun 2002 05:00:06 +0000
Subject: Bug #17106 Updated: Session variable disappears
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-10488@lists.php.net to get a copy of this message
ID: 17106 Updated by: php-bugs@lists.php.net Reported By: Lee.Seldon@infotech.monash.edu.au -Status: Feedback +Status: No Feedback Bug Type: Session related Operating System: Win98, Win2000 Pro PHP Version: 4.1.2 New Comment: 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". Previous Comments: ------------------------------------------------------------------------ [2002-05-22 01:37:57] Lee.Seldon@infotech.monash.edu.au _SESSION code does not work in version 4.0.6 . In my experience, $HTTP_SESSION_VARS[] also does not work in version 4.0.6. I still need session_register(...) in addition or instead of. session_register(...) does not work in versions > 4.1.0 ------------------------------------------------------------------------ [2002-05-16 18:47:01] Lee.Seldon@infotech.monash.edu.au In answer to Rasmus: in php.ini, register_globals has always been On Cookie warning in Netscape shows that a cookie is sent at the beginning of the session, but none is sent on "login". There is a session file in /sessiondata, and it contains "userSN|N;" it does not contain my username. ------------------------------------------------------------------------ [2002-05-15 00:43:47] Lee.Seldon@infotech.monash.edu.au Here is a short version of my original script. Behavior is similar to the original: php 4.0.6 - 2nd time it is run, shows "You are logged in" php 4.1.2, 4.2.1 - 2nd time it is run, prompts again for username and password, so has lost the $userSN session variable <? //Note: // ensure no headers are called! session_start(); // starting session // session variables must be global global $userSN; // registering session variables session_register("userSN"); // test if user is logged-in ?> <html> <head> </head> <body bgcolor="#FFFFFF"> <? if(isset($userSN)) { printf("<H1>You have already logged in for this session.</H1><br>\n"); printf("<center>To logout click <a href=\"logout.php\">here.</a></center>"); printf("</body></html>"); exit; } //Check Password IF userSN is NOT SET AND clicked Submit if ($submit) { $form_password = md5($form_password); $userSN = $form_username; if (isset($userSN)) { printf("<FONT size=5><b>Welcome to Provider Login</b></FONT><br>"); printf("<FONT size=3>%s</FONT><br>\n", $providerName); printf("<b><i>You are logged on from :</i></b> %s <br><br>\n", $REMOTE_ADDR); } else printf("<FONT size=5><b>ERROR setting session cookie</b></FONT><br>"); printf("</body></html>"); exit; } //END of SUBMIT ?> <form method="post" name="loginForm" action="loginphp.php"> <div align="center"> <table width="400" border="0" cellspacing="0" bgcolor="#E6E6E6"> <tr> <td align="right"><br> <font face="arial" size="2"><b>Username:</b></font></td> <td><br> <input NAME="form_username" value="" maxlength="12"> </td> </tr> <tr> <td align="right"><font face="arial" size="2"><br> <b>Password:</b></font></td> <td><br> <input NAME="form_password" type="password" maxlength="12"> </td> </tr> <tr> <td colspan="2" align="right"> <input type="submit" name="submit" value="Login"> </td> </tr> </table> </div> </form> </body> </html> ------------------------------------------------------------------------ [2002-05-14 10:51:10] sander@php.net I just tried the following script on Windows 2000 Pro and it works fine. <?php session_start(); print_r($_SESSION); if(!isset($_SESSION['i'])) { $_SESSION['i'] = 0; } $_SESSION['i']++; ?> Don't forget to set session.save_path in your php.ini! Also make sure the webserver has write access to that path. ------------------------------------------------------------------------ [2002-05-14 00:30:09] rodif_bl@php.net Can you supply a small script reproducing this problem also how frequent it happens? every page view or random or every 10 page views? _ brad ------------------------------------------------------------------------ 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/17106 -- Edit this bug report at http://bugs.php.net/?id=17106&edit=1

« previous php.bugs (#10488) next »