Foro de elhacker.net

Programación => PHP => Mensaje iniciado por: Luisango en 17 Enero 2007, 18:44 pm



Título: [Codigo] Anti leech en php (o como se diga) :D
Publicado por: Luisango en 17 Enero 2007, 18:44 pm
Hola de nuevo!

Estaba navegando y encontre un codigo que parece ser de gran utilidad para que no averiguen los links de descarga, segun dice la web de la que la coji. Bueno aqui os lo dejo y espero que sea de utilidad!:

Código:

<?php
/*
Copyright (c) 1999 Marcel Lemmen
       E-mail: lemmen@support.nl
       All  rights  reserved.
*/

$files=array( 'track01.mp3', 'escreen.exe');
$filenames=array( 'Thank ABBA for the music.mp3', 'Escreen.exe');
$additional_info=array( 'Various artists - Thanx ABBA for the music : 4978602 by
tes', 'Shareware program to make a screenshot: 529920 bytes');
$url= "/home/lemmen/public_html/data/";
/* When the files are on another server, use the
   whole address (http://www.server.com/dir/) in stead of /home/lemmen... */
       
$referer=ereg_replace( "\?.", "",$HTTP_REFERER);
$thisfile= "http://$HTTP_HOST$PHP_SELF";
       
if ($referer!=$thisfile){
        echo "<center><big>Homepage: <a href=\"http://home.support.nl/~lemmen\">
http://home.support.nl/~lemmen</big><br><hr><br><br></center>";
        for ($i=0;$i<count($files);$i++)
        echo  "<P><A HREF=\"$PHP_SELF?$i\">",$filenames[$i], "</A> $additional_i
nfo[$i]\n";
}
else {
        $i=$QUERY_STRING;
        $total=$url . $files[$i];
        Header ( "Content-Type: application/octet-stream");
        Header ( "Content-Length: ".filesize($total));
        Header( "Content-Disposition: attachment; filename=$filenames[$i]");
        readfile($total);
}
?>




Un saludo!!