Click to See Complete Forum and Search --> : IP Adress???


Asch
01-25-2003, 03:53 PM
Hello, i have a cgi guestbook script...The thing is i want that each visitors ho leaves a message the Ip adress is taken and ritten under each message on the guest page and shown to the vistor on the "thank-you page"...!!

It will be great if someone noes how to do that!"I ve tried many things but can't do it !! :o)

ive attached my script in ".txt" if this could help...

thanks ...

asch

jeffmott
01-25-2003, 09:12 PM
You can get the IP address from the REMOTE_ADDR environment variable.

$ENV{REMOTE_ADDR}

Ribeyed
01-26-2003, 09:17 AM
hi,

Sub Session_OnStart
set BC = server.createobject("MSWC.BrowserType")

IPAddress = Request.ServerVariables("remote_addr")
UserAgent = Request.Servervariables ("HTTP_USER_AGENT")
Browser = BC.Browser & " " & BC.Version
DHTMLSupport = cstr(BC.dhtml)
FramesSupport = cstr(BC.frames)
TablesSupport = cstr(BC.tables)
CookiesSupport = cstr(BC.cookies)
BackGroundSounds = cstr(BC.backgroundsounds)
JavaScriptSupport = cstr(BC.javascript)
JaveAppletsSupport = cstr(BC.javaapplets)
ActiveXControlsSupport = cstr(BC.activexcontrols)
AOL = cstr(BC.aol)
Platform = cstr(BC.platform)
VBScriptSupport = cstr(BC.vbscript)

FullReferer = Request.ServerVariables("http_referer")
if len(FullReferer) <= 7 then
RefererDomain = "-"
RefererQuery = "-"
else
SlashPosition = instr(8, FullReferer, "/")
if SlashPosition = 0 then
RefererDomain = FullReferer
RefererQuery = "-"
else
RefererDomain = left(FullReferer, SlashPosition - 1)
RefererQuery = right(FullReferer, len(FullReferer) - SlashPosition)
end if
end if

SQL = "insert Into tblVisitors (DateTimeEntrance, IPAddress, UserAgent, Browser, "
SQL = SQL & "DHTML, Frames, Tables, Cookies, BackgroundSounds, JavaScript, "
SQL = SQL & "JavaApplets, ActiveXControls, AOL, Platform, VBScript, "
SQL = SQL & "ReferrerDomain, ReferrerQuery, CookieID) values ("
SQL = SQL & "#" & DateTimeEntrance & "#, "
SQL = SQL & "'" & IPAddress & "', "
SQL = SQL & "'" & UserAgent & "', "
SQL = SQL & "'" & Browser & "', "
SQL = SQL & "'" & DHTMLSupport & "', "
SQL = SQL & "'" & FramesSupport & "', "
SQL = SQL & "'" & TablesSupport & "', "
SQL = SQL & "'" & CookiesSupport & "', "
SQL = SQL & "'" & BackGroundSounds & "', "
SQL = SQL & "'" & JavaScriptSupport & "', "
SQL = SQL & "'" & JaveAppletsSupport & "', "
SQL = SQL & "'" & ActiveXControlsSupport & "', "
SQL = SQL & "'" & AOL & "', "
SQL = SQL & "'" & Platform & "', "
SQL = SQL & "'" & VBScriptSupport & "', "
SQL = SQL & "'" & RefererDomain & "', "
SQL = SQL & "'" & RefererQuery & "', "
SQL = SQL & CookieID & ")"
discoveryDB.Execute SQL
end sub


this code would go in the global.asa in Sub Session_OnStart

hope this helps

Ribeyed
01-26-2003, 09:19 AM
sorry disregard all that, im sorry thought it was an ASp questions, that code is for ASP, sorry again duh!

Asch
01-26-2003, 09:37 AM
YA great thanks jeff mott..it works perfect with this command...:O)....

no prob for the asp lol :o)

thanks again ..

bye

Asch
01-27-2003, 11:21 AM
Originally posted by Asch
Hello, i have a cgi guestbook script...The thing is i want that each visitors ho leaves a message the Ip adress is taken and ritten under each message on the guest page and shown to the vistor on the "thank-you page"...!!

It will be great if someone noes how to do that!"I ve tried many things but can't do it !! :o)

ive attached my script in ".txt" if this could help...

thanks ...

asch