Jump to content

Session expiry


rofl90

Recommended Posts

Errr assuming your session stuff is stored in a mysql table?

 

What exactly are you trying to do?  Are you trying to make the session expire after X seconds?  Are you trying to make the user go to a certain page after sitting inactive on a page for X seconds?  Or what?

Link to comment
Share on other sites

<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
Share on other sites

lol at the last bit,

 

I'm trying to gain more control over users, by saying if your idle for x minutes you will be logged out, logout.php contains the session deleting stuff, is there a way to check on the time in php as like a meta tag almost a countdown?

Link to comment
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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.