Reply to Re: Ban and allow IP

Your name:

Reply:


Posted by Kim Andrι Akerψ on 05/18/06 18:14

sam.partington@gmail.com wrote:

>
> John wrote:
> > Hello, is it possible with PHP to ban a certain range of IPs but at
> > the same time allow access from one specific IP from this range?
> > Code example?
>
> Yes it is :
>
> if ($_SERVER['REMOTE_ADDR'] != '123.45.67.89')
> {
> exit;
> }
>
> But its not the best way. The better way would be to do it using your
> web server's settings. In Apache you would do something like this in
> httpd.conf :
>
> <Directory /usr/local/cgi-bin/>
> Order deny,allow
> Deny from all
> Allow from 123.45.67.89
> </Directory>
>
> Or in a file called .htconfig in the directory in which you wish to
> deny access :
>
> Order deny,allow
> Deny from all
> Allow from 123.45.67.89
>
> (I think, I've never used Deny, Allow in .htconfig myself check out
> the docs for your webserver)

Default filename for this directory configuration file is .htaccess,
though.

--
Kim AndrΓ© AkerΓΈ
- kimandre@NOSPAMbetadome.com
(remove NOSPAM to contact me directly)

[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

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