I am working on a site for a small (reading: <50 users) non-profit organization that I work with, and my knowledge of PHP is quite limited. Currently, I have a login script that I found from an online tutorial. The problem I am facing is that every user logs out after about an hour or so.
Security is really not a problem with the content, and ideally I would like someone to stay logged in for several days or weeks. However, any google search for session duration connects me with people who want to shorten the logout timer.
As for the code, as soon as the login page compares the username and password with the database and follows with:
session_register("myusername"); session_register("mypassword"); header("location:index.php")
And on every protected page, it starts with:
session_start(); if(!session_is_registered(myusername)){ header("location:login.html:); }
php login session duration
scott.j.lockhart
source share