Re: header() and passing sessions

From: Date: Wed, 15 Apr 2009 16:37:25 +0000
Subject: Re: header() and passing sessions
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-291529@lists.php.net to get a copy of this message
abdulazeez alugo wrote:
Hi, Well I'ld say the reason is quite obvious. You have simply not set $_session["username"] . I'ld have done something like: -- option.php -- <?php session_start(); if ($_POST["option"] == "View Pending Requests") { $_session["username"]= true; //sets the session header('Location:
http://intra.mdah.state.ms.us/helpdesk/viewpending.php?PHPSESSID='.SID);    // <http://intra.mdah.state.ms.us/helpdesk/viewpending.php?PHPSESSID=%27.SID%29;%A0%A0%A0+//> I'ld use SID
} ?> --viewpending.php - <?php session_start(); if ($_SESSION["username"] !=true) { echo "You have not logged in"; exit; } ?> I hope this helps. try it. Cheers Alugo Abdulazeez
Well the thing is, $_SESSION["username"] is set. If I change option.php to: <?php session_start(); echo "session username is ".$_SESSION["username"]; /*if ($_POST["option"] == "View Pending Requests")
       {
       header('Location: http://intra.mdah.state.ms.us/helpdesk/viewpending.php?PHPSESSID='.session_id());
       }
*/ ?> and click on View Pending Requests, it prints: session username is awilliam

« previous php.general (#291529) next »