So, i am working on this website:
http://www.funkydictionary.com/signup.php
And i have run in to a very weird issue that i have not had before, i have a login page, and a signup page so far, server language is PHP, i pass error and success msges via sessions, so, when a user tries to log in, or register, a success or failure $_SESSION is set.
And he is redirected to the signup page where his error/success will be shown.
Now for some odd reason, sessions cannot be set, and i noticed that the favicon is not displayed either, until the browser is refreshed ?
When this has happend, everything works fine, but if the browser is clossed and thereby all sessions unset, the samme issue occurs?
I am guessing this has something to do with the server configs?
Any help is appreciated
EDIT 1:
This is included at the top of everypage:
<?php
session_start();
if(isset($_SESSION['login']) && $_SESSION['login'] == 1) {
$error_message = "";
$success_message = "";
$now = time(); // checking the time now when home page starts
if($now > $_SESSION['expire'])
{
session_unset();
session_destroy();
global $loggedIn;
$loggedIn = null;
$error_message = 'Your session has expired, please login again.<br />';
session_start();
$_SESSION['error'] = $error_message;
died($success_message, $error_message, '/login.php');
}
else {
global $loggedIn;
$loggedIn = 1;
}
}
?>
EDIT 2:
When/How do sessions expire?
Well on login i set a session ['start'] = time(); and ['expire'] = start + 60*60
here is the code
session_start();
$_SESSION['login'] = "1";
$_SESSION['username'] = $row['username'];
$_SESSION['start'] = time();// taking now logged in time
$_SESSION['expire'] = $_SESSION['start'] + (60 * 60) ; // ending a session in 30 minutes from the starting time
global $loggedIn;
$loggedIn = 1;
$success_message = 'You have logged in as ' . $row['username'];
died($success_message, $error_message, '/login.php');