i have created one project in PHP, into which i am managing sessions.
I am creating session in my config.php file by writing following line of code.
session_start();
and to destroy this session, in logout.php file i have write following line.
session_destroy();
and i have not mention any code for session in any other project file, but the problem is session is active untill i call logout.php,
what i want is session should expire if user is inactive for 15 minutes.
can anyone help me for this, i am new to PHP, please give some example code or link to achieve this..
Call below function in your header file, so that whenever user does any activity at that time page gets refreshed and check whether session time outs or not.
Use something like this in header
User_time is the session name. I hope this answer will help you. What actually this code does is : “Checks whether diff is greater than 1500 seconds or not. If not then set new session time.” You can change time diff(1500) according to your requirement.