Loading ...
Sorry, an error occurred while loading the content.

final cookie code.

Expand Messages
  • Franki
    Hi all, Can anyone tell me what is wrong with this code?? sub set_cookie { use CGI::Cookie; $cookie1 = new CGI::Cookie(-name = cart_id , -value =
    Message 1 of 1 , Oct 10, 2001
    • 0 Attachment
      Hi all,

      Can anyone tell me what is wrong with this code??

      sub set_cookie {
      use CGI::Cookie;
      $cookie1 = new CGI::Cookie(-name => 'cart_id',
      -value => "$cart_id",
      -expires => "$expiration",
      -domain => "$domain",
      -path => "$path",
      -secure => $secure
      );
      print "Set-Cookie: $cookie1\n";
      }

      sub get_cookie {
      use CGI::Cookie;
      %cookies = fetch CGI::Cookie;
      if (defined $cookies{'cart_id'}){
      $CART_ID = $cookies{'cart_id'}->value;
      $cookie{'cart_id'} = "$CART_ID";
      }
      else {
      $cookie{'cart_id'} = "";
      }
      }

      Something about it is not functional in IIS/win2000, but it works flawlessly
      in linux/unix
      Since that is the case, and I can find nothing on the net about it, I am
      assuming that the
      code is at fault, and there isn't a bug in IIS or NT that stops this from
      working...


      Have I gotten it wrong??? I had to study the CGI::Cookies doc pretty hard to
      get this far...
      So I can't figure out whats wrong with it...

      The only thing I could think of was the code that sets the expiry..(24 hours
      in the future)
      $now = time;
      $twenty_four_hours = "86400";
      $expiration = $now+$twenty_four_hours;#number of days until cookie expires

      Would Nt/iis somehow work that out to be an alreay expired date??
      To test that theory, I replaced the last line with:

      $expiration = "1002840450";

      It still didn't work... (neither did no expiration, which is supposed to be
      a session cookie.)

      Can anyone give me some tips here please???



      Many thanks,


      rgds

      Frank
    Your message has been successfully submitted and would be delivered to recipients shortly.