|
-
Apr 11th, 2002, 04:37 PM
#1
Thread Starter
Fanatic Member
distinguish hits from various domains
is there a way to tell where our viewers are coming from?
i know we can trap IP's and stuff but how do i determine if they are coming from say .edu or .com or .net?
if that doesn't make sense, please tell me and i'll try and re-word it.
thank you
-
Apr 12th, 2002, 02:00 AM
#2
Code:
<html>
<head>
<title>Resolve IP</title>
</head>
<body>
<p>Hello freak of nature, connected from <%
set bh = Server.CreateObject("cyScape.browserObj")
hostname = bh.ResolveIP
if hostname <> "" then
response.write hostname
else
response.write "Unknown Dumbass"
end if
%> </p>
<p>%></p>
</body>
</html>
-
Apr 12th, 2002, 10:33 AM
#3
Thread Starter
Fanatic Member
that's great.
is there a way to do it w/ out browserhawk?

Thanks!
-
Apr 12th, 2002, 02:10 PM
#4
Originally posted by pnj
that's great.
is there a way to do it w/ out browserhawk?

Thanks!
OK... I'm going to sound like an idiot here.
Browserhawk???
Did I miss something?
-
Apr 12th, 2002, 03:01 PM
#5
Thread Starter
Fanatic Member
if me.retarted=true then
kick me in the shins
end if
msgbox "My shins hurt!"
well, were did you get the object cyScape?
i have used a component called browserhawk before and it is made by a company called cyScape.
when i tried to run your code i got a Server.CreateObject Failed
message.
(rubbing my shins....in pain...)
-
Apr 13th, 2002, 02:55 AM
#6
WHOOPS!! yup my fault actually. You can kick me
Yes... As such, I don't think it's possible to simply get the domain name by looking at an IP address.
You'll have to get a component or tool for this.
see here:
http://www.aspobjects.com/ASP_Components/network/dns/
-
Apr 13th, 2002, 10:50 AM
#7
Thread Starter
Fanatic Member
I suppose one could write a component that calls nslookup.
you could pass the component the IP and it would call nslookup, get the domain and pass it back.
i have no idea how to call nslookup from a component though.
but in theory it sounds easy eh?
-
Apr 14th, 2002, 12:41 PM
#8
Hyperactive Member
hi,
this is a terrible suggestion..
whenever I need to do something quick (and dirty) - rather than dig out the relvent object/api, i often resort to just shelling a prompt (call shell.....).
As nslookup takes a set of commands and an exit to end, I guess that when you want to do a lookup (you could) use the FSO to create parms.txt containing 2 lines (ip address on the first, EXIT on the second) - shell "type pass.txt | nslookup > info.dat" - then again use the FSO to read info.dat - then stringslice out the "name: remotename" line..... - all on the server
very dirty - very bad - use it often for ftp/sending message and adding user accounts to the localadmin group......
-
Apr 14th, 2002, 03:38 PM
#9
Thread Starter
Fanatic Member
jpritchard
that sounds cool to me. what makes it so dirty and bad?
would using the API be more effeciant?
-
Apr 15th, 2002, 05:47 AM
#10
Hyperactive Member
hi
yeah you are right the api is by far the better way to go..
shelling command is just duff.... but very useful particularly when you have a command based 3rd party product which has some functionality you would like to incoporate into a vb app. If they provide NO object/api then this type of thing would work but dunno what the server impact would be, (threading etc etc......)
<%
option explicit
Dim strIP, objWsh, objRtc, objfso, objFile, strCommand, strContent, strupdpath
'----the one you want
strIP = "127.0.0.1"
'---some path on the server where iuser etc can update!!
strupdpath = "c:\inetpub\wwwroot\upddir\"
Set objfso = Server.CreateObject("Scripting.FileSystemObject")
Set objFile = objfso.CreateTextFile(strupdpath & "nslookup.txt", True)
objFile.WriteLine(strip)
objFile.WriteLine("exit")
objFile.Close
Set objFile = nothing
strCommand = "cmd /c type " & strupdpath & "nslookup.txt | nslookup > " & strupdpath & "nslookup.dat"
Set objWsh = Server.CreateObject("WScript.Shell")
objRtc = objWsh.Run (strCommand , 0, True)
Set objWsh = Nothing
Set objFile = objfso.OpenTextFile( strupdpath & "nslookup.dat", 1)
strContent = objFile.ReadAll
Set objFile = nothing
Set objfso = nothing
'---ling out the whole response..
Response.Write strContent
Response.Write "<br>done!"
%>
-
Apr 15th, 2002, 06:28 AM
#11
Hyperactive Member
-
Apr 15th, 2002, 09:38 AM
#12
Thread Starter
Fanatic Member
:)
nice!
Thanks for both the code and the link!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|