I know this might be a duplicate question, but I can't seem to find an answer to my specific problem.
I have 3 PHP files. signin.php gets users data and passes it to signin_auth.php.
signin.php then redirects to mytoolkit.php after successful sign in.
signin_auth.php uses the following code at the very end of the PHP script:
<?
session_start();
$_SESSION['sessionID'] = $id;
$_SESSION['time'] = time();
header ("Location: mytoolkit.php");
exit;
?>
Then, the users is redirected to mytoolkit.php, which uses this code:
<?
session_start();
if (!isset($_SESSION['sessionID'])) {
header('Location: signin.php?message=4');
exit;
}
$inactive = 5400;
$session_life = time() - $_SESSION['time'];
if ($session_life > $inactive) {
session_destroy();
header("Location: signin.php?message=5");
exit;
}
?>
The session variables aren't storing and mytoolkit.php keeps redirecting me to signin.php?message=4
Probably a stupid mistake. I've just been looking at it too long.
UPDATE --
So I have a couple of servers. Both on iPage. I moved the entire folder over to a differnent server (abc.com/toolkit is now copied to xyz.com/toolkit) The app runs perfectly on xyz.com... it the first server that's giving me probelms.
There both run on the same hosting company. I'm not sure what to do.
session_start()cant go together, along with whitespaces prev to it.