#!/usr/bin/perl ## gigasoft ## ## once again, name this file ## something like "password.pl" parse_form(); $user_name = $FORM{'username'}; $pass_word = $FORM{'password'}; $url_success = "secret_area.html"; ## change "secret_area.html" to the url ## of the page your keeping protected ## look below, change guest to the username ## that you want, and silver to the password ## that you want unless ($user_name eq "guest" && $pass_word eq "silver") { print "Content-type: text/html\n\n"; print "Incorrect login"; exit(); } print "Location: $url_success\n\n"; exit(); sub parse_form { read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'}); @pairs = split(/&/, $buffer); foreach $pair (@pairs) { ($name, $value) = split(/=/, $pair); $value =~ tr/+/ /; $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; $FORM{$name} = $value; } }