0

i wrote a simple script in php which handles the users and their access to the content. the last thing i want to do is to write a module to dynamically limit the download speed and maximum number of connections for each group of users when they attempt to access the files on server. something like this:

Usergroup0: [max conn num: 2] [max connection speed: 256kb/sec]
Usergroup1: [max conn num: 4] [max connection speed: 1mbit/sec]
Usergroup2: [max conn num: 8] [max connection speed: 1mbit/sec]

right now i have no clue how it's done.. i want to know what technique (or module) is it so i can look it up. any hint or guidance would be great.

Nojan A.
  • 881
  • 1
  • 11
  • 27

1 Answers1

1

I have never heard of such a thing myself. This should help with the limiting download speed How to limit speed of outgoing response from php script?

For limiting the number of connections (I assume you mean simultaneous connections), you could just associate a "connected" status with the currently logged in user in the database and run a script to check whether or not the maximum number of users the group which the current user is a member of has been breached.

Edit: Regarding limiting download speed, from the SO article, this was a good resource http://redmine.lighttpd.net/projects/lighttpd/wiki/Docs%3aTrafficShaping#Selective-traffic-shaping-plugin15-svn

Community
  • 1
  • 1
user1477388
  • 20,790
  • 32
  • 144
  • 264
  • thx. but this isn't exactly the case. because files are not going to be generated through php. so when an ip request to receive a file, the webserver should integrate with php and then database in order to determine the number of simultenous connections and download speed. – Nojan A. Aug 07 '12 at 19:46
  • 1
    How do you expect to determine whether or not a user is able to access a file without using a script of some sort? You would have to have a URL like this www.mywebsite.com/files.php?id=1, then you would determine whether the user has access to that file, determine the speed at which they are allowed to download, and determine how many connections are online and whether a new connection is permitted to be established. I don't know of any systems like this that provide direct file access, it has to go through a script. – user1477388 Aug 07 '12 at 19:57
  • ok. what you're saying completely makes sense. but i'm asking because i heard of something like dynamic htaccess. – Nojan A. Aug 07 '12 at 20:04
  • 1
    I don't have experience with that but you can post a new question on it. I think going the script route would be better and it is definitely more common (think about how yahoo mail works with email attachments). They don't provide direct file access, instead they link you to a proxy script. – user1477388 Aug 07 '12 at 20:13