Bandwidth stealing block
Moderator: General Moderators
-
codewarrior
- Forum Commoner
- Posts: 81
- Joined: Wed Aug 07, 2002 1:28 pm
-
codewarrior
- Forum Commoner
- Posts: 81
- Joined: Wed Aug 07, 2002 1:28 pm
Does this make sense:
Can't figure out how to do that array thing. I need to get that array of sites to work, so when people come to the site, and dont put www. infront it will NOT block them also. 
Code: Select all
<?
$domain = "www.site.net";
//$domain = array("site.net","www.site.net","site.site.net");
$refr=getenv("HTTP_REFERER");
list($remove,$stuff)=split('//',$refr,2);
list($home,$stuff)=split('/',$stuff,2);
if($home!=$domain) {
header("Location: http://www.site.net/error.shtml");
} else {
$file = $pafiledb_sql->query($db, "SELECT * FROM $dbїprefix]_files WHERE file_id = '$id'", 1);
$time = time();
$update = $pafiledb_sql->query($db, "UPDATE $dbїprefix]_files SET file_dls=file_dls+1, file_last=$time WHERE file_id = '$id'", 0);
header("Location: $fileїfile_dlurl]");
}
?>Code: Select all
if(!in_array($refr,$domain)) {
error
} else {
pass
}you might wanna use HTTP_HOST instead of REFERER also.
another option would be something like
another option would be something like
Code: Select all
if(!eregi("domain.com",$refr)) {
error
} else {
pass
}- twigletmac
- Her Royal Site Adminness
- Posts: 5371
- Joined: Tue Apr 23, 2002 2:21 am
- Location: Essex, UK
From the PHP manual:
Mac
as Dusty pointed out maybe you should consider checking something else in case you inadvertently prevent people from accessing the content from your own site.'HTTP_REFERER'
The address of the page (if any) which referred the user agent to the current page. This is set by the user agent. Not all user agents will set this, and some provide the ability to modify HTTP_REFERER as a feature. In short, it cannot really be trusted.
Mac
-
codewarrior
- Forum Commoner
- Posts: 81
- Joined: Wed Aug 07, 2002 1:28 pm
-
codewarrior
- Forum Commoner
- Posts: 81
- Joined: Wed Aug 07, 2002 1:28 pm
-
codewarrior
- Forum Commoner
- Posts: 81
- Joined: Wed Aug 07, 2002 1:28 pm
-
codewarrior
- Forum Commoner
- Posts: 81
- Joined: Wed Aug 07, 2002 1:28 pm