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

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
hello3003
Forum Newbie
Posts: 3
Joined: Thu Sep 27, 2007 4:10 am

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

Post 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.
paulbm
Forum Newbie
Posts: 5
Joined: Tue Sep 25, 2007 8:13 am

Post 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.
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

You might be interested in captchas. http://en.wikipedia.org/wiki/Captcha
Post Reply