PDA

View Full Version : HTTP Cookies? how to write them?


ACJavascript
11-24-2002, 03:00 AM
Hello again ALL ya out there,

Heres the deal,, I need to place a cookie with the users username.. Not a problem, but what seems to be going wrong is that the cookie is not being placed! lol.. I can't get it to actualy write the cookie for my life!.

If you look at the code it has
print "Set-Cookie ect....
I thought it might be the print b/c it would write the cookie out on my page instead of the server. So i took the print out and it gave me errors.

So heres my code please tell me what i am doing wrong!.

______________

sub setCookies {

srand(time);

$expireDate = &expire;

print "Set-Cookie: NAME=$username; expires=$expireDate\n";

}

sub expire {

@moths = ("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec");
@days = ("Sun","Mon","Tue","Wed","Thu","Fri","Sat");

($sec,$min,$hr,$mday,$mon,$yr,$wday,$ydar,$isdst) = gmtime(time + (86400*1));

$timestr = sprintf("%3s,%02d-%3s-%4d %02d:%02d:%02d GMT",$days[$wday],$mday,$months[$mon],$yr+1900,$hr,$min,$sec);
return $timestr;

}

ACJavascript
11-26-2002, 02:36 AM
Please sobody i have been pickin my brain to much lol,, its starting to hurt.. I really need some help with this:D:D:D:D:D