Do not delete cookies; use php sessions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxx> schrieb im Newsbeitrag
news:BAY19-DAV11yZqbzaFB0000ec63@xxxxxxxxxxxxxx
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

-- 
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Database Programming]     [PHP Install]     [Kernel Newbies]     [Yosemite Forum]     [PHP Books]

  Powered by Linux