You are here: Re: setting and deleting cookies « PHP Programming Language « IT news, forums, messages
Re: setting and deleting cookies

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]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация