Re: Cookies!!!!

From: Date: Tue, 18 Jul 2000 19:58:23 +0000
Subject: Re: Cookies!!!!
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-7143@lists.php.net to get a copy of this message
$cookie=$variable setcookie(cookie,$cript,time()+600,"/","",1);
Loose that "1" at the end. Make it "0" You're specifying that you only want the cookie passed over a secure link. Do you have a secure link set up? Is that what you intended? Also, fill in the server position. Here's some code that works, it's a bit wordy, but it's easier to debug that way, IMHO. #This part just generates a 10 digit hexidecimal random number srand(date("s")); $possible="1234567890ABCDEF"; $Cvalue=""; while(strlen($Cvalue)<10) {$Cvalue.=substr($possible,(rand()%(strlen($possible))),1);} #Cookie expires in an hour $Expire_time = time()+(60*60); $Scope="/"; $Cname="Cookie"; $Server="www.spamwhack.com"; setcookie($Cname,$Cvalue,$Expire_time,$Scope,$Server); Note, I don't specify secure or not, it's supposed to default to not. It's working code, YMMV -- www.SpamWhack.com A pre-emptive strike against spam Where's dave? http://www.findu.com/cgi-bin/find.cgi?kc6ete-9 My transistor sings with unintended parasitic the smoke escapes By Jeff Stout

« previous php.general (#7143) next »