Page 1 of 1 1
Topic Options
#61262 - 2001-12-11 06:07 PM How to determine IPīs ??
Anonymous
Unregistered


Hi friends.
First, excuse my errors on these lines, but I donīt speak english very well...
I have a little doubt:
Exists a way to get the IP of a station ? After do this, is necessary to verify if that IP is inside of a sequence. With this information, Iīll direct the user to install or update Norton from a pre-determined server.
Example:

If IP: 10.198.0.5 is between 10.197.0.1 and 10.197.0.254 Server= Server1
If IP: 10.198.0.5 is between 10.198.0.1 and 10.198.0.254 Server= Server2

In advance, thanks.

Top
#61263 - 2001-12-11 06:13 PM Re: How to determine IPīs ??
Kdyer Offline
KiX Supporter
*****

Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
EcrtDrSpm,

Welcome to the board!

Look into the Macro - @IPADDRESS0...

Works pretty slick..

Thanks!

- Kent

_________________________
Utilize these resources:
UDFs (Full List)
KiXtart FAQ & How to's

Top
#61264 - 2001-12-11 06:46 PM Re: How to determine IPīs ??
Anonymous
Unregistered


Thanks Kdyer !
Ok, I found that function. My kix version is 3.63.
Do you think is possible to make something like (of course, iīll verify the right sintax later) this ?

Initial=10.197.0.1
Final=10.197.0.254

If (@IPADDRESS0 >=Initial)and(@IPADDRESS0 <=Final) then server=server 1

I looked the manual, but he hasnīt an example.
One more time, thanks.

Top
#61265 - 2001-12-11 07:10 PM Re: How to determine IPīs ??
Anonymous
Unregistered


Hummm.....
I used the search feature in this forum and found what I was looking for.
Many thanks,

Top
#61266 - 2001-12-11 07:14 PM Re: How to determine IPīs ??
Will Hetrick Offline
Hey THIS is FUN

Registered: 2001-10-02
Posts: 320
Loc: Harrisburg, PA USA
Welcome EcrtDrspm,
The first thing you must do is to get the IP address in useable form.
code:
  ; Builds the IP address in a usable format.
$IP1 = ltrim(SubStr(@IPADDRESS0, 1, 3))
$IP2 = LTRIM(SUBSTR(@IPADDRESS0, 5, 3))
$IP3 = LTRIM(SUBSTR(@IPADDRESS0, 9, 3))
$IP4 = LTRIM(SUBSTR(@IPADDRESS0, 13, 3))
; The trimmed IP address is rebuild of the four octets, again seperated by dots...
$MyIP=$IP1 + "." + $IP2 + "." + $IP3 + "." + $IP4


Next, once it is in this form, you can work with it.
code:
$SMSIPSeg = "164.156.951"
select
CASE $CurrentIPSeg = "164.157. 17"
$AVSWServer = "\\server\AVSW\Win95"
endselect

_________________________
You have at least 2 choices. Each choice changes your destiny. Choose wisely!

Top
#61267 - 2001-12-11 07:51 PM Re: How to determine IPīs ??
bleonard Offline
Seasoned Scripter
*****

Registered: 2001-01-19
Posts: 581
Loc: Chicago, IL
EcrtDrSpam -
Why not simply use:

code:

SELECT
CASE ((@IPADDRESS0) >= "10.197.0.1") AND ((@IPADDRESS0) <= "10.197.0.254") $Server=Server1
CASE ((@IPADDRESS0) >= "10.198.0.1") AND ((@IPADDRESS0) <= "10.198.0.254") $Server=Server2
CASE ((@IPADDRESS0) >= "10.199.0.1") AND ((@IPADDRESS0) <= "10.199.0.254") $Server=Server3
ENDSELECT

Bill

[ 11 December 2001: Message edited by: bleonard ]

Top
#61268 - 2001-12-13 04:04 AM Re: How to determine IPīs ??
MCA Offline
KiX Supporter
*****

Registered: 2000-04-28
Posts: 5152
Loc: Netherlands, EU
Dear,

An important issue is the format of macro @ipaddress0.
First we strip the first parts and verify it.

code:

$ip=@ipaddress0 ; format: 'xxx.xxx.xxx.xxx' f.e. ' 10.198. 0. 55'
SELECT
CASE (Substr("$ip",1,12) = " 10.197. 0.")
? "in range '10.197.0' server1"
CASE (Substr("$ip",1,12) = " 10.198. 0.")
? "in range '10.198.0' server2"
CASE 1
? "unknown IP "+$ip
ENDSELECT


greetings.
_________________________
email scripting@wanadoo.nl homepage scripting@wanadoo.nl | Links | Summary of Site Site KiXforms FAQ kixtart.org library collection mirror MCA | FAQ & UDF help file UDF kixtart.org library collection mirror MCA | mirror USA | mirror europe UDF scriptlogic library collection UDFs | mirror MCA

Top
#61269 - 2001-12-19 09:03 PM Re: How to determine IPīs ??
Anonymous
Unregistered


Thanks friends !
Excuse the long time to thank you, but I was out of my city.
With these tips and some examples that I got, my problem is solved.
Regards,

Top
Page 1 of 1 1


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

Who's Online
0 registered and 302 anonymous users online.
Newest Members
Sir_Barrington, batdk82, StuTheCoder, M_Moore, BeeEm
17886 Registered Users

Generated in 0.054 seconds in which 0.024 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