#!/usr/local/bin/perl
$mailprog = '/usr/sbin/sendmail';
$recipient = 'ebardhi@ic.sunysb.edu';
# Print out a content-type for HTTP/1.0 compatibility
print "Content-type: text/html\n\n";
# Keep the curious out.
if ($ENV{'REQUEST_METHOD'} ne "POST") {
print "
Invalid Script Access";
print "Invalid script access.
\n";
exit;
}
# Get the input
read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
# Split the name-value pairs
@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;
}
&blank_response unless ($FORM{'name'} &&
$FORM{'password'});
$ok = 0;
open (PW, "login.db");
while ($name = ) {
$password = ;
$nickname = ;
chop($name); chop($password);
if (($name eq $FORM{'name'}) and ($password eq $FORM{'password'})) {
$ok = 1; last; }
}
close PW;
if ($ok == 1) {
print "
Greetings $nickname!
Welcome
to\n";
print ' getCustomizedMenu Cafe.'
} else {
print "
I am sorry $FORM{'name'},
but you do
not have proper
\n";
print "access to
getCustomizedMenu Cafe!\n";
print '
Back to Main Login Screen.'
}