List:General Discussion« Previous MessageNext Message »
From:Douglas Brantz Date:September 16 2000 11:06pm
Subject:Cookie checking in Perl
View as plain text  
I know this isn't the list to post this type of question, but thought
someone here would know the answer.

I'm working in Perl and with CGI::Cookie;  and would like to know why
this code won't work?

#use strict;
use diagnostics;
use CGI;
use DBI;
use CGI::Cookie;
use acsvars qw(%config);

print $query->header("text/html");
if ($ENV{'HTTP_COOKIE'}) {
#
#---------------- Cookie Check ----------------
%cookies = fetch CGI::Cookie;
$USERID = $cookies{$config{'cname'}}->value;
if ($USERID ne "$config{'cvalue'}"){
#print "Content-Type: text/html\n\n";
print  $query->start_html  (-title=>'Cookie
Check',-link=>'blue',-alink=>'blue',-vlink=>'blue');
print "<html>";
print "<head>";
print "sorry you need to login first.";

If the cookie has expired or if there is no cookie it should go to the
what if statement and it works on another script but not this one?  I
just get a document contains no data error message?  It actually works
if you login as admin and the cookie is checked and everything is ok,
but after it expires it complains with the document contains no data?
It seems that the cookie value is not returned almost like the name and
value of the cookie are gone and $USERID = nothing?  but I would think
that the code would work?

Thanks,

Douglas

Thread
Cookie checking in PerlDouglas Brantz17 Sep
  • Re: Cookie checking in Perl - FixedDouglas Brantz17 Sep