From:             jeffrea at dslextreme dot com
Operating system: Win2k server sp4
PHP version:      4.3.2
PHP Bug Type:     Session related
Bug description:  session has problems starting

Description:
------------
Session will not start without manual manipulation.  I use session to
ensure only authorized people are loged in to do back end processing. 
When anyone attems to logon it just kicks them back to the logon page even
though there info is correct.  So I point them to a different page with no
redirection.  Which should display there session info 
   session_start();

   echo $_SESSION['user'];
   echo $_SESSION['pass'];

But nothing is displaied.  If you click on the back button reinput the
same logon credentials You go back to the page again and it will then
work??????  So at  this point I change the redirection of the logon page
to point to were it should and it works fine until the next time I login
and I have to repeat this again.  Any idea?

Reproduce code:
---------------
session_start();

if (!$_SESSION['user'] || !$_SESSION['pass']) {

header('Location: logon.php');
die();

} else {

$db = mysql_connect('localhost', 'xxxxx', 'xxxx') or die("Couldn't connect
to the database.");
mysql_select_db('addissalsa') or die("Couldn't select the database");

$result = mysql_query("SELECT count FROM users WHERE
password='$_SESSION[pass]' AND username='$_SESSION[user]'") or
die("Couldn't query the user-database.");
$num = mysql_result($result, 0);

if (!$num) {

header('Location: login.php');
die();
}
}

Expected result:
----------------
I expect that the session would start and that the rest of the code on the
page would run but it is being redirect back to the logon.php from the 
if (!$_SESSION['user'] || !$_SESSION['pass']) {

header('Location: logon.php');
die();



Actual result:
--------------
redirected to logon.php  



-- 
Edit bug report at http://bugs.php.net/?id=25238&edit=1
-- 
Try a CVS snapshot (php4):  http://bugs.php.net/fix.php?id=25238&r=trysnapshot4
Try a CVS snapshot (php5):  http://bugs.php.net/fix.php?id=25238&r=trysnapshot5
Fixed in CVS:               http://bugs.php.net/fix.php?id=25238&r=fixedcvs
Fixed in release:           http://bugs.php.net/fix.php?id=25238&r=alreadyfixed
Need backtrace:             http://bugs.php.net/fix.php?id=25238&r=needtrace
Try newer version:          http://bugs.php.net/fix.php?id=25238&r=oldversion
Not developer issue:        http://bugs.php.net/fix.php?id=25238&r=support
Expected behavior:          http://bugs.php.net/fix.php?id=25238&r=notwrong
Not enough info:            http://bugs.php.net/fix.php?id=25238&r=notenoughinfo
Submitted twice:            http://bugs.php.net/fix.php?id=25238&r=submittedtwice
register_globals:           http://bugs.php.net/fix.php?id=25238&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=25238&r=php3
Daylight Savings:           http://bugs.php.net/fix.php?id=25238&r=dst
IIS Stability:              http://bugs.php.net/fix.php?id=25238&r=isapi
Install GNU Sed:            http://bugs.php.net/fix.php?id=25238&r=gnused

Reply via email to