From: stefan dot lakerveld at sogeti dot nl
Operating system: IIS
PHP version: 4.4.4
PHP Bug Type: Session related
Bug description: Have to login twice before variables are set
Description:
------------
I made a simple login page which redirects to another page if the userid
and password is correct.
I verify the login by setting a session variable which is checked in the
redirected page. If the session variable is not correct then the user is
returned to the login page again.
The problem is this:
if a user enters a correct password for the first then he is still being
redirected back to the login page.
if the user enters the correct password again then he is directed to the
next page.
During the session this problem doesn't occur again and the user can
logoff and logon again without problems.
But only the first time he has to login twice which is very annoying.
Reproduce code:
---------------
login.php
$_SESSION['login'] = "Y";
echo "<script language='Javascript'>";
echo "document.location = 'http://www.somesite.com/index.php?team=999'";
echo "</script>";
index.php
if ($_SESSION['login'] != "Y")
{
header("location: inloggen.php");
exit ();
}
else
{
echo "Welcome";
}
(i simplified the scripts)
Expected result:
----------------
I would expect that after the first succesfull login the script index.php
would receive a session variable 'login' filled with a "Y"
Actual result:
--------------
After a succesfull login the script index.php receives session variable
'login' being empty and sends the user back to login.php
If the user enters the (same) correct data again then the second time
script index.php DOES receive a "Y" in session variable 'login'
--
Edit bug report at http://bugs.php.net/?id=39931&edit=1
--
Try a CVS snapshot (PHP 4.4):
http://bugs.php.net/fix.php?id=39931&r=trysnapshot44
Try a CVS snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=39931&r=trysnapshot52
Try a CVS snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=39931&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=39931&r=fixedcvs
Fixed in release:
http://bugs.php.net/fix.php?id=39931&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=39931&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=39931&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=39931&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=39931&r=support
Expected behavior: http://bugs.php.net/fix.php?id=39931&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=39931&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=39931&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=39931&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=39931&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=39931&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=39931&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=39931&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=39931&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=39931&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=39931&r=mysqlcfg