Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - IP problem
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

IP problem

 Post Reply Post Reply
Author
skyworld View Drop Down
Senior Member
Senior Member


Joined: 12 December 2002
Location: United States
Status: Offline
Points: 134
Post Options Post Options   Thanks (0) Thanks(0)   Quote skyworld Quote  Post ReplyReply Direct Link To This Post Topic: IP problem
    Posted: 24 February 2003 at 5:02pm

On my site i want the ip for reference but i have a problem...

i am trying to set the ip as a cookie and it comes out as:

"ip=65%2E32%2E102%2E123"

My code is...

'-------------------------------------------------------

<%
'GET IP
Dim ipaddress
ipaddress = request.servervariables("http_x_for")
if ipaddress <> "" then
theip = ipaddress
else
theip = request.servervariables("remote_addr")
end if
if request.cookies("ip") = "" then
response.cookies("ip") = theip
response.cookies("ip").expires = date() + 365
'End of get ip!
else
end if
%>
'-------------------------------

now when i preview it in browser if i dont include theip step it shows the ip and if i use ipaddress it doesnt... I tried setting it as a cookie and it tells me that the headers are already written to... Where did i go wrong?

Back to Top
nittystone View Drop Down
Newbie
Newbie


Joined: 24 February 2003
Location: China
Status: Offline
Points: 7
Post Options Post Options   Thanks (0) Thanks(0)   Quote nittystone Quote  Post ReplyReply Direct Link To This Post Posted: 24 February 2003 at 8:48pm

i don't your problem

i use xml document to save client ip

in session_start

objdom.load(application("manager_xml"))
 set online=objdom.selectSingleNode("//main/online")
 'set parts=objdom.selectSingleNode("//main/shop").childNodes
 
 set NewNode=objdom.createElement("user")
 
 set NewAttr=objdom.createAttribute("id")
 NewAttr.NodeValue=session("id")
 NewNode.SetAttributeNode NewAttr
  
 set NewAttr=objdom.createAttribute("time")
 NewAttr.NodeValue=date() & " " & time()
 NewNode.SetAttributeNode NewAttr
 
 set NewAttr=objdom.createAttribute("id")
 NewAttr.NodeValue=session("id")
 NewNode.SetAttributeNode NewAttr
 
 set NewAttr=objdom.createAttribute("ip")
 NewAttr.NodeValue=request.ServerVariables("REMOTE_ADDR")
 NewNode.SetAttributeNode NewAttr
 
 set NewAttr=objdom.createAttribute("gotime")
 NewAttr.NodeValue=""
 NewNode.SetAttributeNode NewAttr
 
 set NewAttr=objdom.createAttribute("username")
 NewAttr.NodeValue=session("name")
 NewNode.SetAttributeNode NewAttr
 online.appendChild NewNode
 objdom.save(application("manager_xml"))

Back to Top
skyworld View Drop Down
Senior Member
Senior Member


Joined: 12 December 2002
Location: United States
Status: Offline
Points: 134
Post Options Post Options   Thanks (0) Thanks(0)   Quote skyworld Quote  Post ReplyReply Direct Link To This Post Posted: 25 February 2003 at 9:08am
hmm... i might try that then
Back to Top
MorningZ View Drop Down
Senior Member
Senior Member
Avatar

Joined: 06 May 2002
Location: United States
Status: Offline
Points: 1793
Post Options Post Options   Thanks (0) Thanks(0)   Quote MorningZ Quote  Post ReplyReply Direct Link To This Post Posted: 25 February 2003 at 12:36pm
I'm still trying to figure out why you are saving the IP on the client's cookie..

if you need their IP, simply use
Request.ServerVariables("REMOTE_HOST")

why set the cookie when the value is the exact same?

Edited by MorningZ
Contribute to the working anarchy we fondly call the Internet
Back to Top
skyworld View Drop Down
Senior Member
Senior Member


Joined: 12 December 2002
Location: United States
Status: Offline
Points: 134
Post Options Post Options   Thanks (0) Thanks(0)   Quote skyworld Quote  Post ReplyReply Direct Link To This Post Posted: 25 February 2003 at 4:19pm
ok good point
Back to Top
skyworld View Drop Down
Senior Member
Senior Member


Joined: 12 December 2002
Location: United States
Status: Offline
Points: 134
Post Options Post Options   Thanks (0) Thanks(0)   Quote skyworld Quote  Post ReplyReply Direct Link To This Post Posted: 25 February 2003 at 4:20pm
i wanted the ip for themes origionally because i was going to use it with a database but changed my mind
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.08
Copyright ©2001-2026 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Notice

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT at 20% unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2026 Web Wiz Ltd. All rights reserved.