Web Hosting Talk







View Full Version : Best IP checking code?


Frosty
04-28-2002, 12:47 PM
:confused:

Does anyone know the best way to get someone`s IP address to show up when they visit my site? I used the below PHP code but it must not be accurate at all because i`ve been online for an hour straight and every ten minutes i click on my webpage to view my own IP but it shows a completely different IP each time. That can`t be correct.

And other websites that have IP checkers...theirs doesn`t do the above. It shows my IP correctly and not a million different ones.

<? echo $REMOTE_ADDR ?>

diederik
04-28-2002, 07:43 PM
Search on this forum :
http://forums.devshed.com
I'm sure that you can find what you need there :)

Website Rob
04-28-2002, 09:53 PM
Depending on your Server setup, you may need to use the ".shtml" extension [instead of the "html" or "htm"] as the following uses Server Side Includes provided by Apache.

<!--#echo var="REMOTE_ADDR" -->

Treat it the same as you would an HTML tag and do not use ".php" for the page extension.

The only time you'll have problems is when a Proxy Server or Dynamically assigned IP address is used, as those "can differ" each visit.