[prev in list] [next in list] [prev in thread] [next in thread]
List: cgi-list
Subject: RE: [CGI] Script
From: Kevin Meltzer <kevin.meltzer () commandsys ! com>
Date: 1998-12-16 13:42:13
[Download RAW message or body]
Grassy,
What exactly isn't working? It just looks incomplete... This should work
open(OUT,">lockout.txt");
foreach $file (@lockout) {
if ($file =~ /$delpass/) {
next;
}
print OUT $file . "\n";
}
Cheers & HTH,
Kevin
http://www.perlguy.com
> -----Original Message-----
> From: Grassy [mailto:grassy@grassy.com]
> Sent: Tuesday, December 15, 1998 9:13 PM
> To: cgi-list@jann.com
> Subject: [CGI] Script
>
>
> I have a script that has a file consisting of IP numbers
> listed one per
> line as
> follows:
>
> 123.46.789.123
> 13.46.789.123
> 123.435.675.676
> 632.26.289.113
> 13.6.79.173
>
> I have another script that allows someone to come in and
> delete an IP if they
> choose. For example if they wanted to delete the IP
> 123.435.675.676 they
> would
> enter it in a form and then the script wouldf strip out the file and
> replace it
> with the following:
>
> 123.46.789.123
> 13.46.789.123
> 632.26.289.113
> 13.6.79.173
>
> I have a foreach loop now but it is not working:-( I have this:
>
> $delpass = $FORM{'ip'};
> chomp ($delpass);
>
> open(LOCKOUT,"lockout.txt");
> @lockout=<LOCKOUT>;
> close(LOCKOUT);
>
> foreach $file (@lockout) {
> if ($file =~ /$delpass/) {
> # do something here to delete it!!!
> }
> }
>
> print "Content-type: text/html\n\n";
> print "<HTML><BODY>IP is reinstated!.</BODY></HTML>\n";
>
> Any ideas? TIA
>
> Bryan
>
> -----------------------------------------------------------------
> To unsubscribe, send mail to "majordomo@jann.com" with
> "unsubscribe cgi-list"
> in the body.
>
> The CGI Tips & Tricks website (and archive of the list) is located
> at http://www.jann.com/Perl/
>
> cgi-list is hosted by Summit Communication Design
(http://www.summitdesign.net).
Summit Communication Design is a full-service web hosting firm
providing web design, cgi programming and inter/intra-net support.
-----------------------------------------------------------------
-----------------------------------------------------------------
To unsubscribe, send mail to "majordomo@jann.com" with "unsubscribe cgi-list"
in the body.
The CGI Tips & Tricks website (and archive of the list) is located
at http://www.jann.com/Perl/
cgi-list is hosted by Summit Communication Design (http://www.summitdesign.net).
Summit Communication Design is a full-service web hosting firm
providing web design, cgi programming and inter/intra-net support.
-----------------------------------------------------------------
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic