FRIHOSTFORUMSSEARCHFAQTOSBLOGSCOMPETITIONS
You are invited to Log in or Register a free Frihost Account!


5 minute download wait





Kurosaki-Ichigo
I have a site and i have about 1TB bandwidth. I host episodes on it. How can i stop people from downloading loads in one minute ?

What i thought was to put a wait system. Every person who tries to download something gets to download 1 thing per 5 minutes.

I think you have to write it so that it catches the persons ip.

And if they have download it and want to download again the message comes up that you have exceeded your download limit. Please wait 5 minutes and then click here. And theres a timer there. Also i want a part of the screen that counts down. Youve seen a lot FIle Hostings that do that. When you want to download you have to wait 15 seconds.

I really want it to be in one directory and it protects that directory.
Thnx.
Philip
you can using cookies, for write a time.
ex:

Code:
setcookie("timelastdownload", time("U"), time()+60*60*24*30*2);


after that for the checking 5 minute later

Code:
if (isset($_COOKIE["timelastdownload"]))
{
if ($_COOKIE["timelastdownload"]>=(time("U")-60*5))
{
echo "you need to wait 5 minute";
}else
{
echo "here the download files";
}
}
Kurosaki-Ichigo
I dont know any php. Can you tell me where to put these ?
kv
You can't have this protection available with direct downloads (direct link to files). You will have to have a script first which will allow user to download the files placed in protected directories. The url will be something like

http://<subdomain>.frihost.com/download.php?file=<somefile>

Then in download.php, you can check for time, read the file and send it to user.

Code:


<?

if (isset($_COOKIE["timelastdownload"]))
{
   if ($_COOKIE["timelastdownload"]>=(time("U")-60*5))
   {
      echo "you need to wait 5 minute";
   }
   else
   {
      $file=$_REQUEST['file'];
      $file_path="<protected dir>/$file";
      readfile($file_path);
                setcookie("timelastdownload", time("U"), time()+60*60*24*30*2);
   }
}

?>

 
snowboardalliance
kv wrote:
You can't have this protection available with direct downloads (direct link to files). You will have to have a script first which will allow user to download the files placed in protected directories. The url will be something like

http://<subdomain>.frihost.com/download.php?file=<somefile>

Then in download.php, you can check for time, read the file and send it to user.

Code:


<?

if (isset($_COOKIE["timelastdownload"]))
{
   if ($_COOKIE["timelastdownload"]>=(time("U")-60*5))
   {
      echo "you need to wait 5 minute";
   }
   else
   {
      $file=$_REQUEST['file'];
      $file_path="<protected dir>/$file";
      readfile($file_path);
                setcookie("timelastdownload", time("U"), time()+60*60*24*30*2);
   }
}

?>

 


You should probably do something a little more secure than cookies though, because people could "cheat" yor system by deleting cookies. Of course a log in system is a little much, but maybe some ip logging that uses mysql and the users IP in combination with cookies? Not sure but you probably want some kind of better system.
Rhysige
The system is cheatable yes but you could log their IP on the server if you want and do it that way... just depends how secure it must be.
Kurosaki-Ichigo
My server does give me access to HTAcces stuff. And i can protect directories. I have this portal that uses PHPBB to turn the site into a login\register function. I make a page and put the links in it. Now how exactly can i edit this file so that it has this system? I know nothing about PHP. Just tell me what to do exactly.
snowboardalliance
With phpBB, you can use the login system, and you would make a download.php page. Each user would have to a have new field in mySQL with the last download time. Then it's basically what was posted before. I don't have time to write anything but check out phpbb.com, they have a tutorial on integrating with phpBB so you could make this new page. I'm sure someone else could give you the code for all this.
Philip
Kurosaki-Ichigo wrote:
My server does give me access to HTAcces stuff. And i can protect directories. I have this portal that uses PHPBB to turn the site into a login\register function. I make a page and put the links in it. Now how exactly can i edit this file so that it has this system? I know nothing about PHP. Just tell me what to do exactly.


since u don't know any thing about php then, i suggest u browse and seek on www.hotscripts.com or u can hiring someone for do it for you. *with some frih i think.*
Kurosaki-Ichigo
The problem is that the files arent on the website im using right now. Its on a different server. What do i do now ?
Related topics
How does it look
Drinking Age
gzip download
Xcomic
Upload Siteleri ve Tanýtýmlarý...
::Creating Custom Ranks::Nice Quality And The Best::
Dzial ogloszen
Backups
A question for all you monotheists.
Best dog breed?
maya 8.5
A Computer Virus on Linux (informed discussions only please)
How do you make a multi-page website?
More than a friend? Confess him my feelings or hold back?
Reply to topic    Frihost Forum Index -> Scripting -> Php and MySQL

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.