Very nice !
If you want to get a report also on .txt file about who attacked and when add these lines between the 2 last lines... It should look like this
Code:
$cuseragent = $_SERVER['HTTP_USER_AGENT'];
////////// To make a log file //////////
$info = $cremotead." - ".date("F j, Y, g:i a")."\n";
$fp = fopen("attack_report.txt","a");
fwrite($fp, $info);
fclose($fp);
/////////////////////////////////////////
die( "Attack detected! <br /><br /><b>This attack has been identified and blocked:</b><br />$cremotead - $cuseragent" );
The result would look like:
83.23.16.48 - February 4, 2008, 1:07 am