rejetto forum

Software => HFS ~ HTTP File Server => Topic started by: bobmanual on March 26, 2008, 08:57:49 PM

Title: limit downloads
Post by: bobmanual on March 26, 2008, 08:57:49 PM
Brilliant bit of software the only feature i really need now is "limit bandwidth/downloads/kb by user, by ip" any idea of the time scale when this will be implemented.

I am willing to make a generous paypal contribution when this feature is added.  ;)
Title: Re: limit downloads
Post by: Fysack on March 26, 2008, 10:00:32 PM
How big ?
Title: Re: limit downloads
Post by: bobmanual on March 26, 2008, 10:04:44 PM
$100 - $150 maybe more   :D
Title: Re: limit downloads
Post by: SilentPliz on March 26, 2008, 10:53:03 PM
Small player. :) You do not promised in euros or pounds sterling. ;)
Title: Re: limit downloads
Post by: Mars on March 26, 2008, 11:13:33 PM
yes Silentpliz, 100€ or 150€ is more confortable   ;D
Title: Re: limit downloads
Post by: Fysack on March 26, 2008, 11:33:51 PM
 ;D looking good, you should talk to the godfather  ;)
Title: Re: limit downloads
Post by: rejetto on March 28, 2008, 07:52:23 PM
describe with some details the feature you are waiting for
Title: Re: limit downloads
Post by: bobmanual on March 29, 2008, 02:37:29 AM
"limit bandwidth/downloads/kb by user, by ip" It is in the Todo list.

What i want to do is lets say User A comes to my site and downloads 3 manuals, he can then download no more for 24 hours he gest a simple message he has reached his maximum downloads as a free member for today.

It would also work if i could limit the bandwith per user.  :)

I am currently getting some users trying to download more than 43,000 files which is a pain as i get on average 630000 downloads per month, if i could limit them to say 3 manuals each per day it would really help.
Title: Re: limit downloads
Post by: MarkV on March 29, 2008, 04:02:47 AM
User quota or IP quota? Unfortunately you can get around IP quota with dynamic IP. For user quota you'd need accounts. Everything has it's pro's and con's.
Title: Re: limit downloads
Post by: bacter on March 29, 2008, 07:45:48 AM
bobmanual

Also your requested feature is in some way in the todo-list, it will be rather complex to implement it without accounts. So i think you should have to wait for HFS Version 4 ....

but

with the macro 'load' feature and a small external program you could use a workaround that may be usable for you. Steps that you would need:

1. A small program that continuously reads your logfile, selecting the registers that contain 'Fully downloaded'. With the information in this line, you could count the downloads or the volume of data downloaded between an elapsed time (24 hours, 3 days ...) and create a table by IP's or username.
You could even complete this table with a whitelist of users or ip's that would have no restrictions..
Save this table as a file, named for example accctrl.dat in a hidden folder.

2.A) Set in your template a variable like 'dl_ok' to 1 that means download allowed.
   B) Include in your template a section that loads the accctrl.dat file, search in this data for user or ip. If you find a match, compare if more download will be allowed or not and set dl_ok to 0 if not.
   C) Establish the way how to restrict access: If the user has exceeded his download rights, you can
        a) Display a different page instead of the filelist.
        or:
        b) modify the filelist section in your template so that the links '<a href....'  are only generated when download allowed: '{.if |dl_ok| .... .. . .  .}'

This is basically a way how you can do what you want.
However, to reduce the risk that a user uses a directlink to your file like 'http://yourdomain/files/manual.doc' instead of trying it using your page, you have to avoid that he can login, using the ip or a cookie with the username to check accesscontrol and avoid then the display of the 'login' button.
If that's not enough and somebody log's in using http://yourdomain/~login' you would have to ban him manually.
Title: Re: limit downloads
Post by: Fysack on March 31, 2008, 09:30:30 PM
wow! That is a nice workaround bacter..
Title: Re: limit downloads
Post by: rejetto on April 02, 2008, 03:23:59 AM
i will study the thing as i get the time and will let you know here.
you can click "notify" to get an email when a reply is posted to this topic.