Bug #17106 Updated: Session variable disappears

From: Date: Thu, 16 May 2002 22:47:01 +0000
Subject: Bug #17106 Updated: Session variable disappears
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-7880@lists.php.net to get a copy of this message
ID: 17106 Updated by: Lee.Seldon@infotech.monash.edu.au Reported By: Lee.Seldon@infotech.monash.edu.au Status: Feedback Bug Type: Session related Operating System: Win98, Win2000 Pro PHP Version: 4.1.2 New Comment: 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. Previous Comments: ------------------------------------------------------------------------ [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 ------------------------------------------------------------------------ [2002-05-14 00:24:26] chris@dvdplaza.com.au For f#cks sake, we STILL have this damn problem under 4.2.1 as well. This is really starting to p#ss me off - we generate a HUGE amount of traffic, one of the top ten movie related sites in this country, and this session problem is causing viewers to constantly reload pages so that their bloody cookie logs them in - thus our bandwidth is shooting through the bloody roof (read $$$$$$$$$ down the toilet)... ------------------------------------------------------------------------ [2002-05-13 20:32:50] Lee.Seldon@infotech.monash.edu.au The last version for which this script works on all my tested platforms (Win98-Win2000, Apache1.3.22, Netscape 4.75) is 4.0.6. Using the php4xx-installer.exe for MS Windows. Also note that 4.0.6 does NOT register PHP in the MS Win registry, whereas versions >= 4.1.0 DO register it. Could the registry be causing problems with session variables? Just a question from an un-initiated user. Lee ------------------------------------------------------------------------ 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 (#7880) next »