Add to Favorites    Make Home Page 1687 Online  
 Language Categories  
 Our Services  

Home » ASP Home » Sessions Home » Check local/internet IP Address

A D V E R T I S E M E N T

Search Projects & Source Codes:

Title 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...
Category ASP » Sessions
Hits 365334
Code Select and Copy the Code
'************************************** ' 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>

Related Source Codes

Script Name Author
ııııııııııııııııııııı VyomWorld
Resistor color code reader A.Chermarajan.
Telephone Directory dhivya
card swapping game (Mini Project) nityanand
simple hangman-pascalsource Seabert
college dirtectory (Mini Project) msridhar
Poll Application John van Meter
ASP Daily Hit Counter. Tejaskumar Gandhi
To avoid null in asp environment using sql Sami
Maklumbalas webmaster
poll John van Meter
EasyASP Template Engine. TjoekBezoer
Basic Calculator using HTML & Javascript. Patrick M. D Souza
What servers support ASP ? VyomWorld
What is ASP? VyomWorld

A D V E R T I S E M E N T




Google Groups Subscribe to SourceCodesWorld - Techies Talk
Email:

Free eBook - Interview Questions: Get over 1,000 Interview Questions in an eBook for free when you join JobsAssist. Just click on the button below to join JobsAssist and you will immediately receive the Free eBook with thousands of Interview Questions in an ebook when you join.

New! Click here to Add your Code!


ASP Home | C Home | C++ Home | COBOL Home | Java Home | Pascal Home
Source Codes Home Page

 Advertisements  

Google Search

Google

Source Codes World.com is a part of Vyom Network.

Vyom Network : Web Hosting | Dedicated Server | Free SMS, GRE, GMAT, MBA | Online Exams | Freshers Jobs | Software Downloads | Interview Questions | Jobs, Discussions | Placement Papers | Free eBooks | Free eBooks | Free Business Info | Interview Questions | Free Tutorials | Arabic, French, German | IAS Preparation | Jokes, Songs, Fun | Free Classifieds | Free Recipes | Free Downloads | Bangalore Info | Tech Solutions | Project Outsourcing, Web Hosting | GATE Preparation | MBA Preparation | SAP Info | Software Testing | Google Logo Maker | Freshers Jobs

Sitemap | Privacy Policy | Terms and Conditions | Important Websites
Copyright ©2003-2024 SourceCodesWorld.com, All Rights Reserved.
Page URL: http://www.sourcecodesworld.com/source/show.asp?ScriptID=245


Download Yahoo Messenger | Placement Papers | Free SMS | C Interview Questions | C++ Interview Questions | Quick2Host Review