Forum Moderators: coopster & phranque

Message Too Old, No Replies

Reading Cookies in PERL

set cookie in JS, read it in PERL

         

txbakers

10:49 pm on Dec 17, 2001 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



As part of a larger ASP app I am offering an interactive calendar. I want to be able to show the calendar to everyone who has access to it, but strip off the navigation buttons for the "view only people."

The nav buttons are embedded in the Perl Script, but I can condition them with Perl variables.

I tried to write a cookie routine, but it doesn't seem to grab the proper cookies.

I set the cookie using javascript back on the log-in page. Does the cookie only work for that page? I set the cookie without an expiration date.

Here is the Perl code for the cookie routine:

$cdata = $ENV{'HTTP_COOKIE'};
@cookies = split(/;/,$cdata);
foreach $i (@cookies) {
($name,$cid) = split(/=/,$i);
if ($name eq "calendar"){
print "$name = $cid\n";
$thecode = $cid;}
}

When I test the value of $name, all I get is the ASP Session cookie and not the others I set.

When I check the cookies in the javascript, I get the entire string.

I am barely a novice in Perl.

Cyborg

11:39 am on Dec 18, 2001 (gmt 0)



Read cookies with JS and send it in query string.