My test machine :
KiXtart 2001 4.20
IP Address. . . . . . . . . . . . : 10.0.28.49
Subnet Mask . . . . . . . . . . . : 255.0.0.0
Default Gateway . . . . . . . . . : 10.16.64.1
Problem:
ERROR : array reference out of bounds!
Script: C:\WINNT\iptest3.KIX
Line : 102
code:
function ipmask($ipaddress1, $ipaddress2)
Dim $bit if instr($ipaddress1,'.') or instr($ipaddress2,'.') or len($ipaddress1)<>32 or
len($ipaddress2)<>32
exit 87
endif $ipmask=''
for $bit=1 to 32
$ipmask=$ipmask+(val(substr($ipaddress1,$bit,1)) & val(substr($ipaddress2,$bit,1)))
next
endfunction
function isiniprange($ipaddress,$iprangearray)
Dim $iprange, $networkid, $subnetmask, $bit
if $ipaddress=''
exit 87
endif
$ipaddress=binaryip($ipaddress)
for each $iprange in $iprangearray
if instr($iprange,'/')
$iprange=split($iprange,'/')
$networkid=binaryip($iprange[0])
if instr($iprange[1],'.')
$subnetmask=binaryip($iprange[1])
else
$subnetmask=''
for $bit=1 to val($iprange[1])
$subnetmask=$subnetmask+'1'
next
for $bit=(val($iprange[1])+1) to 32
$subnetmask=$subnetmask+'0'
next
endif
if isinsubnet($ipaddress,$networkid,$subnetmask)
$isiniprange=1
return
else
$isiniprange=0
endif
endif
next
endfunction
DIM $iparray[0]
DIM $iparray[1]
DIM $iparray[2]
$ipaddress=@IPADDRESS0
$iparray[0]='10.0.28.0/24'
$iparray[1]='10.0.40.0/24'
$iparray[2]='10.0.27.0/24
call "isiniprange.udf"
IF isiniprange($ipaddress,$iparray[0])
MessageBox ("Welcome to IRRI",0,35 )
ENDIF
:EXIT
Exit
Also Tried this Code:
$ipaddress=@IPADDRESS0
$iparray[0]='10.0.28.0/24'
$iparray[1]='10.0.28.0/255.255.255.0'
$iparray[2]='10.0.28.49/255.0.0.0'
IF isiniprange($ipaddress,$iparray)
MessageBox ("Welcome to IRRI",0,35 )
ENDIF
{edit}Bullock - Added CODE tags, But the code was not properly indented. Please edit your code use proper indentation to assist in the readablility of your code.
[ 26. March 2003, 12:58: Message edited by: Howard Bullock ]