webstudioro has asked for the wisdom of the Perl Monks concerning the following question:
#!perl BEGIN { $| = 1; open (STDERR, ">&STDOUT"); print qq~Content-type: text/html\n\n~; } use warnings; use CGI qw(:standard); use CGI::Cookie; use CGI; $user = "test"; $pws = "123456"; $query = CGI->new(); if ($query->param('user') eq ""){ print "<font color=\"red\">Enter your User name.</font>"; exit; } if ($query->param('pws') eq ""){ print "<font color=\"red\">Enter your password.</font>"; exit; } if (($query->param('user') eq "$user") && ($query->param('pws') eq "$p +ws")) { $query = CGI->new(); my %cookie = CGI::Cookie->fetch; if (exists $cookie{'$user'}) { print header, start_html('got cookie'), p('found the cookie: ' . $cookie{$user}->value), end_html, ; exit; } else { my $cookie = CGI::Cookie->new(-name=>$user,-value=>$pws,-expires=>' ++23h'); print header(-cookie=>$cookie), start_html('need cookie'), p('setting cookie, please reload'), end_html, ; exit; } } print "Your User name / Password it's not good.<br>"; exit;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Cookie problem
by Thelonius (Priest) on Aug 14, 2003 at 14:22 UTC | |
by webstudioro (Acolyte) on Aug 14, 2003 at 16:27 UTC | |
by chromatic (Archbishop) on Aug 14, 2003 at 22:26 UTC | |
by webstudioro (Acolyte) on Aug 15, 2003 at 07:36 UTC |