Codice PHP:
<?php 
// per ottenere l'url che ha generato l'errore
$where "http://$HTTP_HOST$REQUEST_URI"
$ip$_SERVER['REMOTE_ADDR'];
$query_string$_SERVER['QUERY_STRING'];
$http_referrer$_SERVER['HTTP_REFERER'];
$date=getdate();
$sec=$date['seconds'];
$min=$date['minutes'];
$hor=$date['hours'];
$mday=$date['mday'];
$mon=$date['mon'];
$year=$date['year'];
if (isset(
$where)) {
$filename"/web/htdocs/www.tuosito.it/home/logsite/log.txt";
$content="$where || $ip  || $mday/$mon/$year  ||  $hor:$min:$sec ";
$fpx fopen ($filename"a");
$fw=fwrite ($fpx$content);
fclose ($fpx); 
}
if (
stristr($query_string,'union')!=FALSE )
{
echo 
"Hai utilizzato il comando sql UNION";
exit();
}
if (
stristr($query_string,'select')!=FALSE )
{
echo 
"Hai utilizzato il comando sql SELECT";
exit();
}
if (
stristr($query_string,'delete')!=FALSE )
{
echo 
"Hai utilizzato il comando sql DELETE";
exit();

}
if (
stristr($query_string,'drop')!=FALSE )
{
echo 
"Hai utilizzato il comando sql DROP";
exit();

}
if (
stristr($query_string,'insert')!=FALSE )
{
echo 
"Hai utilizzato il comando sql INSERT";
exit();

}
?>
vedi se questo funziona....
poi ottimizzo il codice ammesso che funge...