if(!isset$_SESSION['expiry']){
$_SESSION['expiry']=time()+$time_to_expire;
}else{
//if time have expired
if( time()>$_SESSION['expiry']){
//echo message and redirect to the page
//unset variable
}
}
*untested*
evstevemd
Senior Poster
3,713 posts since Jun 2007
Reputation Points: 462
Solved Threads: 392
Thank you it works.
But I would like to ask: I have read somewhere (I can't remember where anymore), that when session starts, it may set a cookie named SSID on client-side.
Is that true, and if it is , can it be used for such a thing?
I would advice you to stay away with internals of PHP.
That being said, I will quote Vikram's explanation found here :
Sessions work by associating every session with a session ID (a unique
identifier for the session) that is automatically generated by PHP. This session ID is
stored in two places: on the client using a temporary cookie, and on the server in a
flat file or a database. By using the session ID to put a name to every request received,
a developer can identify which client initiated which request, and track and maintain
client-specific information in session variables (variable-value pairs which remain alive
for the duration of the session and which can store textual or numeric information).
evstevemd
Senior Poster
3,713 posts since Jun 2007
Reputation Points: 462
Solved Threads: 392
Thank you everyone, you all were a great help to me.
With this i think it's case closed.
Enjoy! :)
evstevemd
Senior Poster
3,713 posts since Jun 2007
Reputation Points: 462
Solved Threads: 392