I found an user which visits my site to quickly (his HTTP_USER_AGENT is empty). I would like to ban his ip address to prevent the access to the server. How can i do that? I am using PHP with mySql and Apache.
You need to get or gather the IP address of your visitors to get the Ip: <?php $ip = $_SERVER['REMOTE_ADDR']; Code (markup): if you still don't know what to do, here is the complete code that i always use; <?php $ip = $_SERVER['REMOTE_ADDR']; $ban = array('333.333.333.333','68.225.34.86'); $count = count($ban); for ($i=0; $i<$count; $i++) { if($ip == $ban[$i]) { die("I'm sorry, you've been banned. $ip"); } } ?> Code (markup): notice 61.9.18.62. this is the IP to be banned.
As there are loads of other suggestion thats why i think this suggestion would be good for you. If you have the root access then you can go for it. Use Iptables to block an IP with the following command: Regards