Merhabalar,
Aşağıda hazırladığım sınıf ile sitenize yasaklı sitelerden gelen kullanıcıları google.com'a yönlendirebileceksiniz.
<?php
class bannedAddress
{
protected $refererAddress;
protected $bannedAddressArray;
public function __construct(array $bannedAddress)
{
$this->refererAddress = $_SERVER['HTTP_REFERER'];
$this->bannedAddressArray = $bannedAddress;
}
protected function _checkRefererAddress()
{
if( ! is_numeric(substr($this->refererAddress, 0, 3)) )
{
if( substr($this->refererAddress, 0, 4) == 'www.' )
{
$this->refererAddress = substr($this->refererAddress, 4);
}
}
}
protected function _blockBannedAddress()
{
if( in_array($this->refererAddress, $this->bannedAddressArray)
{
header('Location:http://www.google.com/');
}
}
}
?>Kullanımı ;
<?php
$yasakli_siteler = array('r10.net', 'facebook.com');
$site_yasakla = new bannedAddress($yasakli_siteler);
?>$yasakli_siteler dizi değişkeninde tanımladığımız sitelerden gelen kullanıcılar otomatik olarak google.com'a yönlendirilir.
hazırladığım sınıfı scriptinizin kilit dosyalarından birisine yerleştiriniz.
İyi forumlar