questo è il codice... provatelo e ditime se può essere utile :tongueOLD
Codice PHP:<?PHP
//php antileecher
//created by evolutioncrazy
//marco@evcz.tk
//concesso sotto licenza gnu/gpl versione 2 o successiva
//versione 0.1
//file supportati: gif, jpeg, png
//per richiamare un'immagine risiedente nella cartella /images/
//al posto dell'url dell'immagine mettere:
//http://evcz.altervista.org/img.php?img=nomefile.gif
//se l'immagine si trova in una sottocartella usare questa url
//http://evcz.altervista.org/img.php?img=sottocartella/nomefile.gif
//se il tipo di file richiesto non corrisponde ai previsti oppure il dominio dove è usato non corrisponde al previsto viene
//mandata in uscita un gif trasparente 1px*1px
//SETTAGGI
//dominio senza www, senza http e senza fronzoli vari
$dominio = "evcz.altervista.org";
//cartella protetta con la funziona del pannello di controllo
$fullpath = "/membri/evcz/images/";
//FINE SETTAGGI
//INIZIO CODICE (non occorre modificare nulla da qui in poi)
$lunghezza = strlen($dominio);
$referer = strtolower($_SERVER['HTTP_REFERER']);
$referer = str_replace("http://", "", $referer);
$referer = str_replace("www.", "", $referer);
$referer = substr($referer, 0, $lunghezza);
$img = str_replace("../", "", $img);
if(isset($referer) && $referer == $dominio){
//controllo effettiva estensione
$tipo = getimagesize($fullpath."".$img);
switch($tipo['mime']){
case "image/gif":
$estensione = ".gif";
break;
case "image/jpeg":
$estensione = ".jpg";
break;
case "image/png":
$estensione = ".png";
break;
default:
$estensione = "VIETATA";
break;
}
if($estensione != "VIETATA"){
header ("Content-Type: ".$tipo['mime']);
$size = filesize($fullpath."".$img);
header ("Content-Length: ".$size);
readfile($fullpath."".$img);
exit();
}
else{
header ("Content-Type: image/gif");
header ("Content-Length: 43");
echo chr(0x47).chr(0x49).chr(0x46).chr(0x38).chr(0x39).chr(0x61).chr(0x01).chr(0x00).
chr(0x01).chr(0x00).chr(0x80).chr(0x00).chr(0x00).chr(0x04).chr(0x02).chr(0x04).
chr(0x00).chr(0x00).chr(0x00).chr(0x21).chr(0xF9).chr(0x04).chr(0x01).chr(0x00).
chr(0x00).chr(0x00).chr(0x00).chr(0x2C).chr(0x00).chr(0x00).chr(0x00).chr(0x00).
chr(0x01).chr(0x00).chr(0x01).chr(0x00).chr(0x00).chr(0x02).chr(0x02).chr(0x44).
chr(0x01).chr(0x00).chr(0x3B);
}
}
else{
header ("Content-Type: image/gif");
header ("Content-Length: 43");
echo chr(0x47).chr(0x49).chr(0x46).chr(0x38).chr(0x39).chr(0x61).chr(0x01).chr(0x00).
chr(0x01).chr(0x00).chr(0x80).chr(0x00).chr(0x00).chr(0x04).chr(0x02).chr(0x04).
chr(0x00).chr(0x00).chr(0x00).chr(0x21).chr(0xF9).chr(0x04).chr(0x01).chr(0x00).
chr(0x00).chr(0x00).chr(0x00).chr(0x2C).chr(0x00).chr(0x00).chr(0x00).chr(0x00).
chr(0x01).chr(0x00).chr(0x01).chr(0x00).chr(0x00).chr(0x02).chr(0x02).chr(0x44).
chr(0x01).chr(0x00).chr(0x3B);
}
//FINE INIZIO CODICE
?>
