RE: [PHP] getting ip address of the user.

From: Date: Tue, 24 Sep 2002 19:45:55 +0000
Subject: RE: [PHP] getting ip address of the user.
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-117468@lists.php.net to get a copy of this message
Hi, Y'all, Here's another suggestion FWIW. I prep a few variables in the htmlhead.php routine, $RemoteHost being one of them. Having some simple names for associated values is kinda handy. One of the biggest strengths of PHP is that there's more than one way to go about solving problems. Here goes: <?php /* Identify the request, request headers, and the requestor */ $HTTP_Headers = getallheaders(); $Method = getenv( "REQUEST_METHOD" ); $Referer = getenv( "HTTP_REFERER" ); $RemoteHost = getenv( "REMOTE_HOST" ); if ( $HTTP_X_FORWARDED_FOR ) { $RemoteAddr = $HTTP_X_FORWARDED_FOR; } elseif ( $HTTP_VIA) { $RemoteAddr = $HTTP_VIA; } elseif ( $REMOTE_ADDR ) { $RemoteAddr = $REMOTE_ADDR; } ?> --- Jesse Cablek <php@list.everchanging.org> wrote: > Anil Garg <mailto:anilg@niksun.com> scribbled; > > > > Can i get the ip-address of the machines who > accessed my website?? > > Plz give the pointer that on what lines shall i > start for doing so. > > > > print $_SERVER['REMOTE_ADDR']; > > -jesse > > > -- > 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

« previous php.general (#117468) next »