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:
_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
Previous Comments:
------------------------------------------------------------------------
[2002-05-16 18:47:01] [EMAIL PROTECTED]
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] [EMAIL PROTECTED]
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] [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)...
------------------------------------------------------------------------
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