CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
Search Posts SEARCH
Who's Online WHO'S
Log in LOG

Home: Perl Programming Help: Intermediate:
Reading Cookies



Mar 20, 2001, 10:07 PM

Post #1 of 1 (221 views)
Reading Cookies Can't Post

I can write cookies with javascript generated thru a cgi script and loaded to the browser but when I try to read the cookie data from a different cgi scrpit it is not finding the cookies.
Here is some of the javascript stuff:

print header;
print "<script language=JavaScript>", "\n";
print "function cookie(){", "\n";
print "writeCookie('username', '$username');", "\n";
print "writeCookie('email', '$email');", "\n";
print "writeCookie('password', '$password');", "\n";
print "writeCookie('clientname', '$clientName');", "\n";
print "}", "\n";
print "//Start of cookie data", "\n";
print "expireDate = new Date", "\n";
print "expireDate.setMonth(expireDate.getMonth()+1)", "\n";
print "function writeCookie(name , data){", "\n";
print "var cookieStr = name + '='+ data", "\n";
print "document.cookie = cookieStr+';expires=' + expireDate.toGMTString()", "\n";
print "return true", "\n";
print "}", "\n";
print "// End of cookie code", "\n";
print "</script>", "\n";
print "<body background=../index/bkgd.jpg onLoad=cookie()>", "\n";

then in the other cgi script I tried this:
1) Matt's cookie.lib adn using the getcookie sub w/o arguments returned '0' or not found.....
2) stright from the perl docs...
%cookies = fetch CGI::Cookie;
foreach (keys %cookies) {

by the way the I can read the cookies via javascript generated via a cgi script just not from perl or at least the cgi script.

any ideas would be great
thanks in advance


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives