Page 1 of 1 1
Topic Options
#61405 - 2001-12-17 01:32 PM IP Config
Owen Offline
Lurker

Registered: 2001-12-17
Posts: 4
Loc: London
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

Top
#61406 - 2001-12-17 01:38 PM Re: IP Config
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
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]
_________________________



Top
#61407 - 2001-12-17 02:21 PM Re: IP Config
Owen Offline
Lurker

Registered: 2001-12-17
Posts: 4
Loc: London
I don't think this answers my question?
Top
#61408 - 2001-12-17 02:27 PM Re: IP Config
Owen Offline
Lurker

Registered: 2001-12-17
Posts: 4
Loc: London
I need to pickup the specific IP as my users are not registered as RAS users within the domain.

Thanks

Top
#61409 - 2001-12-17 02:45 PM Re: IP Config
Alex.H Offline
Seasoned Scripter

Registered: 2001-04-10
Posts: 406
Loc: France
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 ]

_________________________
? getobject(Kixtart.org.Signature)

Top
#61410 - 2001-12-17 04:14 PM Re: IP Config
Owen Offline
Lurker

Registered: 2001-12-17
Posts: 4
Loc: London
Thanks I'll have a look and give it a go
Top
#61411 - 2001-12-18 02:38 AM Re: IP Config
MCA Offline
KiX Supporter
*****

Registered: 2000-04-28
Posts: 5152
Loc: Netherlands, EU
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.
_________________________
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
#61412 - 2001-12-18 11:22 PM Re: IP Config
bleonard Offline
Seasoned Scripter
*****

Registered: 2001-01-19
Posts: 581
Loc: Chicago, IL
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

Top
#61413 - 2001-12-18 11:33 PM Re: IP Config
Alex.H Offline
Seasoned Scripter

Registered: 2001-04-10
Posts: 406
Loc: France
I was playing with "For next" at this time, seems something was remain
_________________________
? getobject(Kixtart.org.Signature)

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 248 anonymous users online.
Newest Members
gespanntleuchten, DaveatAdvanced, Paulo_Alves, UsTaaa, xxJJxx
17864 Registered Users

Generated in 0.058 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