Hi,
well, I don't know much about php and tried to make a simple script but failed. I hope you can help me.
Please go to this site:
http://membres.lycos.fr/bickle/
The script I made shall do the following:
by clicking on the links you should be able to download the files (in this case images - the true URLs of the images should be hidden and the script should get the file size) if the referrer is correct otherwise you will be prompted with an error message and you will be redirected to the right site.
But my script doesn't work. Nothing works right and I don't know what's wrong with it.🙁 Can someone help me, please? Would be great. TIA.🙂
This is my script:
<?
$files=array('yaxeni_f.jpg', 'ART543dsk_main.jpg');
$filenames=array('yaxeni_f', 'ART543dsk_main');
$url= "images/";
$referer=ereg_replace( "\?.", "",$HTTP_REFERER);
if ($referer!= "http://membres.lycos.fr/bickle/") {
$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);
}
else {
print(" Sorry you have tried to link to a page which does not accept visitors directly. <br>
<a href=http://membres.lycos.fr/bickle/>CLICK HERE</a> to enter");
exit;
}
?>
Cheers,
Ned