123 Eng

Engineering the engineers™


Latest Jobs   Forum Map

 


Home

Source Codes

Engineering Colleges

BE Students

Training  Reports (updated)

Seminar Reports (updated

Placement Papers (updated)

Forums

   Computer Science / IT

   Electronics

   Electrical

   Mechanical

   Chemical

   Civil

   CAT / MBA

   GMAT / Foreign MBA

Latest Jobs

Engineering Jobs / Technical Jobs

Management Jobs

Sitemap

About-Us

Terms of use

Displaying  Source Code(s)  
 

 
Check local/internet IP Address

--------------------------------------------------------------------------------

Description : determine if the remote computer visitor is local or external of your site and according to the case, for exemple redirect the user to the correct page...

'**************************************
' Name: Determine if the remote computer
' has a local or internet IP address
' Description:It may be that one day you
' have to determine if the remote computer
' visitor is local or external of your sit
' e and according to the case, for exemple
' redirect the user to the correct page...
'
' Assumes:This range of addresses shows
' constant IP of a LAN and never a compute
' r will have this IP on internet.
10.0.0.0 -> 10.255.255.255
172.16.0.0 -> 172.31.0.0
192.168.0.0 -> 192.168.255.0
'
'This code is copyrighted and has ' limited warranties.Please see http://w
' ww.Planet-Source-Code.com/xq/ASP/txtCode
' Id.6887/lngWId.4/qx/vb/scripts/ShowCode.
' htm 'for details. '**************************************

<HTML>
<BODY>
<%
Dim ArrayIPLocalStart(2)
Dim ArrayIPLocalEnd(2)
Dim ArrayIPClient
Dim IPClient
Dim blnLocal
Ipclient = Request.ServerVariables("REMOTE_ADDR")
Response.Write "Your IP is " & ipclient & "<BR>"
blnLocal = False
' These IP address are constant IP of a
' LAN
ArrayIPLocalStart(0) = "010.000.000.000" '"10.0.0.0"
ArrayIPLocalEnd(0) = "010.255.255.255" '"10.255.255.255"
ArrayIPLocalStart(1) = "172.016.000.000" '"172.16.0.0"
ArrayIPLocalEnd(1) = "172.031.000.000" '"172.31.0.0"
ArrayIPLocalStart(2) = "192.168.000.000" '"192.168.0.0"
ArrayIPLocalEnd(2) = "192.168.255.000" '"192.168.255.0"
ArrayIPClient = Split(Ipclient,".")
' format the remote IP like constant LAN
' IP
For i = LBound(ArrayIPClient) To UBound(ArrayIPClient)
ArrayIPClient(i) = String(3-Len(ArrayIPClient(i) ),"0") & ArrayIPClient(i)
Next
IPClient = Join(ArrayIPClient,"")
If Trim(ipclient) <> "" Then
For i = LBound(ArrayIPLocalStart) To UBound(ArrayIPLocalStart)
ArrayIPLocalStart(i) = Replace(ArrayIPLocalStart(i),".","")
ArrayIPLocalEnd(i) = Replace(ArrayIPLocalEnd(i),".","")
If IPClient >= ArrayIPLocalStart(i) And IPClient =< ArrayIPLocalEnd(i) Then
blnLocal = True
Exit For
End If
Next
End If
If blnLocal Then
Response.Write " And your computer has a local IP"
Else
Response.Write " And your computer has a internet IP"
End If
%>
</BODY>
</HTML>


'**************************************
' Name: Determine if the remote computer
' has a local or internet IP address
' Description:It may be that one day you
' have to determine if the remote computer
' visitor is local or external of your sit
' e and according to the case, for exemple
' redirect the user to the correct page...
'
' By: Amz
'
' Assumes:This range of addresses shows
' constant IP of a LAN and never a compute
' r will have this IP on internet.
10.0.0.0 -> 10.255.255.255
172.16.0.0 -> 172.31.0.0
192.168.0.0 -> 192.168.255.0
'
'This code is copyrighted and has ' limited warranties.Please see http://w
' ww.Planet-Source-Code.com/xq/ASP/txtCode
' Id.6887/lngWId.4/qx/vb/scripts/ShowCode.
' htm 'for details. '**************************************

<HTML>
<BODY>
<%
Dim ArrayIPLocalStart(2)
Dim ArrayIPLocalEnd(2)
Dim ArrayIPClient
Dim IPClient
Dim blnLocal
Ipclient = Request.ServerVariables("REMOTE_ADDR")
Response.Write "Your IP is " & ipclient & "<BR>"
blnLocal = False
' These IP address are constant IP of a
' LAN
ArrayIPLocalStart(0) = "010.000.000.000" '"10.0.0.0"
ArrayIPLocalEnd(0) = "010.255.255.255" '"10.255.255.255"
ArrayIPLocalStart(1) = "172.016.000.000" '"172.16.0.0"
ArrayIPLocalEnd(1) = "172.031.000.000" '"172.31.0.0"
ArrayIPLocalStart(2) = "192.168.000.000" '"192.168.0.0"
ArrayIPLocalEnd(2) = "192.168.255.000" '"192.168.255.0"
ArrayIPClient = Split(Ipclient,".")
' format the remote IP like constant LAN
' IP
For i = LBound(ArrayIPClient) To UBound(ArrayIPClient)
ArrayIPClient(i) = String(3-Len(ArrayIPClient(i) ),"0") & ArrayIPClient(i)
Next
IPClient = Join(ArrayIPClient,"")
If Trim(ipclient) <> "" Then
For i = LBound(ArrayIPLocalStart) To UBound(ArrayIPLocalStart)
ArrayIPLocalStart(i) = Replace(ArrayIPLocalStart(i),".","")
ArrayIPLocalEnd(i) = Replace(ArrayIPLocalEnd(i),".","")
If IPClient >= ArrayIPLocalStart(i) And IPClient =< ArrayIPLocalEnd(i) Then
blnLocal = True
Exit For
End If
Next
End If
If blnLocal Then
Response.Write " And your computer has a local IP"
Else
Response.Write " And your computer has a internet IP"
End If
%>
</BODY>
</HTML>

 

Contribute content or training reports / feedback / Comments
job placement papers
All rights reserved © copyright 123ENG