Owen
(Lurker)
2001-12-17 01:32 PM
IP Config

I use the following script to establish remote access users from lan users. I want to add to this so if the user has a public IP i.e not = 172.*.*.* then the script bypasses the follwoing command. Please see example.

I would be most grateful if anybody could assist me.

Thanks

Owen

;If a RAS user then exit here!!
IF @IPADDRESS0 = "172. 16. 1.210" or @IPADDRESS0 = "172. 16. 1.211" or @IPADDRESS0 = "172. 16. 1.212" or @IPADDRESS0 = "172. 16. 1.213"
? " You have dial up connection to the network"
? " You don't need to run the rest of the logon script."
? " going to exiting now... Goodbye!"
SLEEP 4 ;Pause for a very long affect
GOTO "END"
ENDIF

JochenAdministrator
(KiX Supporter)
2001-12-17 01:38 PM
Re: IP Config

dear,

another way to accomplish this task could be :

code:

if @ras
? " You have dial up connection to the network"
? " You don't need to run the rest of the logon script."
? " going to exiting now... Goodbye!"
SLEEP 4 ;Pause for a very long affect
quit
endif



[/code]


Owen
(Lurker)
2001-12-17 02:21 PM
Re: IP Config

I don't think this answers my question?

Owen
(Lurker)
2001-12-17 02:27 PM
Re: IP Config

I need to pickup the specific IP as my users are not registered as RAS users within the domain.

Thanks

Alex.H
(Seasoned Scripter)
2001-12-17 02:45 PM
Re: IP Config

Owen,
In this case, you could do this :
code:

$AddressToCheck="172. 16."
$IsPublic=0

; For Kix3.xx, replace "for $i= ... next" with "$i=0 while $i<4 ... $i=$i+1 loop
For $i=0 to 3
If left(execute("@@Ipconfig"+$i),len($AddressToCheck))=$AddressToCheck
$IsPublic=1
$i=3
endif
next

If $IsPublic=1
;Do your stuff
endif



Note that you can directly put the "If $ispublic=1" in the "For next" part
Also, this method is only working for a 255... or 255.255... subnet
For a real subnet check, Bryce has a function for Kix 4.xx floating here

[ 17 December 2001: Message edited by: Popovk ]

Owen
(Lurker)
2001-12-17 04:14 PM
Re: IP Config

Thanks I'll have a look and give it a go

MCA
(KiX Supporter)
2001-12-18 02:38 AM
Re: IP Config

Dear,

It isn't necessary to use a FOR/NEXT structure. For the same result you can
use an IF/ELSE/ENDIF structure.

code:

$check="172." ; format: 'xxx.xxx.xxx.xxx' f.e. '172. 16. 1.210' / '172.*.*.*'
IF (Substr(@ipaddress0,1,len($check)) = $check) OR
(Substr(@ipaddress1,1,len($check)) = $check) OR
(Substr(@ipaddress2,1,len($check)) = $check) OR
(Substr(@ipaddress3,1,len($check)) = $check)
? "skip script"
ELSE
? "run script"
ENDIF
EXIT


greetings.


bleonard
(Seasoned Scripter)
2001-12-18 11:22 PM
Re: IP Config

Lastly, you could use this:
IF (INSTR (SUBSTR (@IPADDRESS0, 1, LEN (@IPADDRESS0)), "172.") <> 0) AND (INSTR (SUBSTR (@IPADDRESS0, 1, LEN (@IPADDRESS0)), ".172.") = 0)
blah blah blah
ENDIF

Bill

Alex.H
(Seasoned Scripter)
2001-12-18 11:33 PM
Re: IP Config

I was playing with "For next" at this time, seems something was remain