in reply to Critque my second script for me?
_____________________________________________________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 = <FTXT>; print "Content-type: text/html\n\n"; print "<head><title>!!Edit News!!</title></head>\n"; print "<body bgcolor=#FFFFFF><center><h1>!!Edit News!!</H1></cente +r>\n"; print "<form name=form1 method=post "; print "action=http://www.weezelflesh.com/cgi-bin/newseditor.cgi>\n +"; print "<center><p><textarea name=words cols=80 rows=10 wrap=hard>" +; print "@text_file</textarea></p><p><p>Password:<input type=passwor +d name=pass>\n"; print "</p><p><input type=submit name=Submit value=Edit the News!> +"; print "</p></center></form>"; print "</body></html> \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 "<HTML> \n"; print "<body bgcolor=000000 text=99CCCC> \n"; print "<CENTER><H1><font face=Arial>!Unauthorized Access!\ +n"; print "<BR>"; print "<font color = red>Hey bub, stop messin' with my New +s Page!\n"; print "<BR>You are at IP address $user !"; print "</H1></CENTER></font></body>"; open MAIL,"|mail $mail" or die "mail problem : $!"; print MAIL "$user tried to get in using $pass for a passwo +rd.\n"; close MAIL; exit 0; } }
|
|---|