Re: Re: help - to get client IP
| From: | Jonathan Underfoot | Date: | Mon, 11 Feb 2002 12:49:09 +0000 |
| Subject: | Re: Re: help - to get client IP | ||
| References: | 1 2 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-16791@lists.php.net to get a copy of this message | ||
This is what I use, I think I got it off the online documentation. I use it
to track users and it checks for proxys.
if ($HTTP_SERVER_VARS["HTTP_X_FORWARDED_FOR"] != "")
{$IP = $HTTP_SERVER_VARS["HTTP_X_FORWARDED_FOR"];
$proxy = $HTTP_SERVER_VARS["REMOTE_ADDR"];
$host = @gethostbyaddr($HTTP_SERVER_VARS["HTTP_X_FORWARDED_FOR"]);}
else
{$IP = $HTTP_SERVER_VARS["REMOTE_ADDR"];
$host = @gethostbyaddr($HTTP_SERVER_VARS["REMOTE_ADDR"]);}
-Jonathan
----- Original Message -----
From: "Jeroen Timmers" <maillist@start4me.nl>
To: <mlists123@yahoo.com>
Cc: "[PHP-DB]" <php-db@lists.php.net>
Sent: Monday, February 11, 2002 7:43 AM
Subject: [PHP-DB] Re: [PHP] help - to get client IP
> Someone please help me of how I could get the client IP using PHP, when i
> use $remote_addr it gives me the server IP, Kindly help how I could get
the
> IP of clients who are connected to my server or website.
>
> $ip = gethostbyname($REMOTE_HOST);
>
> the you got the IP of the remote user.
>
> Jeroen Timmers
>
>
>
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>