Page 2 of 2

Posted: Wed Sep 11, 2002 4:11 pm
by codewarrior
Thanks! I can work on rest of it ;)

Posted: Thu Sep 12, 2002 12:33 pm
by codewarrior
Does this make sense:

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]");

}
?>
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. :?

Posted: Thu Sep 12, 2002 1:19 pm
by dusty

Code: Select all

if(!in_array($refr,$domain)) {
  error
} else {
  pass
}
i'm just guessing that's what you meant by using the domain array.

Posted: Thu Sep 12, 2002 1:24 pm
by dusty
you might wanna use HTTP_HOST instead of REFERER also.

another option would be something like

Code: Select all

if(!eregi("domain.com",$refr)) {
  error
} else {
  pass
}

Posted: Fri Sep 13, 2002 1:53 am
by twigletmac
From the PHP manual:
'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.
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.

Mac

Posted: Fri Sep 13, 2002 12:17 pm
by codewarrior
Yeah I know what you mean ... Isn't there some other way of blocking?

Posted: Fri Sep 13, 2002 4:26 pm
by Takuma
I guess you just have to trust the user...

Posted: Sat Sep 14, 2002 2:03 am
by codewarrior
I trust the users all the time ... but its the freaking bandwidth thieves that drive me nuts!!!!!!!!!! :lol:

Posted: Sat Sep 14, 2002 11:24 pm
by EricS
If you running on a *nix server, you can modify the .htaccess file to keep out bandwidth thieves. Don't remember the exact modification needed but a quick search should reveal the answer.

Hope this helps.

Posted: Sun Sep 15, 2002 3:06 am
by Takuma
codewarrior wrote:I trust the users all the time ... but its the freaking bandwidth thieves that drive me nuts!!!!!!!!!! :lol:
That means you not trusting them, cos bandwidth thieves are part of user :o

Posted: Sun Sep 15, 2002 3:15 pm
by codewarrior
EricS wrote:If you running on a *nix server, you can modify the .htaccess file to keep out bandwidth thieves. Don't remember the exact modification needed but a quick search should reveal the answer.

Hope this helps.
Ok thanks ;)

Posted: Sun Sep 15, 2002 3:16 pm
by codewarrior
Takuma wrote:
codewarrior wrote:I trust the users all the time ... but its the freaking bandwidth thieves that drive me nuts!!!!!!!!!! :lol:
That means you not trusting them, cos bandwidth thieves are part of user :o
:lol: Well, I trust that till they break the rule and then :twisted: