#29103 [Opn->Bgs]: header("location...") doesn't work after saving a session variable.
| From: | sniper@php.net | Date: | Wed, 14 Jul 2004 12:02:33 +0000 |
| Subject: | #29103 [Opn->Bgs]: header("location...") doesn't work after saving a session variable. | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-62225@lists.php.net to get a copy of this message | ||
ID: 29103
Updated by: sniper@php.net
Reported By: allenr at houston dot rr dot com
-Status: Open
+Status: Bogus
Bug Type: Session related
Operating System: Linux
PHP Version: 4.3.6
New Comment:
Sorry, but your problem does not imply a bug in PHP itself. For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system
is not the
appropriate forum for asking support questions.
Thank you for your interest in PHP.
Ask questions about using PHP on php-general@lists.php.net
Previous Comments:
------------------------------------------------------------------------
[2004-07-12 04:10:08] allenr at houston dot rr dot com
Description:
------------
Using Apache/1.3.29, the header("location...") feature doesn't work
after saving a session variable. I have two php scripts, login and
logout. In logout, I destroy the session with session_destroy() then
use the redirect to get back to the starting page. This works fine.
In the login script, I verify credentials then set a session variable
to indicate the user is logged in, then try the exact same redirect to
the index page, this doesn't work. I've tried using "Location:
http://www.google.com/" which doesn't work
either. I've also entered
the absolute paths to the proper scripts on my own site with the same
result.
Reproduce code:
---------------
logout.php - works
------------------
<?php
if (!session_id()) session_start();
if (isset($_SESSION['loggedIn'])) session_destroy();
header("Location: index.php");
?>
login.php excerpt - broken
--------------------------
if (!strcmp($row['password'], $thisPassword) && ($row
['type'] == 1)) {
$_SESSION['blah'] = true;
header("Location: index.php");
exit();
}
Expected result:
----------------
I expect to be redirected to the page indicated in the Location header.
Actual result:
--------------
The system seems to ignore the header script altogether, displaying a
blank screen when it hits the exit() call.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=29103&edit=1