Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using IP range to determine navigation

Status
Not open for further replies.

kwilliams

Programmer
Sep 3, 1998
3
US
I want to use an ASP page to do a couple of things.

I know how to get the user's IP using server variables, but I don't know how to compare it to a range of IP's For example, if the user's IP address is not 123.123.xxx.xxx or between 123.123.000.000 and 123.123.999.999.

Secondly, once I have determined whether the user is within my network or from outside, I need to change the navigation they get. I would like to substitute the navigation buttons in my left hand frame to coincide with the type of users. Networked users get nav button page A and non-networked users get nav button page b.

Can anyone help me with the syntax/procedure?

Thanks alot.
 
Code:
myXIP = ExpandIP(myIP)
userXIP = Expand(userIP)

Function ExpandIP(strIP)
    Dim aryIP
    aryIP = spilt(strIP,".")
    If not Isarray(aryIP) then Redim aryIP(3)
    If Ubound(aryIP) < Lbound(aryIP) then redim aryIP(3)
    IF Ubound(aryIP) < 3 then Redim Preserve aryIP(3)
    ExpandIP = Right(&quot;000&quot; & aryIP(0),3) & &quot;.&quot; & _
               Right(&quot;000&quot; & aryIP(1),3) & &quot;.&quot; & _
               Right(&quot;000&quot; & aryIP(2),3) & &quot;.&quot; & _
               Right(&quot;000&quot; & aryIP(3),3)
End Function
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top