if($ENV {"REQUEST_METHOD"} eq 'GET') { $rqst = $ENV{"QUERY_STRING"}} else {read(STDIN, &rqst, $ENV{"CONTENT_LENGTH"})} @rqstedtd = split(/&/, $rqst, 2); @user = split(/=/, $rqstedtd[1], 2); @pass = split(/=/, $rqstedtd[3], 2); open(PASS, "pass") or die "Couldn't find password file.\n"; open(LOGG, ">>log") or die "Coundn't find log file.\n"; while(<PASS>) { $fstln = $_; chomp($fstln); @login = split(/\t/, $fstln, 2); unless ($user[1] ne $login[0]) { next; } if($pass[1] eq $login[1]) { print <<EndOfTop Content-type: text/html <html> <title> Login sucessful! <head> <hr> </head> <body bgcolor="black" text="red"> <h3> Login succesful! <br> <br> <a href="www.eircom.net"> <h2> Click here to continue </a> <hr> </body> </html> EndOfTop } else { print <<EndOfBotom <html> <title> Login Unsuccesful </title> <head> <hr> <h3> Login unsuccesful </head> <body bgcolor="black" text="red"> Invalid username\password. <br> Please try again.<br> <br> <hr> <form method=POST action="file://C:\perl\login\password\login. +cgi"> User Name: <input name=user size=30> <br> Password: <input name=pass size=30> <br> <input type="submit" value="Send"> <hr> </body> </html> EndOfBotom }}
edited: Sun Dec 22 22:55:22 2002 by jeffa - title change (was: Help please!!)
In reply to Problem with CGI script by eoin
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |