Jump to content
Larry Ullman's Book Forums

honjian5231

Members
  • Posts

    2
  • Joined

  • Last visited

honjian5231's Achievements

Newbie

Newbie (1/14)

0

Reputation

  1. I did read about this in stackoverflow...still you want to suggest this bad solution since its not reliable? Updated my homework. What if i wan to use this code?meet the logic? where should i put to get it work?
  2. Hi ,this book are really good , simple and easy to understand , don't have any problem on understanding your words so far. I have apply to two of my project . This is not really a problem , just not sure where to start off . I was trying to improve the login system , because when the user forget to click the logout button , the session doesn't logout automatically.What i trying to do is make a session expire after 15 minutes of inactivity ? Any ideas ? [sOLVED] used this solution apply to include/config.inc.php just after the session_start() Hope this can helps $live = false; // Errors are emailed here: $contact_email = 'abc@gmail.com'; define ('BASE_URI','.'); define ('BASE_URL','www.domain.com/'); define ('MYSQL', BASE_URI . '/include/mysql.inc.php'); // Start the session: session_start(); $timeout = 15; // Set timeout minutes $logout_redirect_url = "index.php"; // Set logout URL $timeout = $timeout * 60; // Converts minutes to seconds if (isset($_SESSION['start_time'])) { $elapsed_time = time() - $_SESSION['start_time']; if ($elapsed_time >= $timeout) { $_SESSION = array(); // Destroy the variables. session_destroy(); setcookie (session_name(), '', time()-86400, '/'); // Destroy the cookie. header("Location: $logout_redirect_url"); } } $_SESSION['start_time'] = time();
×
×
  • Create New...