1

I'm using this code to set a login session from this answer

issue with session lifetime

$lifetime=604800;
session_start();
setcookie(session_name(),session_id(),time()+$lifetime);

checking the resources tab from inspect element the session cookie should end on 2015-10-20

enter image description here

But I was signed out after closing the webpage in an hour and when I print the session I get " Undefined index: SESSION_NAME". So how to solve this problem and set the correct session lifetime to work?

PHP User
  • 2,350
  • 6
  • 46
  • 87

0 Answers0