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:
Cookie frustrations



Aug 19, 2000, 1:07 AM

Post #1 of 1 (652 views)
Cookie frustrations Can't Post

I am trying to write a program that, when accessed, will check to see if a cookie is available.. if not, it will create a new cookie with the variables gained from an Environmental query, and if there is a cookie, it will add the new variable (from Env. query) to the variables already in the cookie.

The code I have written follows, and as far as I can see, seems to be correct and should do what it is supposed to, but doesn't. The program has been tried on two different servers but to no avail.

#!c:\perl\bin\perl.exe -d

use CGI;
use CGI::Cookie;

$cgiobject = new CGI;


$cookie = $cgiobject->cookie('aotgidtd');

if ($cookie eq "")

<BODY background="/aotg/images/bgdwood.gif">This is the Planner


sub cookie{
$IDcook = $cgiobject->cookie('aotgidtd');
@vars = split(/:/, $IDcook);
push @vars, $ID;
$cookdata = join(':', @vars);
$cookiego = $cgiobject->cookie(-name=>'aotgidtd',
print $cgiobject->header(-cookie=>$cookiego);

sub nocookie{
$cookiego = $cgiobject->cookie(-name=>'aotgidtd',
print $cgiobject->header(-cookie=>$cookiego);

Any help with this would be most welcome, and would dramatically reduce the strain on my poor over-worked brain...


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

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