Bu kodlar sevgili Ferruh Mavituna‘nın Zoque Forumundaki bir yazısından alınmıştır.
<?php
$banned_ip = array();
$banned_ip[] = ‘111.111.111.111′;
$banned_ip[] = ‘^([1][1][1](\.[0-9]{1,3}){3})$’; //111.* ipleri bloklar
$banned_ip[] = ‘^([1][1][2](\.[1][1][1])(\.[0-9]{1,3}){2})$’; //112.111.* ipleri bloklar
$banned_ip[] = ‘^([1][1][2](\.[1][1][2])(\.[1][1][1])(\.[0-9]{1,3}))$’; //112.112.111.* ipleri bloklar
//$banned_ip[] = ‘^([0-9]{1,3}(\.[0-9]{1,3}){3})$’; // *.* tüm ipler, umarım buna gerek kalmaz
$ip = ‘111.111.111.111′; // matches $banned_ip[0]
$ip = ‘111.1.2.1′; // matches $banned_ip[1]
$ip = ‘112.111.1.1′; // matches $banned_ip[2]
$ip = ‘112.112.111.1′; // matches $banned_ip[3]
foreach($banned_ip as $banned) {
if($ip == $banned || ereg($banned,$ip)){
echo “You have been banned!”;
exit();
}
echo “OK!\n”;
}
?>
Toplam Okunma: 384 | Bugunku Okunma: 2 | En Son Okunma: 05.01.2009 - 04:00












Son Eklenen 5 Yorum