#!/usr/bin/perl -w use strict; use CGI qw/:standard/; use CGI::Carp qw/fatalsToBrowser /; my $q = CGI->new(); #declare some vars my $mail ='menu@uranus.com'; my $path_to_text="/home/mysite/www/myfolder/my.txt" # Parse Form Search Information # if it's a single form value, map the value as a scalar, otherwise, the value is # an arrayref my %FORM = map { $_, @{[ param($_) ]} > 1 ? [ param($_) ] : param($_) } param(); my $words = $q->param('words'); if ($words eq ""){ $words = "no specials today"; } my $user = $ENV{'REMOTE_ADDR'}; my $pass = $q->param('pass'); if ($pass ne "whatever"){ open (TEXTFILE,"$path_to_text") || die "where's the damn file? : $!"; $words = ; close (TEXTFILE) || die "close damn you : $!"; print "Content-type: text/html\n\n"; print " \n"; print " \n"; print "

!Unauthorized Access!\n"; print "
"; print "The menu for tonight remains \n"; print " $words "; print ".
\n"; print "Hey bub, stop messin' with my menu!\n"; print "
You are at IP address $user !"; print "

"; open MAIL,"|mail $mail" or die "mail problem : $!"; print MAIL "$user tried to get in using $pass for a password.\n"; close MAIL; exit 0; }else{ open (TEXTFILE,"$path_to_text") || die "where's the damn file? : $!"; print TEXTFILE $words; close (TEXTFILE) || die "close damn you : $!"; print "Content-type: text/html\n\n"; print "

\n"; print "The menu has been updated for you.
\n"; print "The menu for tonight is \n"; print " $words .

"; open MAIL,"|mail $mail" or die "mail problem : $!"; print MAIL "$user changed the menu $words.\n"; close MAIL; }