Page 1 of 1

how to control my zip file with download? help, urgent!

Posted: Thu Sep 27, 2007 4:31 am
by hello3003
currently I have a big trouble with zip files on my site.

A trouble maker used software to download hundreds of copies of my zip files directly - he even does not need to view html/php pages, it causes "over use of shared server resource".

I think, if I block his IP address manually (not done so far), he may change his IP and come back again.
But I have to fix the problem.

I have no idea now, may I do as followings?

1) user must access to my web page first for downlod, he can not use software (i.e. c++) to download zip files directly even he knows address of the zip file.

or

2) change address of zip file

or other ways.

please help, give me idea and script/php code/samples, so I can fix the trouble soon.
(of cource, idea can be completed by code).


thank you.

Posted: Thu Sep 27, 2007 6:44 am
by paulbm
I have my zip file downloader page check $_SERVER['HTTP_REFERER'] and if it isn't from my domain it rejects the download request.

Something like this...

Code: Select all

if (!strstr($_SERVER['HTTP_REFERER'],"mydomain.co.uk"))
{
// jump to a page to deal with this leecher
	header("Location: external.php?ref=".$_SERVER['HTTP_REFERER']."&request=".$_GET['filename']);

}
else
{
// it's ok to offer the file...

	header("Location: $download_dir.$_GET['filename']);
}
This fails if people have REFERERs turned off though, but it will stop the leecher.

Posted: Thu Sep 27, 2007 7:14 am
by volka
You might be interested in captchas. http://en.wikipedia.org/wiki/Captcha