in reply to Re^3: CGI Login script error
in thread CGI Login script error
#!/usr/local/bin/perl -Tw use CGI::Carp qw(fatalsToBrowser); print header(); $testUsername = param( "username" ); $testPassword= param( "password" ); open( PW, "password.txt" ) || die( "The database could not be opened." ); while ( $line = <PW> ) { chomp( $line ); ( $username, $password ) = split( ",", $line ); chop($password); if ( $testUsername eq $username ){ $userVerified = 1; if ( $testPassword eq $password ) { $passwordVerified = 1; } } } close( PW ); print header(); print start_html("Checking password!"); if ( $userVerified&& $passwordVerified ) { print "Permissionhas been granted, $testUsername .<br>"; print "Enjoy the site!< br>" } elsif ( $userVerified && !$passwordVerified ) { print "You entered an invalid password. <br>"; print "Access has been denied. <br>"; } else { print "You have been denied access to this site.<br>"; } print end_html();
|
|---|