Problem with sessions and redirecting
Posted: Sat Oct 20, 2007 6:57 pm
feyd | Please use
Next I want to print the session variables but now from the index.php file. Here is the code :
However it seems the session is lost and nothing is printed.
I spent the whole day trying to figure this out but without any luck.
Any idea what might be wrong ?
feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
Hi!!
I am making a very simple login using sessions.
The login file is called login.php. Here is the code :Code: Select all
<?
session_start();
$_SESSION["logged_user"]='john';
$_SESSION["logged_pass"]='password';
$ID = session_id();
header("location:index.php?PHPSESSID=$ID");
?>Code: Select all
<?
session_start();
$PHPSESSID = $_GET["PHPSESSID"];
session_id($PHPSESSID);
echo $_SESSION["logged_user"];
?>I spent the whole day trying to figure this out but without any luck.
Any idea what might be wrong ?
feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]