I'm having problems passing my session variables in a redirect and my understanding is I don't need to use session_register in this instance. Below is my most recent version of the code that sets my variables and redirects to index.php. I am attempting to pass the SID (in this case it's called PHPSESSID) in the URL because I can't seem to get the browser to recognize the session has already been set without the SID. It appears to be succesful from the looks of the url on redirect but I don't know how to retrieve my session variables after the redirect occurs. I do have session_start() on the index.php which is where I redirect to. Any help would be appreciated and if I'm doing this completely wrong please tell me. I've only been using PHP for a week so I'm clueless.
{
session_start();
$_SESSION['userid_s'] = $id;
$_SESSION['fname_s'] = $fname;
$_SESSION['lname_s'] = $lname;
$_SESSION['email_s'] = $email;
$_SESSION['tt_s'] = $tt;
$_SESSION['news_s'] = $news;
$_SESSION['dm_s'] = $dm;
$_SESSION['calendar_s'] = $calendar;
$_SESSION['whitepapers_s'] = $whitepapers;
$_SESSION['subscriptions_s'] = $subscriptions;
$_SESSION['articles_s'] = $articles;
$_SESSION['login_s']= "yes";
if(isset($_SESSION['userid_s']))
{
header("Location: index.php?SID=$PHPSESSID"
;
}
else
{
echo "Sorry, the session couldn't be set. Please log back in and check rememberme.";
}
}
Below is my PHP.ini file, which I've been told was the default install for PHP 4.0.
[Session]
session.save_handler = files
session.save_path = /tmp
session.use_cookies = 1
session.name = PHPSESSID
session.auto_start = 0
session.cookie_lifetime = 0
session.cookie_path = /
session.cookie_domain =
session.serialize_handler = php
session.gc_probability = 1
session.gc_maxlifetime = 1440
session.referer_check =
session.entropy_length = 0
session.entropy_file =
session.cache_limiter = nocache
session.cache_expire = 180
session.use_trans_sid = 1
So....am I offbase on how to do this and if not, what's my next step in retrieving my variables on index.php? Please help! My only PHP book is aweful
{
session_start();
$_SESSION['userid_s'] = $id;
$_SESSION['fname_s'] = $fname;
$_SESSION['lname_s'] = $lname;
$_SESSION['email_s'] = $email;
$_SESSION['tt_s'] = $tt;
$_SESSION['news_s'] = $news;
$_SESSION['dm_s'] = $dm;
$_SESSION['calendar_s'] = $calendar;
$_SESSION['whitepapers_s'] = $whitepapers;
$_SESSION['subscriptions_s'] = $subscriptions;
$_SESSION['articles_s'] = $articles;
$_SESSION['login_s']= "yes";
if(isset($_SESSION['userid_s']))
{
header("Location: index.php?SID=$PHPSESSID"
}
else
{
echo "Sorry, the session couldn't be set. Please log back in and check rememberme.";
}
}
Below is my PHP.ini file, which I've been told was the default install for PHP 4.0.
[Session]
session.save_handler = files
session.save_path = /tmp
session.use_cookies = 1
session.name = PHPSESSID
session.auto_start = 0
session.cookie_lifetime = 0
session.cookie_path = /
session.cookie_domain =
session.serialize_handler = php
session.gc_probability = 1
session.gc_maxlifetime = 1440
session.referer_check =
session.entropy_length = 0
session.entropy_file =
session.cache_limiter = nocache
session.cache_expire = 180
session.use_trans_sid = 1
So....am I offbase on how to do this and if not, what's my next step in retrieving my variables on index.php? Please help! My only PHP book is aweful