<%
' IP convert function written by JHM 2004-07-29
' Function converts IP adress from dotted decimal notation to pure decimal notation.
' Ie the IP written in decimal dotted octet 172.20.1.1 can be written as 2886992129.
' This is useful for sorting ipadresses which otherwise sorts rather strange.
Function IPConvert(IPAddress)
Dim x,Pos,PrevPos,Num
If UBound(Split(IPAddress, ".")) = 3 Then
For x = 1 To 4
Pos = InStr(PrevPos + 1, IPAddress, ".", 1)
If x = 4 Then Pos = Len(IPAddress) + 1
Num = Int(Mid(IPAddress, PrevPos + 1, Pos - PrevPos - 1))
If Num > 255 Then
IPConvert = "0"
Exit Function
End If
PrevPos = Pos
IPConvert = ((Num Mod 256) * (256 ^ (4 - x))) + IPConvert
Next
else
Err.Raise 1, "IPconvert", "Bad octet in " & IPaddress
End If
End Function
%>