mineral_county_public_library_montana033008.gif
mineral_county_public_library_montana014027.gif
Mineral County, Montana
Phone: (406) 822.3563
A Really Warm and Wonderful Place to Visit
mineral_county_public_library_montana001043.jpg
Mineral County Public Library
CONTACT US
mineral_county_public_library_montana033007.jpg
DISCOVER BOX TEST PAGE
HOME |
DISCOVER IT BOX TEST
Mineral County
PUBLIC LIBRARY
301 2nd Ave East
Superior, MT 59872-0430
Library HOURS:
10:30 am - 6:00 pm
Monday | Tuesday | * Thursday | Friday
* CLOSED Wed., Sat. and Sun. & National Holidays
(406) 822-3563
mineral_county_public_library_montana033006.gif
CONTACT US
mineral_county_public_library_montana033005.gif
mineral_county_public_library_montana033004.jpg
mineral_county_public_library_montana033003.gif
CONTACT US
mineral_county_public_library_montana033002.gif
mineral_county_public_library_montana033001.jpg
<% 'on error resume next 'define a soft paragraph break dim par par = "
" ' Get the users IP address dim remoteAddr remoteAddr = Request.ServerVariables("REMOTE_ADDR") 'Response.Write "Remote (incoming) users IP address: " & remoteAddr & par ' We need to split the remote (incoming) user's IP address into a four-part array for further comparison operations dim remoteIPArray ' split the remote IP address into its parts remoteIPArray = Split(remoteAddr, ".") ' Variable to hold the first 2 octets of the remote IP address (network identifier) dim remoteNWID', machineIdentifier ' Build network identifier from first two quadrants of IP address remoteNWID = remoteIPArray(0) & "." & remoteIPArray(1) 'Response.Write "Remote Network ID: " & remoteNWID & par 'Response.Write "Remote Quadrant #3: " & remoteIPArray(2) & par 'Response.Write "Remote Quadrant #4: " & remoteIPArray(3) & par & par 'define the IP range(s) of the library (institution) dim IPRange, IPRange2 IPRange = "12.32.*.*" IPRange2 = "*.*.*.*" 'Response.Write "Library IP Range #1: " & IPRange & par 'Response.Write "Library IP Range #2: " & IPRange2 & par & par ' We need to split the library's IP address into a four-part array for further comparison operations dim recordIPArray, recordIPArray2 ' split the library's IP address into its parts recordIPArray = Split(IPRange, ".") recordIPArray2 = Split(IPRange2, ".") ' Variable to hold the first 2 quadrants of the library's IP address (network identifier) dim libraryNWID, libraryNWID2', machineIdentifier ' Build network identifier from first two quadrant of IP address libraryNWID = recordIPArray(0) & "." & recordIPArray(1) 'Response.Write "Library Network ID #1: " & libraryNWID & par 'Response.Write "Library Quadrant #1-3: " & recordIPArray(2) & par 'Response.Write "Library Quadrant #1-4: " & recordIPArray(3) & par & par ' Build network identifier from first two quadrant of IP address #2 libraryNWID2 = recordIPArray2(0) & "." & recordIPArray2(1) 'Response.Write "Library Network ID #2: " & libraryNWID2 & par 'Response.Write "Library Quadrant #2-3: " & recordIPArray2(2) & par 'Response.Write "Library Quadrant #2-4: " & recordIPArray2(3) & par & par ' test to determine if the Network ID's match dim NWmatch, findIPMatch if ((remoteNWID = libraryNWID) or (remoteNWID = libraryNWID2)) then NWmatch = true 'Response.Write "NW Identifier Match Found: " & NWmatch & par & par else NWmatch = false findIPMatch = false 'Response.Write "NW Identifier Match Found: " & NWmatch & par 'Response.Write "Full IP Match Found: " & findIPMatch & par & par end if 'test for a match on the third and fourth octets if NWmatch = True then ' Note: We don't care about the first two octets since a match has already been determined to exist dim thirdOctet, fourthOctet, thirdOctetResults, fourthOctetResults, thirdOctet2, fourthOctet2, thirdOctetResults2, fourthOctetResults2 ' Assign the third and fourth octets to variables thirdOctet = recordIPArray(2) fourthOctet = recordIPArray(3) thirdOctet2 = recordIPArray2(2) fourthOctet2 = recordIPArray2(3) ' compare the two third octets thirdOctetResults = compareOctets(thirdOctet, CInt(remoteIPArray(2)) ) thirdOctetResults2 = compareOctets(thirdOctet2, CInt(remoteIPArray(2)) ) 'Response.Write "Quadrant Comparison 1-3: " & thirdOctetResults & par 'Response.Write "Quadrant Comparison 2-3: " & thirdOctetResults2 & par & par if ((thirdOctetResults = true) or (thirdOctetResults2 = true)) then ' go ahead and test the fourth octet ' compare the two fourth octets. See if there is a match here since that will determine conclusively that there is a match fourthOctetResults = compareOctets(fourthOctet, CInt(remoteIPArray(3)) ) fourthOctetResults2 = compareOctets(fourthOctet2, CInt(remoteIPArray(3)) ) 'Response.Write "Quadrant Comparison 1-4: " & fourthOctetResults & par 'Response.Write "Quadrant Comparison 2-4: " & fourthOctetResults2 & par & par if ((fourthOctetResults = true) or (fourthOctetResults2 = true)) then findIPMatch = true 'Response.Write "Full IP Match Found: " & findIPMatch & par else findIPMatch = false 'Response.Write "Full IP Match Found: " & findIPMatch & par end if else findIPMatch = false 'Response.Write "Full IP Match Found: " & findIPMatch & par end if end if ' This function checks to see that a number is within a range of two other numeric values function checkWithinRange(rangeStr, number) ' By default, start with this as false. If there either test fails, this will be returned. checkWithinRange = false ' Split the octet dim rangeArray rangeArray = Split(rangeStr, "-") ' See if the remote octet is within range... ' Is the remote octet greater than or equal to the low end of the range? if number >= CInt(rangeArray(0)) then ' Is the remote octet less than or equal to the high end of the range? if number =< CInt(rangeArray(1)) then ' Both tests have passed, so return true checkWithinRange = true end if end if end function ' This function checks a value to see if it qualifies and returns a value of true or false ' octetDB may be a single numeric value, a range of numeric values (expressed as n1-n2) or an asterisk (* - implying 0-255) function compareOctets(octetDB, octetRemote) ' Start out assuming that compareOctets is false compareOctets = false 'Find out which type of octet we have 'Checks for range (either two values expressed n1-n2 or an asterisk dim checkForRange, checkForWildcard ' Is there a range of values? checkForRange = InStr(octetDB, "-") ' Is there an asterisk? checkForWildcard = InStr(octetDB, "*") ' Check to see if there is a range (either checkForRange or checkForWildcard will be greater than 0) ' If so, then test to see if the remote octet is within the range. Otherwise ' test to see if the octet matches a single integer (e.g. 129) if checkForRange > 0 then ' There is a range, so test to see if the value is in between compareOctets = checkWithinRange(octetDB, octetRemote) elseif checkForWildcard > 0 then ' There is a range, so test to see if the value is in between compareOctets = checkWithinRange("0-255", octetRemote) elseif CInt(octetDB) = CInt(octetRemote) then ' There is a match between the two octets compareOctets = true end if end function %> <% If findIpMatch = False Then %>

Discover It!

<% End If %> <% If findIpMatch = True Then %>

Discover It!

Advanced Search | About Link to External Site
IP Address
<% End If %>