Click to See Complete Forum and Search --> : [RESOLVED] Blocking IP Address's
mrwilson
03-08-2008, 06:06 PM
In using a script to determine if someone is a spammer or hacker by meeting certain criteria (script is written and in use), how would one go about blocking those address's from future visits? I am using two databases for this, IP's that meet the spammer criteria go to one and all good visitors go to another
I would be looking at blocking IP address's and those that I determine such as (rima-tde.net) as spammers
I am currently filtering page hits of this type
(preg_match("/(http%|paged|%|http)/", $page)) and putting it into a SQL database that reports scam attempts, and collects the IP address, what was the page request, host name and date.
I am not looking for someone to write a script for me, although that would be nice, just a few comments on what type of code to use so I could learn to do it myself
Thanks for your comments in advance
mrwilson
03-08-2008, 09:29 PM
Could it be as simple as using this?
elseif (preg_match ("/(rima-tld.net)/", $host))
{
header ("Location: http://disney.go.com/index");
exit;
}
TecBrat
03-08-2008, 10:11 PM
In using a script to determine if someone is a spammer or hacker by meeting certain criteria (script is written and in use), how would one go about blocking those address's from future visits? I am using two databases for this, IP's that meet the spammer criteria go to one and all good visitors go to another
I would be looking at blocking IP address's and those that I determine such as (rima-tde.net) as spammers
...
I like the suggestion to send them to Disney, but you could just do
<?
/////// insert code here that checks $_SERVER['REMOTE_ADDR'] against the bad IP list
if($bad_ip){die('You are not allowed to visit this site.');}
?>
skywalker2208
03-08-2008, 10:15 PM
I don't think you need two databases to store good and bad ip's. You only need one database with the bad ip's. all you would have to do is if it is a bad ip then display a message or send them somewhere else. If it isn't a bad ip address use the else and display the site.
mrwilson
03-08-2008, 11:00 PM
Thank you tecBrat And skywalker.
Skywalker, I use two databases simply becuase I had the first set up for one definite purpose and that is displaying all the data that was captured, who was there, how mn ay visits and all that stuff. Then I started seeing page requests such as this "/?date=http%3A%2F%2Fwww.m" and realized not all visitors were nice guys.
So I just found it easier to make a second table and capture the bad guys instead of modifying the first table.
Maybe I should have said 2 tables instead of 2 databases. But I see your point and think it well considered.
Tecbrat, I knew this would be too easy! I should have realized I could use die right off the bat. I am blocking bots for the most part so there is no need to give them a message, but I think your option is the best, just stop them in their tracks. Disney really doesnt need them either.
Thanks to both of you for your responses.