showing visitors IP ??

adalt's picture

They have: 72 posts

Joined: Dec 2000

Hi,
I have a shopping cart on my site & 99% of sales are going to be COD. So i want to be able to show my visitors IP address & give a "don't be naughty" type warning to help reduce the number of times that i will get messed around.
What is the best way to show a visitors IP ??

Thanks

Tony

Before you criticise someone walk a mile in their shoes......
Then, if they don't like what you say they are 1 mile away and barefoot.

They have: 161 posts

Joined: Dec 1999

Since the pages are being displayed dynamically, you can try the REMOTE_ADDR environment variable. Note, though, that this value is not traceable to a specific location in the world, and proxies can make this value meaningless.

In Perl, it's $ENV{REMOTE_ADDR}. The SSI to echo it is .

They have: 133 posts

Joined: Sep 2000

In ASP its
Request.ServerVariables("REMOTE_ADDR")

But nomatter what, I think it would be the best if you used a cookie to store the information in! That way you will make sure that its the same computer that you are talking to! With the IP you can't be 100% sure!
I think that
response.cookies("cookiename") = "1"
and
request.cookies("cookiename")

should do the job for you.

Hope´it helps.
~Casper

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.