Page 1 of 1 1
Topic Options
#137733 - 2005-04-12 01:28 PM @IPAddress Confusion
dave313 Offline
Fresh Scripter

Registered: 2002-04-16
Posts: 11
I am looking into using the @IPADDRESSx command in order to do a check for which address a client is coming from then do something.

What I want is for it to check the first 2 octet: the IP address is say 10.128.48.1, and I want to check for the 10.128 part, then do something via a IF statement

I have been searching here and seeing some uses of the @IPADDRESSx macro, but have been confused on how others are using it.

Can someone enlighten me?

Thanks!!

Top
#137734 - 2005-04-12 01:45 PM Re: @IPAddress Confusion
Dakota Offline
Fresh Scripter

Registered: 2004-02-03
Posts: 9
try this

Code:
 
IF @IPADDRESS0 >="172. 16. 4. 1" AND @IPADDRESS0 <= "172. 16. 4.254"
ENDIF



that will cover all ipadresses from 172.16.4.1 to 254
Spaces in adresses is required

\erik

Obs

Top
#137735 - 2005-04-12 02:19 PM Re: @IPAddress Confusion
dave313 Offline
Fresh Scripter

Registered: 2002-04-16
Posts: 11
Thanks for the code, but it doesnt seem to be working. Are there restrictions on the range? We are actually trying to do it for a 10.128.32/19 range. And it doesnt seem to pick off the IP correctly.

I did a capture of the @IPADDRESS0 value and ensured the formatting was correct for that range, but with the code provided it never seems to get it the way it wants to, so never does anything in the IF statment.

Top
#137736 - 2005-04-12 03:05 PM Re: @IPAddress Confusion
Richard H. Administrator Offline
Administrator
*****

Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
Look in the UDF forums for prebuilt IsInSubnet() type functions - there are quite a few.
Top
#137737 - 2005-04-12 04:23 PM Re: @IPAddress Confusion
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
There are FAQs and UDFs that cover this topic.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
Page 1 of 1 1


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 1077 anonymous users online.
Newest Members
ManuvdWielNL, Sir_Barrington, batdk82, StuTheCoder, M_Moore
17887 Registered Users

Generated in 0.051 seconds in which 0.028 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org