1
   

How to get a User's IP address?

 
 
Reply Fri 24 Oct, 2003 08:02 am
I am working on a really simple stats / logging script for my network of new sites. I am stuck at the moment trying to get the user's IP for my statistics db table and reporting.

There are quite a few possible 'variables' containing this information and this is a list I compiled so far by searching for this info over the last few days:
Code:<?php
// list of possible variables containing user's IP
$_SERVER['HTTP_X_FORWARDED_FOR'];
$_SERVER['HTTP_X_FORWARDED'];
$_SERVER['HTTP_FORWARDED_FOR'];
$_SERVER['HTTP_FORWARDED'];
$_SERVER['HTTP_X_COMING_FROM'];
$_SERVER['HTTP_COMING_FROM'];
$_SERVER['HTTP_CLIENT_IP'];
$_SERVER['HTTP_VIA'];
$_SERVER['REMOTE_ADDR'];
?>


Do you know of any others for this list? Or how many of those on this list are even still valid?

Besides the variable $_SERVER['REMOTE_ADDR'], which is nearly always set, why and when are the others available to a script?
  • Topic Stats
  • Top Replies
  • Link to this Topic
Type: Discussion • Score: 1 • Views: 1,073 • Replies: 3
No top replies

 
Craven de Kere
 
  1  
Reply Fri 24 Oct, 2003 10:02 am
But why are you trying the others if one of them works all the time?
0 Replies
 
BobbyDouglas
 
  1  
Reply Fri 24 Oct, 2003 03:02 pm
proxy servers
0 Replies
 
Craven de Kere
 
  1  
Reply Fri 24 Oct, 2003 03:04 pm
Well the thing is, each of them have some utility in some situation. Setup some if statements to weed them out if they are not set.
0 Replies
 
 

Related Topics

Webdevelopment and hosting - Question by harisit2005
Showing an Ico File - Discussion by Brandon9000
how to earn money in internet - Discussion by rizwanaraj
The version 10 bug. Worse then Y2K! - Discussion by Nick Ashley
CSS Border style colors - Question by meesa
There is no Wisdom in Crowds - Discussion by ebrown p
THANK YOU CRAVEN AND NICK!!! - Discussion by dagmaraka
I'm the developer - Discussion by Nick Ashley
 
  1. Forums
  2. » How to get a User's IP address?
Copyright © 2024 MadLab, LLC :: Terms of Service :: Privacy Policy :: Page generated in 0.03 seconds on 04/25/2024 at 07:39:01