if (isset($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) === 'xmlhttprequest')
{
echo "b";
}
else {
$ip = $_SERVER['REMOTE_ADDR'];
$bandosyasi= 'ban.txt';
$contents = file_get_contents($bandosyasi, TRUE)
OR exit('Unable to open file');
$exists = !stripos($contents, $ip)
OR exit();
$ban .= "{$ip}\n";
file_put_contents($bandosyasi, $ban, FILE_APPEND)
OR exit('Cannot append rule to file');
}