rejetto forum

Download limits

0 Members and 1 Guest are viewing this topic.

Offline FTNCmedia

  • Occasional poster
  • *
    • Posts: 17
    • View Profile
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!


Offline rejetto

  • Administrator
  • Tireless poster
  • *****
    • Posts: 13510
    • View Profile
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


Offline FTNCmedia

  • Occasional poster
  • *
    • Posts: 17
    • View Profile
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


Offline rejetto

  • Administrator
  • Tireless poster
  • *****
    • Posts: 13510
    • View Profile
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 .} :}
  .}
:}
.}
  


Offline marribi

  • Occasional poster
  • *
    • Posts: 9
    • View Profile
Was looking for solution to restrict user to download, lets say more then 5Gb in 24h and found this old thread.
If anyone can help, how to change this code:

Code: [Select]
[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 .} :}
  .}
:}
.}

To account limit? Or where i can read what variables hfs can use ?
And last question where it should be ? i havent found in HFS gui some scripts section ?



Offline marribi

  • Occasional poster
  • *
    • Posts: 9
    • View Profile
Just tryed some simple thing:
Code: [Select]
[download]
{.if|{.%item-size-kb% > 4000000.}|Sorry, limit of 4Gb.}

But it seems its not working, i can download file of 5.3GB
May be i need to enable some option ?