View Full Version : Cookies tutorials
Nightfire
10-25-2002, 03:19 PM
I'm wanting to learn how to use cookies. I've never used a cookie before (on the client's machine) not even in javascript. It's for templates on a site. Someone chooses a layout and then their choice is written into a cookie, so when they go back to the site, the layout they chose is still there.
I got no idea how to do this though, so are there any tutorials that are what I'm after out there?
beetle
10-25-2002, 04:39 PM
Here ya go
http://www.pscode.com/vb/scripts/ShowCode.asp?txtCodeId=357&lngWId=8
Nightfire
10-25-2002, 04:45 PM
Thanks :)
That site brings back memories of a few posts at the old pit :p
firepages
10-26-2002, 12:46 AM
Terms of Agreement:
By using this article, you agree to the following terms...
1) You may use this article in your own programs (and may compile it into a program and distribute it in compiled format for languages that allow it) freely and with no charge.
2) You MAY NOT redistribute this article (for example to a web site) without written permission from the original author. Failure to do so is a violation of copyright laws.
3) You may link to this article from another website, but ONLY if it is not wrapped in a frame.
4) You will abide by any additional copyright restrictions which the author may have placed in the article or article's description.
5)You are required to do a jig & whistle dixie b4 actually implementing this code.
6)non-compliance with this coyright may result in surgical removal of certain undisclosed organs
7)Use of this code requires you change you name by deed poll to Ian Ippopolitopotumus or else
............... and should now be acessed via the superglobal
$_COOKIE
so read ...
if(isset($_COOKIE['CookieValue'])) { //etc
beetle
10-26-2002, 01:17 AM
LOL firepages...nice editorial!
mordred
10-26-2002, 01:28 AM
I wouldn't trust the sample code on the pscode page, it seems like a very weak example. Maybe the author/maintainer is in fact a lawyer, judging from the heap of legalese on it.
else if ($function = "logout") {
Looks to me as if this condition will always be true... :rolleyes:
Nightfire, here's a site with a FAQ about cookies in general:
http://www.cookiecentral.com/faq/
And here an example of how to use them in PHP to generate a feedback form:
http://www.zend.com/zend/tut/feedback.php
beetle
10-26-2002, 01:56 AM
Sorry for my bad example...it was the first one I found...didn't think there was anything out there THAT horrible.
Apologies again :rolleyes:
firepages
10-26-2002, 02:04 AM
Well spotted Mordred ! , I could not get past the legalese as I have a short attention span :)
Beetle , no one expects code on sites to be that broken , we kind of assume it should work..
(....says the geezer who made an error in a 'hello world' example for phpdev :eek: )
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.