Re: Hideif on IP range
This WebDNA talk-list message is from 2004
It keeps the original formatting.
numero = 59334
interpreted = N
texte = If you have WebDNA 5 or greater, you can do this:[function name=IPOutsideRange][if ("[ipaddress]"<"[:local:from]") | ("[ipaddress]">"[:local:to]")][then][return]1=1[/return][/then][else][return]1=0[/return][/else][/if][/function][if ([IPOutsideRange from=194.158.032.000&to=194.158.063.255]) & ([IPOutsideRange from=194.199.032.000&to=194.202.063.255]) & ([IPOutsideRange from=198.158.032.000&to=198.158.063.255])][then]GOOD INFO[/then][else]BAD INFO[/else][/if]- Brian-- Brian Fries, BrainScan Software -- http://www.brainscansoftware.com --On Sep 9, 2004, at 9:35 AM, Paul Berman wrote:> Hi>> THanks for this, looking at the ranges we have to block there are 10 > ranges> at the moment>> I prsume this will work but just looks a bit untidy although the dont > show> stuff bit is Page Not Found so not too bulky>> Is there a better way of doing this?>> THanks again> paul> ----- Original Message -----> From: "Brian Fries"
> To: "WebDNA Talk" > Sent: Thursday, September 09, 2004 6:28 PM> Subject: Re: Hideif on IP range>>>> This is actually the reason that WebDNA pads its IP addresses with>> zeros - so that text comparisons are valid. But, you need to pad the>> specified values with zeroes as well. Also, the "if" from the previous>> post wouldn't block the end values of the range, only the values in>> between. One way to correct this would be:>>>> [if ("[ipaddress]"<"194.158.032.000) |>> ("[ipaddress]">"194.158.063.255")][then]>> show stuff>> [/then][else]>> don't show stuff>> [/else][/if]>>>> You can nest the ifs to add another range...>>>> [if (outside of range 1)][then]>> [if (outside of range 2)][then]>> show stuff>> [/then][else]>> don't show stuff>> [/else][/if]>> [/then][else]>> don't show stuff>> [/else][/if]>>>> If you get beyond a few levels of nesting, I'd go with a different>> scheme - probably using a [function] to test my ranges.>>>> - brian>>>> On Sep 9, 2004, at 8:54 AM, Rob Marquardt wrote:>>>>> on 9/9/2004 7:38 am, Paul Berman at paul@ast.jagrove.com so noted...>>>>>>> Works very well, to add another range to this do I nest the [If's}>>>>>>>> Many thnaks>>>> Paul>>>> ----- Original Message ----->>>> From: "Tim Robinson" >>>> To: "WebDNA Talk" >>>> Sent: Thursday, September 09, 2004 2:12 PM>>>> Subject: Re: Hideif on IP range>>>>>>>>>>>> [If ("[ipaddress]">"194.158.32.0")&("[ipaddress]"<"194.158.63.255"]>>>> [Then]Don't show stuff[/Then]>>>> [Else]Show stuff[/Else]>>>> [/If]>>>>>> I don't see how this would possibly work, since WebDNA pads IP>>> addresses>>> with zeros, and even if it didn't you're doing numeric comparisons on>>> strings.>>>>>> Something like this would be required:>>>>>> [listwords words=[ipaddress]&delimiters=.][!]>>> [/!][math show=f]block[index]=[word][/math][!]>>> [/!][/listwords]>>>>>>>>> [If ("[block1].[block2]"="194.158")&([block3]>31)&([block3]<64)]>>> [Then]Don't show stuff[/Then]>>> [Else]Show stuff[/Else]>>> [/If]>>>-------------------------------------------------------------This message is sent to you because you are subscribed to the mailing list .To unsubscribe, E-mail to: To switch to the DIGEST mode, E-mail to Web Archive of this list is at: http://webdna.smithmicro.com/
Associated Messages, from the most recent to the oldest:
If you have WebDNA 5 or greater, you can do this:[function name=IPOutsideRange][if ("[ipaddress]"<"[:local:from]") | ("[ipaddress]">"[:local:to]")][then][return]1=1[/return][/then][else][return]1=0[/return][/else][/if][/function][if ([IPOutsideRange from=194.158.032.000&to=194.158.063.255]) & ([IPOutsideRange from=194.199.032.000&to=194.202.063.255]) & ([IPOutsideRange from=198.158.032.000&to=198.158.063.255])][then]GOOD INFO[/then][else]BAD INFO[/else][/if]- Brian-- Brian Fries, BrainScan Software -- http://www.brainscansoftware.com --On Sep 9, 2004, at 9:35 AM, Paul Berman wrote:> Hi>> THanks for this, looking at the ranges we have to block there are 10 > ranges> at the moment>> I prsume this will work but just looks a bit untidy although the dont > show> stuff bit is Page Not Found so not too bulky>> Is there a better way of doing this?>> THanks again> paul> ----- Original Message -----> From: "Brian Fries" > To: "WebDNA Talk" > Sent: Thursday, September 09, 2004 6:28 PM> Subject: Re: Hideif on IP range>>>> This is actually the reason that WebDNA pads its IP addresses with>> zeros - so that text comparisons are valid. But, you need to pad the>> specified values with zeroes as well. Also, the "if" from the previous>> post wouldn't block the end values of the range, only the values in>> between. One way to correct this would be:>>>> [if ("[ipaddress]"<"194.158.032.000) |>> ("[ipaddress]">"194.158.063.255")][then]>> show stuff>> [/then][else]>> don't show stuff>> [/else][/if]>>>> You can nest the ifs to add another range...>>>> [if (outside of range 1)][then]>> [if (outside of range 2)][then]>> show stuff>> [/then][else]>> don't show stuff>> [/else][/if]>> [/then][else]>> don't show stuff>> [/else][/if]>>>> If you get beyond a few levels of nesting, I'd go with a different>> scheme - probably using a [function] to test my ranges.>>>> - brian>>>> On Sep 9, 2004, at 8:54 AM, Rob Marquardt wrote:>>>>> on 9/9/2004 7:38 am, Paul Berman at paul@ast.jagrove.com so noted...>>>>>>> Works very well, to add another range to this do I nest the [If's}>>>>>>>> Many thnaks>>>> Paul>>>> ----- Original Message ----->>>> From: "Tim Robinson" >>>> To: "WebDNA Talk" >>>> Sent: Thursday, September 09, 2004 2:12 PM>>>> Subject: Re: Hideif on IP range>>>>>>>>>>>> [If ("[ipaddress]">"194.158.32.0")&("[ipaddress]"<"194.158.63.255"]>>>> [Then]Don't show stuff[/Then]>>>> [Else]Show stuff[/Else]>>>> [/If]>>>>>> I don't see how this would possibly work, since WebDNA pads IP>>> addresses>>> with zeros, and even if it didn't you're doing numeric comparisons on>>> strings.>>>>>> Something like this would be required:>>>>>> [listwords words=[ipaddress]&delimiters=.][!]>>> [/!][math show=f]block[index]=[word][/math][!]>>> [/!][/listwords]>>>>>>>>> [If ("[block1].[block2]"="194.158")&([block3]>31)&([block3]<64)]>>> [Then]Don't show stuff[/Then]>>> [Else]Show stuff[/Else]>>> [/If]>>>-------------------------------------------------------------This message is sent to you because you are subscribed to the mailing list .To unsubscribe, E-mail to: To switch to the DIGEST mode, E-mail to Web Archive of this list is at: http://webdna.smithmicro.com/
Brian Fries
DOWNLOAD WEBDNA NOW!
Top Articles:
Talk List
The WebDNA community talk-list is the best place to get some help: several hundred extremely proficient programmers with an excellent knowledge of WebDNA and an excellent spirit will deliver all the tips and tricks you can imagine...
Related Readings:
Multiple prices (1997)
Java in [object] context requires MRJ 2.2 MacOS (2000)
[OT] FTP client (2003)
Where's Cart Created ? (1997)
Search 1 Field Twice? (2004)
Single Link browsing (1997)
Problem (1997)
Problems with [Applescript] (1997)
[index] (1997)
Nested tags count question (1997)
WebDNA for Dummies (was: WebDNA portability) (2007)
Setting up WebCatalog with Retail Pro data (1996)
Pithy questions on webcommerce & siteedit (1997)
multiple credit card merchant accounts/processors (1997)
How do I handle extra spaces? (2002)
Some Advise needed (1997)
FAX orders (1996)
[replaceChars] would be nice ... (1997)
Aquick question about replace (1999)
Calculating multiple shipping... (1997)