Hi, I'm looking for a quick way to redirect users from certain IP addreses as in the example below. Notice the wildcard (*). Thanks in advance for your help. <dtml-if "REMOTE_ADDR == '255.255.2255.*'"> <dtml-var "RESPONSE.redirect('/redirect_html')"> </dtml-if> Tom
Hi Tom, This is a little lame because it makes the assumption that you always want to match against a class C network, but as a Python Script: import string request = container.REQUEST RESPONSE = request.RESPONSE try: o1,o2,o3,o4=string.split(context.REQUEST['REMOTE_ADDR'], '.', 3) if [o1,o2,o3] == ['127','0','0']: RESPONSE.redirect('/redirect.html') except: pass HTH, - C Tom Scheidt wrote:
Hi,
I'm looking for a quick way to redirect users from certain IP addreses as in the example below. Notice the wildcard (*). Thanks in advance for your help.
<dtml-if "REMOTE_ADDR == '255.255.2255.*'"> <dtml-var "RESPONSE.redirect('/redirect_html')"> </dtml-if>
Tom
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
-- Chris McDonough Zope Corporation http://www.zope.org http://www.zope.com "Killing hundreds of birds with thousands of stones"
On Tue, 19 Feb 2002, Tom Scheidt wrote:
<dtml-if "REMOTE_ADDR == '255.255.2255.*'"> <dtml-var "RESPONSE.redirect('/redirect_html')"> </dtml-if>
How 'bout <dtml-if expr="REMOTE_ADDR[:12] == '255.255.255.'"> etc. -Tim -- Tim Wilson | Visit Sibley online: | Check out: Henry Sibley HS | http://www.isd197.org | http://www.zope.com W. St. Paul, MN | | http://slashdot.org wilson@visi.com | <dtml-var pithy_quote> | http://linux.com
participants (3)
-
Chris McDonough -
Tim Wilson -
Tom Scheidt