ID:               25238
 Updated by:       [EMAIL PROTECTED]
 Reported By:      jeffrea at dslextreme dot com
-Status:           Open
+Status:           Bogus
 Bug Type:         Session related
 Operating System: Win2k server sp4
 PHP Version:      4.3.2
 New Comment:

You're propably doing something wrong. This works just fine for me and
thousands of others when done correctly.
(first obvious error: "Location:" header expects full URL)



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

[2003-08-25 13:00:22] jeffrea at dslextreme dot com

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 this bug report at http://bugs.php.net/?id=25238&edit=1

Reply via email to