ID:               17106
 Updated by:       [EMAIL PROTECTED]
 Reported By:      [EMAIL PROTECTED]
 Status:           Feedback
 Bug Type:         Session related
 Operating System: Win98, Win2000 Pro
 PHP Version:      4.1.2
 New Comment:

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>


Previous Comments:
------------------------------------------------------------------------

[2002-05-14 10:51:10] [EMAIL PROTECTED]

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] [EMAIL PROTECTED]

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] [EMAIL PROTECTED]

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] [EMAIL PROTECTED]

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

------------------------------------------------------------------------

[2002-05-13 19:28:07] [EMAIL PROTECTED]

14 May 2002
PHP 4.2.1, all other settings as before
Same behavior as 4.2.0 - on "submit" the login prompt immediately
re-appears. So has NOT been fixed.
The last version for which this script works is 4.1.0
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

Reply via email to