in reply to Perl/CGI login
use CGI; my $cgi = new CGI; my $user = $cgi->param("username"); my $pass = $cgi->param("password"); my $valid = 0; # Assuming usernames/passwords in a delimited text file open(IN, "passwordFile") or die(...); while(<IN>) { if( /^$user\:$pass$/ ) { $valid = 1; last; } } close(IN) if(!$valid) { print "Sorry, you may not access this page."; exit; } #set authentication #set a cookie here using javascript or #add hidden fields with login info print "<input type='hidden' name='pass' value='...'>"; print "<input type='hidden' name='user' value='...'>"; Store usernames/passwords in a file as follows: johndoe:myPassw0rd user2:pass2 user3:pass3 etc
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Perl/CGI login
by muclc7 (Initiate) on Dec 03, 2005 at 00:00 UTC |