#!/usr/bin/perl -w use strict; use CGI qw(:standard); use CGI::Carp 'fatalsToBrowser'; $CGI::POST_MAX=1024*1; $CGI::DISABLE_UPLOADS = 1; print "Content-type: text/html\n\n"; my(@required) = qw(user password); my ($city,$county,$agency); ############################################################## # parse form input into hash and check for valid input ############################################################## read(STDIN, my($buffer), $ENV{'CONTENT_LENGTH'}); my(@pairs) = split(/&/, $buffer); my(%response); my($pair); foreach $pair (@pairs) { my($name, $value) = split(/=/, $pair); $value =~ tr/+/ /; $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; $response{$name} = $value; } ############################################################## # check for valid responses ############################################################## for ( @required ) { if ( $response{$_} eq "" ) { print "\n"; print "

\n"; print "

ERROR!

\n"; print "
You need to go back and enter a valid $_ before submitting
\n"; print "\n"; print "\n"; exit; } } ############################################################## # authenticate username and password ############################################################## open (F, "./user.pl"); while (){ my ($user,$pword,$cty,$agy,$coty) = split(/\|/); if ($user eq $response{'user'} && $pword eq $response{'password'}){ $city = $cty; $county = $coty; $agency = $agy; &amberInfo; exit; } } print "\n"; print "

\n"; print "

ERROR!

\n"; print "
Authentication Failed!!!
\n"; print "\n"; print "\n"; exit; sub amberInfo { print<

Amber Alert Info

Originator's Name
Agency
"; print<
City
"; print<
County

Amber Information

 

 

EOF }