Do not delete cookies; use php sessions

From: Date: Mon, 31 May 2004 08:25:13 +0000
Subject: Do not delete cookies; use php sessions
References: 1  Groups: php.windows 
Request: Send a blank email to php-windows+get-23893@lists.php.net to get a copy of this message
When you use php you do not need to deal with cookies explicitely. Instead use just php's sessions. Set a session variable to the username after the password validation. When logging out just set this session variable to "". (Or, in a more object-oriented manner, create an user object after validation, delete it when logging out.) Do not use cookies to store passwords. It may be unsecure since cookies are sent forth and back all the time during a session. "Daniel Anderson" <shadowedmyth@hotmail.com> schrieb im Newsbeitrag news:BAY19-DAV11yZqbzaFB0000ec63@hotmail.com... Hi, can anyone tell me how to clear a cookie when the line comes up? Because the following: setcookie("name",""); does work yes, but not well enough. I need it to remove that cookie there and then. For example: You go through a login process to access a page, it sets a cookie with username and password so it registers you as being logged in. When you click a link which directs you to a logout page, it will clear the cookie. This is all well and good but if you retype the url to get back to the page, e.g. http://server/main/ it will still state that you have logged in. This seems to be flying all over the place, can anyone help? Please don't direct me to the PHP Manual or any other place as I have already checked. Many thanks, Dan

« previous php.windows (#23893) next »