koryw has asked for the wisdom of the Perl Monks concerning the following question:
#!/opt/bin/perl use CGI ':standard'; $query = new CGI(); $sweet = $query->cookie(-name=>'answers');#check for a cookie #Get current Time $current_time = localtime; #does cookie exist if ($sweet) { print "Content-type: text/html\n\n"; #create html page info print $query->start_html(-title=>"Session"), $query->h1("cookie exists $sweet<BR>"), $query->p("The current time is $current_time<BR>"); end_html; #cookie doesn't exist, set one and send it to the browser }else{ $cookie = $query->cookie(-name=>'answers', -value=>'Register', -expires=>'+1h', -path=>'/cgi-bin/'); print $query->header(-type=>'text/html', -cookie=>$cookie); print "<B>Cookie Set <b>"; } exit;
edited: Thu Mar 13 15:56:05 2003 by jeffa - code tags
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
•Re: Cookie user ID queston
by merlyn (Sage) on Mar 13, 2003 at 16:10 UTC | |
|
Re: Cookie user ID queston
by hardburn (Abbot) on Mar 13, 2003 at 16:09 UTC | |
|
Re: Cookie user ID queston
by zby (Vicar) on Mar 13, 2003 at 16:09 UTC | |
|
Re: Cookie user ID queston
by Hero Zzyzzx (Curate) on Mar 13, 2003 at 18:00 UTC | |
by koryw (Novice) on Mar 13, 2003 at 19:26 UTC |