URL file-access

software development

#1

i took my site down for a while, while i was revising for my exams, now im trying to update i cannot get any antileech scripts to work as i keep getting the message

URL file-access is disabled in the server configuration

does any1 know any antileech scripts that u may use or any i wont have the problem with? thanks

antileech for files not images


#2

allow_url_open is disabled


#3

so how could i get round this, because i wud like to ensure my files are not hotlinked (leeched)


#4

Access your files directly instead of through the URL?

ie: www.domain.com/file
use: /home/user/domain.com/file

That’ll work.

allow_url_fopen is for accessing files on another server. It should never be used for access files within your current site.


#5

this is the file im using


<?php
/*

FM AntiLeech Script
Cost: free
Version 1.0.0
Author: Richard Hunt admin@finditmax.com
Created: Jan 10,2004
Web Site: http://www.finditmax.com
Please leave my links intact
I would be greatfull for a link back to my site,
if you use this script - to repay my work.
This program now falls under the GPL License
GPL License details included

*/
//your domain, no http://
$domain=“www.exetic.com”;

//folder that the hidden Downloads files are in, no lead or trailing slashes
$folder=“3gp”;

$filename=stripslashes(urldecode($QUERY_STRING));
if ($filename==""){readfile(“http://www.exetic.com/invalidfile.html”);exit;}
$refr=getenv(“HTTP_REFERER”);
list($remove,$stuff)=split(’//’,$refr,2);
list($home,$stuff)=split(’/’,$stuff,2);
if ($home!=$domain){readfile(“http://www.exetic.com/leecher.html”);exit;
}else{
$fp=@fopen(“http://”.$domain."/".$folder."/".$filename,“r”);
if($fp)
{
if (ereg(".mp3",$filename)){$xtype=“audio/mpeg”;}
elseif(ereg(".zip",$filename)){$xtype=“application/x-zip-compressed”;}
elseif(ereg(".exe",$filename)){$xtype=“application/x-msdownload”;}
else{$xtype=“application/octet-stream”;}
Header(“Content-Type: $xtype”);
Header(“Accept-Ranges: bytes”);
Header(“Content-Disposition: ; attachment; Filename=$filename”);
while (!feof($fp)) {
echo(fgets($fp, 4096));
} //end while
fclose ($fp);
}else{
readfile(“http://www.exetic.com/filenotfound.html”)
;exit;
}
}
?>

then linking the files via /download/3gp.php?filename.exension

but i keep getting that url error now, so how can i mod that free script as im not good with php


#6

I’m not the expert here, but it seems to me a fix for your problem is simply to refer the the anti-leech related files by path, not by url.

For example, where your script says:

{readfile(“http://www.exetic.com/invalidfile.html”);exit;}

why dont you try:

{readfile("/home/username/public_html/invalidfile.html");exit;}

assuming your “exetic.com” site is hosted at the “base” of your dreamhost account, or

{readfile("/home/username/exetic.com/invalidfile.html");exit;}

if set-up that way.

In other words, use the path, not the url. You will need to repeat the process for the other referenced files (leecher.html, filenotfound.html, etc.) but I believe that should fix it.

Good Luck,
rlparker


#7

what rlparker said.

Change http://www.exetic.com/invalidfile.html to the base path of the file, something like /home/user/exetic.com/invalidfile.html

And it’ll work once again.


#8

The image leeching script you have isn’t necessary, anyway. Why not use one of the many .htaccess options out there instead? I wrote about several of them on this page of the wiki.


Simon Jessey
Keystone Websites | si-blog


#9

It’s not image leaching, but true. You can use the same methogoloy for files, too.


#10

i changed the url to the server path, and that worked fine

but it keeps saying file not found

$domain=“www.exetic.com”;

so i changed that link ^^ to the server path, but then it keeps saying files being leeched

so how can i get atileech for files in .htaccess do i just say add zip | rar etc to where gif is?


#11

Yes. There is no reason why the rewrite rules cannot be adapted to suit any file (although that means you should not use the versions that serve alternative images, obviously).


Simon Jessey
Keystone Websites | si-blog


#12

The block matches against a directory or file extensions. Just add in your other file extensions. It doesn’t make any different to Apache.