i have a password protected directory with hundreds of users in htpasswd file.
i want to allow download of files on these conditions:
- check if username is valid (already done).
- check if another connection with the same username exists. (the are modules to check connection from same ip exists but i have not found any based on username)
- if 2 is correct check if both connections come from the same IP.
in other words how to limit each user to download from only 1 ip simultaneously?
i've seen hundreds of articles and questions about how to limit number of Connections based on IP. but none based on User. to clarify by a User i am referring to a valid-user in htpasswd file.
an example : lets say i have a htpasswd with the following users:
simon:$apr1$oL5flt.H$ayy6GOm0TblhH3lJXqf9o0
john:$apr1$JLGdTKlz$72ImnSlauIsCRV4lkrqE3/
and i've added require valid-user to htaccess.
johnconnects to get file.zip from192.168.2.8with 1 connection. (allow)johnmakes another 31 connections to a total of 32 (or any number really) from192.168.2.8.(allow)[because ip matches already active connections]johnconnects from192.168.2.9to get any file before closing previus connections .(deny)[because active connections have different ip]simonconnects from192.168.2.8(same ip as active connections) , (allow)[no other connections from simon]johnfrom192.168.2.8finishes downloadingfile.zipjohnfrom192.168.2.9wants to download a file (allow).
thanks in advance.