I run this code and it all seems to work other than when the password is correct it will not create the cookie nor will it redirect you to the page. all that it outputs is
Set-Cookie: username=param%28%27name%27%29; domain=.storm.prohosting; path=/; expires=Thu, 14-Jun-2001 02:48:01 GMT Date: Thu, 14 Jun 2001 01:48:01 GMT Content-Type: text/html; charset=ISO-8859-1 Location: http://storm.prohosting.com/fightior/cgi-bin/warrior.pl
!/usr/local/bin/perl
use CGI ':standard';
print header();
print start_html();
$name=param('name');
open FILE, "user/$name" or die "Error: $!\n";
my %data = ();
while ( my $line = <FILE> ) {
chomp $line;
my ($key, $value) = split(/\s*:\s*/, $line);
$data{$key} = $value;
}
close FILE;
#this section checks if the password is correct and lets you into the
+game or tells
#you that the password was incorect
if (param('password') eq $data{password}) {# if the password is correc
+t you enter the game
my $query = CGI->new();
my $cookie = $query->cookie(-name=>'username',
-values=>'param('name')',
-expires=>'+1h',
-domain=>'.perlmonks.org');
print $query->header(-cookie=>$cookie);
print URI: http://www.storm.prohosting.com/cgi-bin/warropr.pl;
}
if (param('password') ne $data{password}) {#this part tells you if th
+e password was not
open (NOPASS, "../password.htm");
for $line (<NOPASS>) {
print $line;
}
}
close NEWFILE ;
close NOPASS;
end_html();
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.