Blocking IP using PHP

Well, my server is under a massive botnet attack.

They are currently attacking /showthread.php on my forum.

I was wondering if anyone knew a good method of blocking an IP address from PHP? So when the bot's access the page, it drops their IP from server. Don't worry about legit users, I have emailed them telling where the forum has moved too for time being.

What I thought:

Code:
<?php

$ipaddy = $REMOTE_ADDR; 

$command = shell_exec(iptables -I INPUT -s $ipaddy -j DROP);
//echo "$command";



?>
Didn't work though. Any ideas?

 

 

 

 

Top