PHP Code:
function check_injection()
{
$badchars = array("DROP", "SELECT", "UPDATE", "DELETE", "DELETE" , "UNION", "WHERE", "FROM");
foreach($_REQUEST as $value)
{
if(in_array(strtoupper($value), $badchars))
{
$logfile= 'log/log.txt'; //chmod 777 $IP = $_SERVER['REMOTE_ADDR']; $logdetails= date("F j, Y, g:i a") . ': ' . '.$_SERVER['REMOTE_ADDR'].' target=_blank>'.$_SERVER['REMOTE_ADDR'].''; $fp = fopen($logfile, "r+"); fwrite($fp, $logdetails, strlen($logdetails)); fclose($fp);
header('Location:http://go-to-hell.com');
}
else
{
$check = preg_split("//", $value, -1, PREG_SPLIT_OFFSET_CAPTURE);
foreach($check as $char)
{
if(in_array(strtoupper($char), $badchars))
{
$logfile= 'log/log.txt'; $IP = $_SERVER['REMOTE_ADDR']; $logdetails= date("F j, Y, g:i a") . ': ' . '.$_SERVER['REMOTE_ADDR'].' target=_blank>'.$_SERVER['REMOTE_ADDR'].''; $fp = fopen($logfile, "r+"); fwrite($fp, $logdetails, strlen($logdetails)); fclose($fp);
header('Location:http://go-to-hell.com');
}
}
}
}
}
PHP Code:
check_injection();
No comments:
Post a Comment