|
Posted by Toby A Inkster on 06/18/07 21:28
laredotornado@zipmail.com wrote:
> setcookie('LoggedIn', 1, time() + REMEMBER_ME_TIME, "/");
>
> 1. How do I check if this cookie is set at the top of a given PHP
> page?
if (isset($_COOKIE['LoggedIn']))
echo "Cookie is set.";
> 2. How do I delete this cookie?
Re-set the cookie, using a time in the past.
setcookie('LoggedIn', 0, 0, "/");
By the way, if this is for a log in system, it's hideously insecure. Users
can easily tamper with cookies. Use sessions instead.
--
Toby A Inkster BSc (Hons) ARCS
[Geek of HTML/SQL/Perl/PHP/Python/Apache/Linux]
[OS: Linux 2.6.12-12mdksmp, up 115 days, 5:09.]
dict, thes & ency
http://tobyinkster.co.uk/blog/2007/06/18/dict-thes-ency/
Navigation:
[Reply to this message]
|