View Single Post

  #4 (permalink)  
Old 04-17-2008
Brendan Gillatt
 
Posts: n/a
Default Re: can htaccess read from files?

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

mentalguy2004 wrote:
> Thanks for the help. Do you know of any good PHP scripts that would help
> here? I've tried Googling and all the relevant links I've found seem to be
> dead.


Basically the idea is to end up with a file such as:

<Limit GET HEAD POST>
order allow,deny
deny from xxx.xxx.xxx.xxx
deny from yyy.yyy.yyy.yyy
deny from zzz.zzz.zzz.zzz
allow from all
</LIMIT>

So you would read the file, line by line until you found the start of the
'deny from' lines. You would then read these lines into an array, append
the newly blocked host, turn the array back into a string and add the
header and footer bits.


- --
Brendan Gillatt | GPG Key: 0xBF6A0D94
brendan {a} brendangillatt (dot) co (dot) uk
http://www.brendangillatt.co.uk
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (MingW32)

iD8DBQFIBoShuv4tpb9qDZQRAmuGAJ4jIQJnfS4lpzHs6kXUFO riHow7xwCfd/Tt
AwToTqrkZaR/e9TUcPRDScs=
=ICDx
-----END PGP SIGNATURE-----