I use amember 3.1 to protect the subscription part of my website with username and password. I was wondering about the possibility of also using an IP address based subscription gateway to allow those coming from "subscribed" IP addresses to access the subscription based sections. I don't think amember can be used to manage this kind of subscription? For what I am thinking of it might be helpful if it did. However, since amember uses htaccess files and the same kind of files can be used to admit/bar visitors from designated IP addresses I was wondering whether the amember htaccess file(s) can be manually edited to admit certain IP addresses irrespective of whether they have subscribed through amember. I am thinking that such a system might possibly be appropriate for an "institution" rather than a "person" based subscription. If I go down this road I will either have to set up an identical set of files in a different directories or explore whether the amember htaccess file(s) can also be adapted/used for this purpose. Any thoughts/advice welcome. Andy
I'm assuming your users are using a static IP adress, otherwise managing this could be quite time consuming for those that get new IP addresses from a DHCP server all the time. In your "institution" situation, typically don't they have pools of IP addresses instead of just one? That being said, if it was just one, in theory you could make the IP address the username and update the login page to fetch the client IP and auto log them in if an account exists for that IP. Everything else would work as normal with aMember.
Andy, This is possible but as was mentined by skippybosco there will be issues if user have dynamic IP. This is possible to modify htaccess file inside protected folder and disable protection for specified IP addresses.
Thanks for replies. Yes, clearly this would not work for people with dynamic IP addresses so care would be needed to make sure this was only implemented if I was certain there was a static address involved. What is the code needed for modifying htaccess files within protected folders to disable protection for specified IP addresses? Is it a variation of order allow,deny allow from specified IP address deny from all Or is it something else? How should it be integrated into the existing amember htaccess file? Thanks for help - Andy
yes for htpasswd protection. For new rewrite protection new rewrite rules should be added that will stop all other rules when user come from specified IP.
Thanks Alexander. The amember protection on my site is new rewrite. Could you possibly let me know please what the code would be for adding rules "that will stop all other rules when user come from specified IP." Presumably it would be added at the very start of the htaccess file and then list the specified IP addresses, of which there could potentially be a few. Would adding this extra code to the htaccess file interfere in any way with administering the folder protection through the amember control panel? - or indeed with the normal operation of amember protection? Andy
Here is example of modified htaccess file: Note if you will reset protection from aMember CP -> Protect Folders this will overwrite your modifications in .htaccess so you will need to readd them.
Thank you. That is really helpful. Can I add as many ip addresses as I like in the section ## Allow access for these IP addresses:. RewriteCond %{REMOTE_ADDR} ^192\.168\.1\.4 [OR] RewriteCond %{REMOTE_ADDR} ^192\.168\.1\.2 RewriteRule ^(.*)$ - [L] Should each line apart from the last RewriteCond line end with [OR]? Finally - is there any chance of an upgrade to amember that would incorporate this facility? I may well add the extra code into my htaccess files sometime in the new year, but, if it was possible, it would be good to have an upgrade to amember that included this facility for subscriptions from static ip addresses - and with an easy upgrade from my current version 3.1! Again - thanks for help. Andy
Sure you can add moltiple lines here: Code: RewriteCond %{REMOTE_ADDR} ^192\.168\.1\.4 [OR] RewriteCond %{REMOTE_ADDR} ^192\.168\.2\.2 [OR] RewriteCond %{REMOTE_ADDR} ^192\.168\.3\.3 [OR] RewriteCond %{REMOTE_ADDR} ^192\.168\.4\.4 [OR] RewriteCond %{REMOTE_ADDR} ^192\.168\.1\.2 RewriteRule ^(.*)$ - [L] We didn't plan this but this can be available as a plugin.
Thanks - a plugin would be great. Any idea about possible timescale? Where on the amember website can customers find the plugins for amember? I can't immediately find the folder. Andy
Sorry can't provide timeframe for this . In regards to available plugins have a look: http://www.amember.com/integration.php
I've been experimenting a little further and I think I have discovered that with new rewrite protection it is a little complicated entering ranges of permitted addresses and wildcards. I think these have to be entered as regular expressions rather than simply something like "113-189". Any observations on this or help would be appreciated. For example:- Are there any helpful tools to generate the regular expressions for a given range? Is there a simply way of entering a wildcard equivalent? If a large number of complex wildcards and regular expression ranges are entered will it slow things down unacceptably? Andy
I have never heard of Ip address protection question. generally Captcha code or some questions are used for security purpose.
You can use fragments for ranges: PHP: RewriteCond %{REMOTE_ADDR} ^192\.168\. Will match any ip from 192.168.0.0 to 192.168.255.255 PHP: RewriteCond %{REMOTE_ADDR} ^192\.16[0-5] Will match any ip from 192.160.0.0 to 192.165.255.255 PHP: RewriteCond %{REMOTE_ADDR} ^192\.168\.([1-7]?[0-9]|8[0-3])\. Will match any ip from 192.168.0.x - 192.168.83.x : See: http://www.regular-expressions.info/tutorial.html Cheers Rob
This seems a useful site for generating the regex code needed for ip address ranges. http://utilitymill.com/utility/Regex_For_Range This one may do the same, but I'm not sure it is quite so good? http://www.google.com/support/googleanalytics/bin/answer.py?hl=en&answer=55572 This is a useful page which explains regex numeric ranges. http://www.regular-expressions.info/numericranges.html Andy
Interesting can this also implement using url referer? i mean the referer URL can download the file directly?