Jump to content

Session expiry


rofl90

Recommended Posts

<meta http-equiv='refresh' content='x;somewhere.php' />
[/quote]

Where x is the seconds would send a user to somewhere.php x seconds after the page loaded.  If you're trying to log the user out after x seconds, that's a different story though.  You would need to expire the session.

Also, never trust anything client side.  A browser could easily ignore that meta tag and leave the client at that page.  If you're trying to make people logout after idle time, make their session expire or something, and then redirct the page.  Don't try to log them out by redirecting the page.

Just of curiosity, what's the purpose of this?  I might be able to answer better then, because I'm still not 100% what you're tryng to accomplish....  (02:19 might just be having a slow moment x.x.)

Link to comment
https://forums.phpfreaks.com/topic/95036-session-expiry/#findComment-486827
Share on other sites

use a session with the timeout period :)

 

Upon successful login

$_SESSION['timeout']=time()+15*60; // 15 minute timeout

 

than when u load a page check this timeout

 

if($_SESSION['timeout']<time()) {
     header("Location: login.php");  // If user timed out, send em back to loginpage
     session_destroy();  // Also remove his session variables;
     // remove any other Cookies or settings
    exit;
}
$_SESSION['timeout']=time()+15*60;  // Give User another 15 minutes

Link to comment
https://forums.phpfreaks.com/topic/95036-session-expiry/#findComment-486842
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.