Hotlink Koruması ( Class )


PHP- Kodu:

<?


class D_Security {





var $lista;


var $path;





function Dow_Security() {


$this->lista = array(); // Create empty host list


$this->path = "./"; // set default path do current folder


}





function SetPath($path) {


$this->path = $path;


}





function AddHost($host) {


if (empty($host)) {


return false;


}


$this->lista[] = $host;


return true;


}





function RemoveHost($host) {


for ($i=0;$i<count($this->lista);$i++) {


if ($this->lista[$i]==$host) {


$this->RemoveArrayItem($this->lista,$i);


}


}


}





function ListHosts() {


return $this->lista;


}





function RemoveArrayItem(&$ar,$item)


{


$ar = array_merge(array_splice($ar,0,$item),array_splice ($ar,1));


}





function DownloadFile($filename) {


if ($this->ChecaReferer() == true) {