Hi there guys,
I'm toying with a bot blocking script and I was going to offer the user a chance to block either via htaccess or a php include.
I want them to be able to block by multiple methods; IP/referer/user agent, and if it's done via htaccess, then I'll have these sections where the script would add any new additions. I'd like to segregate this so I can print the separate sections to screen if they want to view/delete any later.
I'm wondering if there's any way to dictate where fwrite writes in a file.
#
#Section for referer
#
SetEnvIfNoCase Referer /\#$ BadReferrer
SetEnvIfNoCase Referer html\#$ BadReferrer
SetEnvIfNoCase Referer php\#$ BadReferrer
#
#Section for user-agent
#
SetEnvIfNoCase User-Agent "^libwww-perl*" BadBots
order allow,deny
deny from env=BadReferrer
deny from env=BadBots
#
#Section for IPs
#
deny from 80.41.19.27
deny from 80.227.0.153
deny from 69.16.200.85
deny from 125.18.15.99
deny from 89.124.215.108
deny from 89.124.215.103
deny from 89.124.215.61
deny from 89.124.215.254
<Files 403.shtml>
order deny,allow
allow from all
</Files>
ErrorDocument 403 /403.shtml
ErrorDocument 404 /404.shtml
You can see how I've divvied up the conditions. Can I write the script to write to particular portions of the file? If so, how would I go about doing this?
thanks,
json