I'm a novice and I'm trying to use my session to to send me to a new location whenever I return to the site..
This is what I have but It's not doing what expectecd..
<?php
if (!isset($HTTP_SESSION_VARS['session1']) || $HTTP_SESSION_VARS['session1'] != "home_session") {
header ("Location: 1A.php");
}
else
session_start();
if (!isset($HTTP_SESSION_VARS['pg1A']) || $HTTP_SESSION_VARS['pg1A'] != "pg1A") {
header ("Location: 1B.php");
}
else
session_start();
if (!isset($_SESSION['session']) || $_SESSION['session1'] != "1A") {
header ("Location: 2.php");
}
else
session_start();
if (!isset($HTTP_SESSION_VARS['pg2']) || $HTTP_SESSION_VARS['pg2'] != "pg2") {
header ("Location: 3.php");
}
else
session_start();
if (!isset($HTTP_SESSION_VARS['pg3']) || $HTTP_SESSION_VARS['pg3'] != "pg3") {
header ("Location: 4A.php");
}
else
session_start();
if (!isset($HTTP_SESSION_VARS['pg4A']) || $HTTP_SESSION_VARS['pg4A'] != "pg4A") {
header ("Location: 4B.php");
}
else
session_start();
if (!isset($HTTP_SESSION_VARS['pg4B']) || $HTTP_SESSION_VARS['pg4B'] != "pg4B") {
header ("Location: 4C.php");
}
else
session_start();
if (!isset($HTTP_SESSION_VARS['pg4C']) || $HTTP_SESSION_VARS['pg4C'] != "pg4C") {
header ("Location: 5A.php");
}
session_start();
session_unregister("pg4C");
session_destroy();
?>
Please any help would be appreciated..
index.php and sessions
Moderator: General Moderators
Re: index.php and sessions
First thing would be to remove all references to session_start(); and just place one call to the session_start() function at the top of your script.
Also, you may just wish to use a cookie rather than a session, as the server will clear the session from the server, where as the cookie "should" stay in existence till you decide or the client clears it's cookies.
Hope that helps
Also, you may just wish to use a cookie rather than a session, as the server will clear the session from the server, where as the cookie "should" stay in existence till you decide or the client clears it's cookies.
Hope that helps
Re: index.php and sessions
Thank you will try that..