i HTTP_REFERER büyük sorun var

1 Cevap php

şimdi ben sitemde ve bu onun kod basit bir sistem yapmak

if(stc($_SERVER['HTTP_REFERER'], $_SERVER['HTTP_HOST'])){
//download directly
}else{
//open page first
}
function stc($haystack, $needle, $offset=0) {
    return strpos(strtoupper($haystack), strtoupper($needle), $offset);
}

if any one enterd the link from my site its download directly ok and if from any other sites its open a page now its working great but if any one installed any downloader such as inernet download manager its make the link directly not going to page first i think because its make HTTP_REFERER null now how i can doing the system like rapidshare.com

1 Cevap

strpos 0 dönebilirsiniz .... pos gibi 0 iğne olabilir (samanlıkta ilk Böl olarak, bir dize birinci konum 0).

strpos () dönüş sahte iğne bulunamazsa eğer.

0 ve sahte tablolar halinde hem aynıdır ...

$test = 0; if (!$test) echo "0 is like false";

$test2 = false; if (!$test2) echo "This one is also false..";

Bunu yanlış veya 0 olduğundan emin olmak gerekir, bu ile yapabilirsiniz: ===

if (strpos() === false)  echo "It's not found for sure!";

Yani kod olur:

if(stc($_SERVER['HTTP_REFERER'], $_SERVER['HTTP_HOST']) !== false){
//download directly
}else{
//open page first
}