if ($words eq "" && $edit eq "yes") { make_form(); } else { send_form(); } sub make_form { open (FTXT, "$path_to_text") or die "where's the text file? : $!"; my @text_file = ; print "Content-type: text/html\n\n"; print "!!Edit News!!\n"; print "

!!Edit News!!

\n"; print "
\n"; print "

Password:\n"; print "

"; print "

"; print " \n"; } sub send_form { if ($pass eq $goodpass){ open (FTXT, "+< $path_to_text") or die "where's the damn file? : $!"; flock (FTXT,LOCK_EX) or die "Couldn't flock: $!"; seek (FTXT, 0, 0); truncate (FTXT,0) or die "Can't truncate: $!"; print FTXT $words; flock(FTXT,LOCK_UN); #unlock the file close FTXT or die "close damn you : $!"; print "Location: $url\n\n"; exit; } else { print "Content-type: text/html\n\n"; print " \n"; print " \n"; print "

!Unauthorized Access!\n"; print "
"; print "Hey bub, stop messin' with my News Page!\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; } }