I have implemented PHP sessions on WordPress custom pages using a custom templates. I have used session like below:
session_start();
$_SESSION["uuid"] = $uuid;
$_SESSION["email"] = $email;
$_SESSION["mdmId"] = $network_id;
Everything working perfectly fine on the whole website. Now, by default, the current session timeout is something around 20 minutes maybe. So, we want to increase session timeout up to one hour. So what do we need to do to increase the session timeout period?
I have increased session timeout duration up to one hour using the below code, it's working on localhost, but not working on WordPress VIP hosting server platform.
session_start();
$_SESSION['login_time'] = time();
if(time()-$_SESSION['login_time']>=3600)
{
session_destroy();
header('location:/nexplanontraining/ctp-resources/login/');
die();
//redirect if the page is inactive for 60 minutes
}
else{
$_SESSION['login_time'] = time();
THE PAGE TEMPLATE GOES HERE
}