Page 1 of 1

Sessions expiring -> quick fix?

Posted: Sat Jan 14, 2006 1:39 pm
by seodevhead
I am starting sessions when user's register a username and login (so it remembers them), however after a couple weeks, I notice the session ends and I have to login again. I want to set the sessions so that they never expire or at least expire after a very long time (kinda like vBulletin, phpBB, Yahoo!, etc). This is the session start I am using... what do I need to change/add to get this to work right? Thanks!

NOTE: My login.php assigns the session variables correctly :)
BELOW: the code below is in the header file of every php page.

Code: Select all

session_set_cookie_params (60*60*24*10000, '/', 'www.mywebsite.com');
session_start();

Posted: Sat Jan 14, 2006 1:43 pm
by Jenk
sessions that last a couple weeks? I'd hate to be your host/server admin :/

use cookies to identify the user and and to "log them in" automatically if they so wish - don't use, or expect to use sessions for more than say an hour tops. They are called sessions to represent variables that are to remain persistant per 'session' of the user sitting at their pc.

Posted: Sat Jan 14, 2006 1:49 pm
by seodevhead
So I guess setcookie() is the function I need to use instead of session_set_cookie_params() like I had??? Thanks!