NoLeech script virker ikke
Hej - Er der et klogt hovede der kan se hvor det går galt i nedenstående script?siden bliver kaldt med kommandoen:
<a href=\"noleech.php?sti=game?filename=testfil.zip\">Download testfil</a>
<?php
$go = 0; // assume failure
$redirectpage = \"nejnejogatternej.php\"; //where to go if the query is valid
$validreferer = \"http://www.homepage.dk/test/download.htm\"; // allowed calling pages
$path = \"/home/hypermind/test/$sti\";
// check for valid refererring address.
if (getenv(\"HTTP_REFERER\") == $validreferer)
{ $go=1;}
explode($path,$filename);
// if ($path == \"\" || $filename == \"\") {$go = 0;}
if ($go == 1)
{
// no need to go anywhere after this, since the file downloads straight from the link.
header(\"Content-Disposition: atachment; filename=$filename\");
header(\"Content-Type: application/octet-stream\");
header(\"Content-Length: \".filesize(\"$path/$filename\"));
header(\"Pragma: no-cache\");
header(\"Expires: 0\");
$fp=fopen(\"$path/$filename\",\"r\");
print fread($fp,filesize(\"$path/$filename\"));
fclose($fp);
exit();
}
// use a header redirect. You CANNOT add any HTML before this.
if ($go == 0)
{
header(\"Location: $redirectpage\");
}
?>