Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
#!/usr/bin/perl print "Content-type: text/html\n\n"; & read_input; $bad_ip = $FORM{'banip'} ; unless ($bad_ip =~ /^\d+.\d+.\d+.\d+$/) { print "<font face=Verdana size=2>That IP looks Invalid!"; print"<br><br>\n"; print "<div align = center><a href=\"javascript:history.go(-1)\">Go B +ack and Try Again</a></div>"; exit; } unless (-e "ip.txt") {print "There are no banned IP's<br>"; exit; } open (IP, "<ip.txt"); @ip= <IP>; close (IP); open (IP, ">ip.txt"); foreach $_(@ip) { chomp $_; if (/$bad_ip/) {next}; chomp$_; print IP "$_\n"; close (IP); } print "All Done!<br>"; print"<br><br>\n"; print "<div align=center><a href=cp.htm>Back to the menu here</a>"; sub read_input { if ($ENV{'REQUEST_METHOD'} eq 'POST') { read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'}); } else { $buffer = $ENV{'QUERY_STRING'}; } @pairs = split(/&/, $buffer); foreach $pair (@pairs) { ($name, $value) = split(/=/, $pair); $name =~ tr/+/ /; $name =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; $value =~ tr/+/ /; $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; $FORM{$name} = $value; } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
(ar0n: grep/splice) Re: Deleting a value in a list
by ar0n (Priest) on Nov 29, 2001 at 21:53 UTC | |
|
Re: Deleting a value in a list
by George_Sherston (Vicar) on Nov 29, 2001 at 21:24 UTC | |
|
Re: Deleting a value in a list
by tune (Curate) on Nov 29, 2001 at 21:35 UTC | |
|
Got it
by Anonymous Monk on Nov 30, 2001 at 01:07 UTC |