Reply to Re: PHP IP blocking script is not working...

Your name:

Reply:


Posted by Kimmo Laine on 01/24/07 09:52

"Arjen" <dont@mail.me> wrote in message
news:45b7294c$0$71733$dbd45001@news.wanadoo.nl...
> Franηoise Debat schreef:
>> Hello,
>>
>> I wonder if anybody can help. I have an IP blocking script which displays
>> a blank screen if an IP is detected from a list in an external file. The
>> problem is, the script only reads the last IP¨in the file, not every one.
>> Can somebody tell me where this is going wrong?
>
> <snip long script>
>
> $banned_list = file($file)
> if (in_array($_SERVER['REMOTE_ADDR'], $bannedlist))
> {
> echo "This website is currently unavailable";
> exit();
> }

That's just one line if you *really* want to optimize (^__^)

in_array($_SERVER['REMOTE_ADDR'], file($file))
and exit("This website is currently unavailable");

(Kid's, don't try this at home or at all. Writing really short code can be
quite confusing and very unmaintainable...)

[Back to original message]


УдалСнная Ρ€Π°Π±ΠΎΡ‚Π° для программистов  •  Как Π·Π°Ρ€Π°Π±ΠΎΡ‚Π°Ρ‚ΡŒ Π½Π° Google AdSense  •  England, UK  •  ΡΡ‚Π°Ρ‚ΡŒΠΈ Π½Π° английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Π‘Π°ΠΉΡ‚ ΠΈΠ·Π³ΠΎΡ‚ΠΎΠ²Π»Π΅Π½ Π² Π‘Ρ‚ΡƒΠ΄ΠΈΠΈ Π’Π°Π»Π΅Π½Ρ‚ΠΈΠ½Π° ΠŸΠ΅Ρ‚Ρ€ΡƒΡ‡Π΅ΠΊΠ°
ΠΈΠ·Π³ΠΎΡ‚ΠΎΠ²Π»Π΅Π½ΠΈΠ΅ ΠΈ ΠΏΠΎΠ΄Π΄Π΅Ρ€ΠΆΠΊΠ° Π²Π΅Π±-сайтов, Ρ€Π°Π·Ρ€Π°Π±ΠΎΡ‚ΠΊΠ° ΠΏΡ€ΠΎΠ³Ρ€Π°ΠΌΠΌΠ½ΠΎΠ³ΠΎ обСспСчСния, поисковая оптимизация