Set SessionLookup=oConn.Execute("SELECT * FROM site_sessions WHERE session_ID="&Session.SessionID)
If Not SessionLookup.EOF Then
Session_ID=SessionLookup("session_ID")
Else
Set oXMLHTTPLocIP=CreateObject("MSXML2.ServerXMLHTTP")
LocIP="http://api.ipify.org/"
oXMLHTTPLocIP.Open "GET",LocIP,False
oXMLHTTPLocIP.Send
If oXMLHTTPLocIP.Status="200" Then
IP=oXMLHTTPLocIP.responseText
Set oXMLHTTPLoc=CreateObject("MSXML2.ServerXMLHTTP")
IP=oXMLHTTPLocIP.responseText
LocAPI="http://ip-api.com/json/"&IP&"?fields=countryCode,city"
oXMLHTTPLoc.Open "GET",LocAPI,False
oXMLHTTPLoc.Send
If oXMLHTTPLoc.Status="200" Then
GetTextFromUrlLoc=oXMLHTTPLoc.responseText
CityLoc=Replace(Split(Split(GetTextFromUrlLoc,",")(0),":")(1),"""","")
CountryLoc=Replace(Replace(Split(Split(GetTextFromUrlLoc,",")(1),":")(1),"""",""),"}","")
End If
End If
oConn.Execute("INSERT INTO site_sessions(session_ID,brand_ID,session_IP,session_geoCity,session_geoCountry,session_timezone,session_date,session_time) VALUES("&Session.SessionID&",'"&SubDomain("brand_ID")&"','"&IP&"','"&CityLoc&"','"&CountryLoc&"','"&Timezone()&"','"&Date()&"','"&Time()&"')")
Set NewSession=oConn.Execute("SELECT @@IDENTITY AS New_Session_ID")
Session_ID=Cstr(NewSession("New_Session_ID"))
End If
Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.
When asked, what has been your best career decision?
Deciding to stick with EE.
Being involved with EE helped me to grow personally and professionally.
Connect with Certified Experts to gain insight and support on specific technology challenges including:
We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE