antileech
| From: | maseducativa.com | Date: | Sat, 12 May 2001 10:43:51 +0000 |
| Subject: | antileech | ||
| References: | 1 | Groups: | php.general.es |
| Request: | Send a blank email to general-es+get-10067@lists.php.net to get a copy of this message | ||
Hola:
Tengo un problema que me está volviendo loco. Este pequeño script antileech
hace un 'warning' indicandome que ya he enviado cabeceras antes de las
lineas Headers (54,55 y 56):
Warning: Cannot add header information - headers already sent by (output
started at /home/httpd/html/download.php:1) in
/home/httpd/html/antileech.php on line 54
Warning: Cannot add header information - headers already sent by (output
started at /home/httpd/html/download.php:1) in
/home/httpd/html/antileech.php on line 55
Warning: Cannot add header information - headers already sent by (output
started at /home/httpd/html/download.php:1) in
/home/httpd/html/antileech.php on line 56
Obviamente no he enviado cabecera alguna (ver el script que adjunto). En el
php.ini no tengo fichero alguno para cargar previa que me pudiera estar
molestando.
Por tanto, ¿cuál es mi error?
Un saludo
Manuel P.
<?
/*
//**************************************
// Name: Very Good Anti-Leech Script
// Description:This is the best anti-leech script out there. There is
now way at all to tell where a file is coming from. What it does is open the
file, and streams it through the script. This example demonstrates various
functions of PHP.
// By: Steve Oliver (genocide)
//
//
// Inputs:$domain - your domain name.
//$folder - folder that your files are in.
//
// Returns:None
//
//Assumes:None
//
//Side Effects:None
//This code is copyrighted and has limited warranties.
//Please see
http://www.Planet-Source-Code.com/xq/ASP/txtCodeId.286/lngWId.8/qx/vb/script
s/ShowCode.htm
//for details.
//**************************************
*/
/*Anti-Leech script by Steve Oliver
This is the best anti-leech out there.
No way of telling where the file is coming from.
Set the 2 variables below, $domain and $folder.
You can replace the errors below where commented with html files if
wanted.*/
//your domain
$domain="www.maseducativa.com";
//folder that the files are in, no lead or trailing slashes
$folder="soft";
$nombre_fichero=stripslashes(urldecode($QUERY_STRING));
//this can be replaced with
//if
($nombre_fichero==""){readfile("http://www.yourdomain.com/invalidfile.html")
;exit;}
if ($nombre_fichero==""){die("<h1>Invalid File
Request...</h1>");}
$refr=getenv("HTTP_REFERER");
if (!$refr) {$refr="http://www.maseducativa.com/";}
list($remove,$stuff)=split('//',$refr,2);
list($home,$stuff)=split('/',$stuff,2);
//this can be replaced with
//if
($home!=$domain){readfile("http://www.yourdomain.com/leecher.html");exit;
if($home!=$domain){die("<h1>Leecher!</h1>This file is from $domain");
}else{
$fp=@fopen("http://".$domain."/".$folder."/".$nombre_fichero,"r");
if($fp){
if (ereg(".mp3",$nombre_fichero)){$xtype="audio/mpeg";}
elseif(ereg(".zip",$nombre_fichero)){$xtype="application/x-zip-compressed";}
elseif(ereg(".exe",$nombre_fichero)){$xtype="application/x-msdownload";}
else{$xtype="application/octet-stream";}
Header("Content-Type: $xtype");
Header("Accept-Ranges: bytes");
Header("Content-Disposition: ; Filename=$nombre_fichero");
readfile("http://".$domain."/".$folder."/".$nombre_fichero);
}else{
//this can be replaced with
//readfile("http://www.yourdomain.com/filenotfound.html");exit;
die("file not found");
}}
?>