Re: Getting users IP address into a variable.
| From: | Bill Farrell | Date: | Wed, 02 Oct 2002 16:48:58 +0000 |
| Subject: | Re: Getting users IP address into a variable. | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-118617@lists.php.net to get a copy of this message | ||
Try:
$ip = "";
if ( $HTTP_X_FORWARDED_FOR ) {
$ip = $HTTP_X_FORWARDED_FOR;
} elseif( $HTTP_VIA ) {
$ip = $HTTP_VIA;
} elseif( $REMOTE_ADDR ) {
$ip = $REMOTE_ADDR;
} else {
die(); // or perhaps some better response
}
--- Webmaster MBTRADINGCO <webmaster@mbtradingco.com>
wrote:
> I'm sure there has to be a way to verify which IP
> address is accessing
> from. I need to establish a page where when I enter
> it records the IP
> address I'm logging in from, to a database.
>
> Problem is I can't seem a command in php that can
> assign that to a
> variable, as in:
>
> $ip=HTTP_GET_????
>
> ANY IDEAS????
>
> Thanks
>
>
> Elliot J. Balanza
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
=====
Bill Farrell
Multivalue and *nix Support Specialist
Phone: (828) 667-2245
Fax: (928) 563-5189
Web: http://www.jwfarrell.com
__________________________________________________
Do you Yahoo!?
New DSL Internet Access from SBC & Yahoo!
http://sbc.yahoo.com