Forum Moderators: coopster

Message Too Old, No Replies

Pages Logs off automatically after few minutes

Dont want to ever log off unless I close the page?

         

shruti

7:40 pm on Aug 6, 2008 (gmt 0)

10+ Year Member



Dont want to ever log off unless I close the page?
How can I do that?
This is the fist like of my code which has to be with the session.

<?php
session_start();
if(!isset($_SESSION['username'])) {
include "login.html";exit;
}
?>

StoutFiles

7:48 pm on Aug 6, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



How big is your site? I reccommend no session variables, as there is a user limit as well as it bogs down the cpu. Try to avoid them now as a good habit.

ag_47

12:18 am on Aug 7, 2008 (gmt 0)

10+ Year Member



Yea, use database to store login info (you probably have a users db anyway, just add a sessid column)

eelixduppy

5:18 am on Aug 7, 2008 (gmt 0)



Look at the
session.cookie_lifetime
directive in your php.ini configuration file and see what it says. If it says anything other than "0" then it's going to expire your session variables after that many seconds. "0" means "When you close the browser" basically.