|
Lord of the Rant.
Formerly turtle2472 |
New host and things are working quite right. This used to work with an old host but haven't been able to get it working. My idea came from this post on a really old host's forum. So the basic idea is some bot crawls my site and ignores my do not enter sign in the robots.txt. In doing so they follow a link to a php function that gets their IP address and adds it to a txt file. That file is referenced in the .htaccess where if your number is in there you are 403'd out of the site.
So my .htaccess looks like this only with more bad_bot entries Code:
SetEnvIfNoCase User-Agent "^Wildsoft Surfer" bad_bot
SetEnvIfNoCase User-Agent "^WWWOFFLE" bad_bot
SetEnvIfNoCase User-Agent "^Xaldon WebSpider" bad_bot
SetEnvIfNoCase User-Agent "^ZBot" bad_bot
<Limit GET POST>
Order Allow,Deny
Allow from all
Deny from env=bad_bot
</Limit>
SetEnvIfNoCase Request_URI ban-ip\.txt ban
<Files ~ "^.*$">
order allow,deny
allow from all
deny from env=ban
</Files> My sandtrap URL in my main index.html isCode:
<div style="display:none;"><a href="http://mydomain.com/sandtrap">Sandtrap, I wouldn't click here if I were you. You need to allow Java Script on this site. :) </a></div> robots.txt is this plus a few more thingsCode:
User-agent: *
Disallow: /sandtrap
Disallow: /ban-ip My sandtrap/index.php has this in itPHP Code:
<?php
Problem being is it's not working on my new server. Two issues. One is that the users IP isn't being added to the ban-ip.txt. It is adding a new line to the file, but not an IP. Then, even after manually adding my IP to the list I'm not being blocked at all. Can anyone with some better guidance step in here and help me out with this? Louis L'Amour, “To make democracy work, we must be a notion of participants, not simply observers. One who does not vote has no right to complain.” MineCraft? mc.applenova.com | Visit us! | Maybe someday I'll proof read, until then deal with it. |
|
|
quote |
|
Lord of the Rant.
Formerly turtle2472 |
I found this function/script that seems to work well in getting the IP and would love to see if incorporated if someone who know php far better than me wouldn't mind help out with this. I'd love the page to display their IP and add it to the ban-ip.txt file.
PHP Code:
<?php PHP Code:
<?php Also, if there is a way to do the same thing with HTML that would be awesome. I don't think I need it, but it'd be cool to have. I only need this code in the sandtrap folder so it's not going to be viewed or anything. Just be cool if it were available. Louis L'Amour, “To make democracy work, we must be a notion of participants, not simply observers. One who does not vote has no right to complain.” MineCraft? mc.applenova.com | Visit us! | Maybe someday I'll proof read, until then deal with it. Last edited by turtle : 2011-08-03 at 00:52. |
|
|
quote |
|
Lord of the Rant.
Formerly turtle2472 |
PHP Code:
<center>
Code:
SetEnvIfNoCase Request_URI ban-ip\.txt ban
<Files ~ "^.*$">
order allow,deny
allow from all
deny from env=ban
</Files> Also, all files are in or in subfolders of the public_html. .htaccess resides in the public_html directly. ban-ip and sandtrap folders a child folders of public_html.Louis L'Amour, “To make democracy work, we must be a notion of participants, not simply observers. One who does not vote has no right to complain.” MineCraft? mc.applenova.com | Visit us! | Maybe someday I'll proof read, until then deal with it. |
|
|
quote |
| Posting Rules | Navigation |
|
|
| Thread Tools | |
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| ssh not working through Terminal | kieran | Genius Bar | 7 | 2007-08-18 10:52 |
| USB not working right | sweattyc | Genius Bar | 4 | 2007-05-26 20:59 |
| Working on My Car | drewprops | AppleOutsider | 15 | 2006-07-01 22:16 |
| onclick not working in firefox, but working on IE/netscape | sri_kon | Programmer's Nook | 3 | 2006-04-20 10:13 |
| Fan not working at all | Myst | Genius Bar | 4 | 2005-06-08 01:23 |