|
Posted by Kimmo Laine on 01/24/07 12:04
"Erwin Moller"
<since_humans_read_this_I_am_spammed_too_much@spamyourself.com> wrote in
message news:45b731e2$0$320$e4fe514c@news.xs4all.nl...
> Kimmo Laine wrote:
>
>> "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...)
>
> Kimmo, you MUST love Perl. :P
You'd think that, but actually no. I've never learned perl - I haven't even
tried it. :)
--
"Ohjelmoija on organismi joka muuttaa kofeiinia koodiksi" - lpk
http://outolempi.net/ahdistus/ - Satunnaisesti pδivittyvδ nettisarjis
spam@outolempi.net | rot13(xvzzb@bhgbyrzcv.arg)
[Back to original message]
|