#!/usr/bin/perl -w #----------------------------------------------- # Login version 3 # # Purpose: Receive username and password through # CGI, and verifies them with a list of usernames # and passwords stored in an array. Prints whether # the user is verified. # # Author: H.L. Hiew # Created: 10/07/2000 # Last modified: 10/08/2001 # #----------------------------------------------- use CGI qw(:standard) ; # get the user-supplied name and passwd from CGI my $username = param("name") ; my $passwd = param("passwd") ; # Create data on ONE valid user by storing it in a hash %passwordlist = ("test" => "test", "homer" => "doH...!", "bart" => "caRamBa" ) ; # print the starting tags of the HTML document print <

Login Page version 3


$username is END # Print the words "verified" or "not verified" depending on the # check for the password stored in %validusers for $username # is the same as $passwd if ($passwordlist{$username} eq $passwd) { print "verified." ; } else { print "not verified." ; } # Print the remaining tags of the HTML document print < END