[Solved] How to set to expire session automatically in given time , in session creation time? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 6

[Solved] How to set to expire session automatically in given time , in session creation time?

Php session

9th May 2020, 5:54 AM
Gaurav Dixit๐Ÿ‡ฎ๐Ÿ‡ณ
Gaurav Dixit๐Ÿ‡ฎ๐Ÿ‡ณ - avatar
4 Answers
+ 6
I found this on StackOverflow: if (!isset($_SESSION['CREATED'])){ $_SESSION['CREATED'] = time(); } else if (time()-$_SESSION['CREATED'] > time_in_seconds){ //handle code for what happens } https://stackoverflow.com/questions/520237/how-do-i-expire-a-php-session-after-30-minutes?r=SearchResults
9th May 2020, 6:06 AM
๐Ÿ‘‘ Prometheus ๐Ÿ‡ธ๐Ÿ‡ฌ
๐Ÿ‘‘ Prometheus ๐Ÿ‡ธ๐Ÿ‡ฌ - avatar
9th May 2020, 6:01 AM
Gordon
Gordon - avatar
+ 1
https://code.sololearn.com/wa103a4A1a7A/?ref=app
20th Jun 2021, 2:59 AM
Gaurav Dixit๐Ÿ‡ฎ๐Ÿ‡ณ
Gaurav Dixit๐Ÿ‡ฎ๐Ÿ‡ณ - avatar
0
You should implement a session timeout using session.gc_maxlifetime option.
11th May 2020, 5:46 PM
Lokesh Gupta
Lokesh Gupta - avatar