3
Contributors
3
Replies
4
Views
6 Years
Discussion Span
Last Post by maba001
0

Hello!
I want to continue a session even after the browser was closed. What I want to do is to remember the host, username, password, of mysql. Whats the trick?

You could store a cookie. It basically means constructing a small part of the session like logic yourself. Create an md5 hash. Pass that on to the client as a cookie. Create a file with the md5 hash plus some prefix and extension as the filename and then put the details you want to store in there.

Of course you can use a DB as an alternative storage method for your special session.
Another option is to pass the session-ID to the client as a cookie and extend the session timeout to a very long time (lets say a month).

0

You can store it in a coockie...

setcookie("name","value",expiration)

and for read it

$_COOKIE["name"]

Edited by P0lT10n: n/a

0

You can store it in a coockie...

setcookie("name","value",expiration)

and for read it

$_COOKIE["name"]

So now you have some code that shows how to do it. I would recommend not to store passwords in cookies. The problem with that is twofold: the password is transmitted in clear text on every call to a page on that site (regardless of whether or not it uses the cookies or not) and problem 2, the password is stored in clear text in the cookie files on the client PC without any real protection. Therefore I would really just store some unique session key inside the cookie and store the details on the server side in a place that is indexed using this cookie value.

My 2 Ct.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.