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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Reverse ip lookup

Status
Not open for further replies.

andyUK

Programmer
Dec 19, 2000
39
GB
I am trying to write an ASP script to pick up a visitors IP address or host then trace it back to source. This is so I can record where my users are coming from and hopefully increase security on my site.
 
Isn't this stored in the Request object?

Chip H.
 
I can get the IP address but need to a reverse lookup on it to retrace where the ip address has come from ie the host isp or company
 
Is there no easier way, I can install any components on my host. Is there asolution where by I can post the information to a server somehere and get a result sent back to my asp page?
 
You might be able to post the IP address into the WHOIS texbox at the Network Solutions website, and parse the returned HTML to find out who owns it. But that seems like a lot of work to me.

Chip H.
 
<!--Cut &amp; paste code After database is in place. To test you will need to make sure that they referenced the page from a link. If they type in your URL then the content only will be displayed. It will take a bit more coding if you want to exclude referrers from your own site.-->

<!-- #include file = &quot;adovbs.inc&quot; -->
<html>
<head><title></title>

<!--Check if they are coming from another page. If so send them to the same page and include the url with a . at the end-->
<script>
function redirectPage() {
if (document.referrer) {
var test = document.referrer
var go= location+&quot;?from=&quot;+&quot;\&quot;&quot;+test+&quot;.&quot;+&quot;\&quot;&quot;
window.location.href= go;
}
}
</script>
<body onload=redirectPage()>

<!--If there is a . at the end of the url then right it to the database else do nothing-->

<%
Dim check
check = Right(Request(&quot;from&quot;),1)
If checkIll = &quot;.&quot; then
Dim from
from = TRIM( Request( &quot;from&quot; ) )


DIM Con
Set Con = Server.CreateObject(&quot;ADODB.Connection&quot;)
Con.provider=&quot;microsoft.jet.oledb.4.0&quot;
Con.open=server.mappath(&quot;\&quot;)&amp;&quot;db.mdb&quot;
Set RS = Server.CreateObject( &quot;ADODB.Recordset&quot; )
RS.ActiveConnection = Con
RS.CursorType = adOpenStatic
RS.LockType = adLockOptimistic


RS.Open &quot;SELECT * FROM table WHERE 1<>1&quot;, Con
RS.AddNew

RS( &quot;tablefield&quot; ) = from


RS.Close
Con.close
End If
%>
content here
</body>

</html>
 
one mistake there is a variable I name checkill do a search and replace with check

sorry about that
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top