rejetto forum
May 21, 2012, 07:10:58 AM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News: This forum is free, you do NOT need to register to post. But you may.
PROBLEMS? QUESTIONS? CLICK HERE!
Fill the survey!
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: Download limits  (Read 621 times)
0 Members and 2 Guests are viewing this topic.
FTNCmedia
Regular poster
**
Offline Offline

Afghanistan Afghanistan

Posts: 17


View Profile Email
« on: November 30, 2011, 03:05:35 AM »

Just wondering if someone has some code that would limit the number of downloads users can have in ...say a 24hr period? I am having issues with people "camping" on my site and taking up the available download slots I have allocated. They just download one after another. Thanks again for a kik-ass server!
Logged
rejetto
Administrator
Insane programmer
*
Offline Offline

Italy Italy

Posts: 11822


View Profile
« Reply #1 on: November 30, 2011, 03:34:58 AM »

just as a side comment, a script doing this is actually possible.
it would take a couple of event scripts (ALT+F6) similar to these

[every 24h]
set number of downloads (inside account notes) to 100

[download]
if (number of downloads in the account notes) < 0
  disconnect
else
  decrease it by 1
Logged
FTNCmedia
Regular poster
**
Offline Offline

Afghanistan Afghanistan

Posts: 17


View Profile Email
« Reply #2 on: November 30, 2011, 10:46:50 PM »

Thankx for replying...

I have a question about the download limits...i noticed you said "accounts" on the limits...can there be a command for "all ips"? I have a LAN with 450 users so not all of them have accounts. I use accounts for special privileges. thx
Logged
rejetto
Administrator
Insane programmer
*
Offline Offline

Italy Italy

Posts: 11822


View Profile
« Reply #3 on: December 01, 2011, 04:56:20 PM »

yes, it's possible.
something like

[download]
if now - limit_IP_time > 24h
  limit_IP_downloads = 100
else if limit_IP_downloads is zero
  disconnect
else
  decrease by 1


to access a variable like limit_IP_downloads you have to type {.set|#limit_%ip%_downloads | 100.}

so, the final result should be something like this (not tested)

[download]
{.if| {. {.sub| {.time|y.} | {.^#limit_%ip%_time.} /sub.} > 1 .}
  |{: {.set|#limit_%ip%_downloads | 100.} :}
  |{:
  {.if|{. {.^#limit_%ip%_downloads.} > 0 |{: {.dec|#limit_%ip%_downloads.}  :}
      |{: {.disconnection reason | downloading too much .} :}
  .}
:}
.}
  
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines Valid XHTML 1.0! Valid CSS!


Google visited last this page May 07, 2012, 03:17:43 PM