header() and passing sessions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I need some help passing a session variable with a header() function. According to www.php.net/header, the documentation states:

*Note*: Session ID is not passed with Location header even if session.use_trans_sid <session.configuration.php#ini.session.use-trans-sid> is enabled. It must by passed manually using *SID* constant.

so, I'm trying to manually pass the SID, but not having any luck. Here is a snippet of my code:

There is a file login.php which has session_start(); and sets $_SESSION["username"] with the username you logged in with from index.php and has a form to click View Pending Requests which has the action of option.php.

-- option.php --
<?php
session_start();
if ($_POST["option"] == "View Pending Requests")
       {
header('Location: http://intra.mdah.state.ms.us/helpdesk/viewpending.php?PHPSESSID='.session_id());
       }
?>

--viewpending.php --
<?php
session_start();
if (!$_SESSION["username"])
       {
       echo "You have not logged in";
       exit;
       }
?>

so you click on View Pending Requests, and the URL in your browser is:

http://intra.mdah.state.ms.us/helpdesk/viewpending.php?PHPSESSID=du75p41hel9k1vpuah799l2ce7

but viewpending.php says "You have not logged in".  Why is that?


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux