iam new to this domain. iam developing online quiz contest project in php (mysql,javascript,ajax) i need Automatic session timeout/logout and also i need time counter display using php and AJAX. pls refer any website. i searching for last 2 days..

advance thanks..

5 Years
Discussion Span
Last Post by Stefano Mtangoo

As per the first part of the question which is setting how long until the session expires or time-outs you can use the following code to adjust when it time outs. The first setcookie function will adjust it to a specified time (1 year) and the second set cookie function will set it to infinite time or whenever the browser is closed.

$second_till_timeout=60*60*24*365; //one year
setcookie ('PHPSESSID',$_COOKIE['PHPSESSID'],time()+$seconds_till_timeout); //until specified

setcookie ('PHPSESSID',$_COOKIE['PHPSESSID'],2147483647); //forever

And yes the php session does make a cookie called PHPSESSID which is what makes the session ends and this is what we are adjusting.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.