Do you have a question? Post it now! No Registration Necessary. Now with pictures!
- Posted on
- Problems with PHP and sessions
May 14, 2005, 2:42 am
rate this thread
I have a login page, that have this code:
It is called from a page with a form and 3 inputs, email, password and
mysql_connect("localhost", "user", "psw");
$email = $_POST["email"];
$psw = $_POST["psw"];
$autologin = $_POST["autologin"];
if($autologin == "on")
$_SESSION["email"] = $email;
$_SESSION["psw"] = $psw;
mysql_query("UPDATE blaa....") or die(mysql_error());
My index.php looks like this:
$email = $_SESSION["email"];
$psw = $_SESSION["psw"];
.... blaa... ?>
My problem is, that if set the "autologin = on" (that means the cookie
must have a 365 days expire), my cookie is set perfectly on the login
page but as soon as it is redirected to the index page, it overwrite the
cookie with an expire whenever the browser closes!?
I have seen on the PHP manual page, that there can be a lot of problems
if you use a "header", but how do I fix this problem (if possible)? I
- Alistair Baillie SS2002
May 14, 2005, 3:25 am
Re: Problems with PHP and sessions
SEssion cookes only exist for the duration of the session, and are normally
deleted by the browser when u close the window.
Your server will also delete the session info from ur server after 20
minutes (or whatever the default is set to).
For auto login, save the username and password in a cookie that is saved in
the users computer, and then check for the cookie existance.
(I probably wouldnt store the password, store some random key).
- » ssh on command line: force using a group size (prime size) of 1024 (and no...
- — The site's Newest Thread. Posted in » Secure Shell Forum