Re: [PHP] Client IP
John W. Holmes wrote: Trust me. Riggtt. Like we're going to trust the likes of you. I guess the cheque's in the mail too, eh? ;) -- By-Tor.com It's all about the Rush http://www.by-tor.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Client IP
In article [EMAIL PROTECTED], Rosen wrote: :) Ok - then how linux server communicate with client - the server must have IP adress to whitch to send data. Rosen wrote: IP adress not send ?!? And how server communicate with client ? For example people on a lan (with let's say ip addresses in the 192.168.X.Y range) that use a proxy. You'll see the address of the proxy in $_SERVER['REMOTE_ADDR']. And i doubt that is what you were looking for :) -- Tim Van Wassenhove http://home.mysth.be/~timvw -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Client IP
Ok - thie is enought for me - to see the adres of proxy server. :) Tim Van Wassenhove [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] In article [EMAIL PROTECTED], Rosen wrote: :) Ok - then how linux server communicate with client - the server must have IP adress to whitch to send data. Rosen wrote: IP adress not send ?!? And how server communicate with client ? For example people on a lan (with let's say ip addresses in the 192.168.X.Y range) that use a proxy. You'll see the address of the proxy in $_SERVER['REMOTE_ADDR']. And i doubt that is what you were looking for :) -- Tim Van Wassenhove http://home.mysth.be/~timvw -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Client IP
I don't understand :) John Nichel [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] John W. Holmes wrote: Trust me. Riggtt. Like we're going to trust the likes of you. I guess the cheque's in the mail too, eh? ;) -- By-Tor.com It's all about the Rush http://www.by-tor.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Client IP
Hi, How can I get remote IP adress of client? I use the fillow script:: $ip=getenv('HTTP_X_FORWARDED_FOR'); if (!$ip) { $ip = getenv('REMOTE_ADDR'); } But sometime it return me unknown sa IP adress. Can someone help me ? Thanks in advance! $_SERVER[REMOTE_ADDR] --Matthew Sims --http://killermookie.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Client IP
Matthew Sims wrote: Hi, How can I get remote IP adress of client? I use the fillow script:: $ip=getenv('HTTP_X_FORWARDED_FOR'); if (!$ip) { $ip = getenv('REMOTE_ADDR'); } But sometime it return me unknown sa IP adress. Can someone help me ? Thanks in advance! $_SERVER[REMOTE_ADDR] Either method will work. You just have to realize that sometimes the IP address is not sent. There is no reliable way to get the clients IP address, so do not depend on it. -- ---John Holmes... Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ php|architect: The Magazine for PHP Professionals www.phparch.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Client IP
IP adress not send ?!? And how server communicate with client ? John W. Holmes [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Matthew Sims wrote: Hi, How can I get remote IP adress of client? I use the fillow script:: $ip=getenv('HTTP_X_FORWARDED_FOR'); if (!$ip) { $ip = getenv('REMOTE_ADDR'); } But sometime it return me unknown sa IP adress. Can someone help me ? Thanks in advance! $_SERVER[REMOTE_ADDR] Either method will work. You just have to realize that sometimes the IP address is not sent. There is no reliable way to get the clients IP address, so do not depend on it. -- ---John Holmes... Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ php|architect: The Magazine for PHP Professionals www.phparch.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Client IP
Rosen wrote: IP adress not send ?!? And how server communicate with client ? A variety of ways. What I meant is that it's not sent in the browser's headers that it sends to the site, which is where getenv() and $_SERVER[] would snatch it from. Do not rely on IP addresses. Trust me. -- ---John Holmes... Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ php|architect: The Magazine for PHP Professionals www.phparch.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Client IP
:) Ok - then how linux server communicate with client - the server must have IP adress to whitch to send data. John W. Holmes [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Rosen wrote: IP adress not send ?!? And how server communicate with client ? A variety of ways. What I meant is that it's not sent in the browser's headers that it sends to the site, which is where getenv() and $_SERVER[] would snatch it from. Do not rely on IP addresses. Trust me. -- ---John Holmes... Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ php|architect: The Magazine for PHP Professionals www.phparch.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Client IP
I've used this function before a couple of times, but I haven't tested it fully. Give it a go if you want. /*** BEGIN CODE ***/ // Function get_ip function get_ip() { // List of possible ip sources, in order of priority $ip_sources = array ( HTTP_X_FORWARDED_FOR, HTTP_X_FORWARDED, HTTP_FORWARDED_FOR, HTTP_FORWARDED, HTTP_X_COMING_FROM, HTTP_COMING_FROM, REMOTE_ADDR, ); foreach ($ip_sources as $ip_source) { // If the ip source exists, capture it if (isset($_SERVER[$ip_source])) { // Beware of semicolon seperated lists $possible_ips = explode(;, $_SERVER[$ip_source]); // Always take just the first $proxy_ip = $possible_ips[0]; break; } } // If the ip is still not found, try the getenv() function without error reporting (may give false) $proxy_ip = (isset($proxy_ip)) ? $proxy_ip : @getenv(REMOTE_ADDR); return $proxy_ip; } /*** END CODE ***/ On Thu, 8 Jul 2004 02:17:00 +0300, Rosen [EMAIL PROTECTED] wrote: :) Ok - then how linux server communicate with client - the server must have IP adress to whitch to send data. John W. Holmes [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Rosen wrote: IP adress not send ?!? And how server communicate with client ? A variety of ways. What I meant is that it's not sent in the browser's headers that it sends to the site, which is where getenv() and $_SERVER[] would snatch it from. Do not rely on IP addresses. Trust me. -- ---John Holmes... Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ php|architect: The Magazine for PHP Professionals www.phparch.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Client IP
Rosen wrote: IP adress not send ?!? And how server communicate with client ? [snip] The httpd server might know the remote IP address, but that doesn't mean that it has to tell PHP about it. The SAPI module may or may not set the value, for instance. Even if you could rely on the IP address, in many cases it will not do quite what you want. For instance, if you try to organize users by IP address, you'll find that many users can appear to have the same IP address, such as when they're behind a firewall or using a workstation on an internal LAN--they may all appear to be coming from the same address. Hope this helps clear it up, Torben $_SERVER[REMOTE_ADDR] Either method will work. You just have to realize that sometimes the IP address is not sent. There is no reliable way to get the clients IP address, so do not depend on it. -- ---John Holmes... Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ php|architect: The Magazine for PHP Professionals www.phparch.com -- Torben Wilson [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Client IP
Thanks, This for the users, thath come from one IP adress - I know about it, but, Can I get just adress of the IP, with which the server communicates ? Lars Torben Wilson [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Rosen wrote: IP adress not send ?!? And how server communicate with client ? [snip] The httpd server might know the remote IP address, but that doesn't mean that it has to tell PHP about it. The SAPI module may or may not set the value, for instance. Even if you could rely on the IP address, in many cases it will not do quite what you want. For instance, if you try to organize users by IP address, you'll find that many users can appear to have the same IP address, such as when they're behind a firewall or using a workstation on an internal LAN--they may all appear to be coming from the same address. Hope this helps clear it up, Torben $_SERVER[REMOTE_ADDR] Either method will work. You just have to realize that sometimes the IP address is not sent. There is no reliable way to get the clients IP address, so do not depend on it. -- ---John Holmes... Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ php|architect: The Magazine for PHP Professionals www.phparch.com -- Torben Wilson [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Client IP
Rosen wrote: Can I get just adress of the IP, with which the server communicates ? If you don't see the IP address somewhere in the $_SERVER variable, then NO. -- ---John Holmes... Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ php|architect: The Magazine for PHP Professionals www.phparch.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Client IP
Ok, I don't understand why IP adress will bi invisible for $_SERVER variable. John W. Holmes [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Rosen wrote: Can I get just adress of the IP, with which the server communicates ? If you don't see the IP address somewhere in the $_SERVER variable, then NO. -- ---John Holmes... Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ php|architect: The Magazine for PHP Professionals www.phparch.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Client IP
John W. Holmes wrote: IP adress not send ?!? And how server communicate with client ? A variety of ways. What I meant is that it's not sent in the browser's headers that it sends to the site, which is where getenv() and $_SERVER[] would snatch it from. Correct me if I'm wrong, but shouldn't $_SERVER['REMOTE_ADDR'] always be set if you're using Apache? I've never experienced a case where it was not available. I'm no C guru, but from what I can tell by looking into the source for PHP 4.3.7 and Apache 1.3.28 it looks like Apache makes this variable available to PHP based on the information it stores internally about the currently-open connection to the client (see Apache's src/main/util_script.c, line 292). Have you experienced a case with Apache PHP where this variable was not available? Just curious... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Client IP
On Thursday 08 July 2004 07:17, Rosen wrote: Ok - then how linux server communicate with client - the server must have IP adress to whitch to send data. Look some form of IP *will* be set and *will* be available in $_SERVER. What you was using in your original post has been deprecated and thus may have mislead you into thinking that no IP was set. Use the info in $_SERVER and if you come across a situation where the IP is not set then file a bug. -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general -- /* Stupidity is its own reward. */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Client IP
Rosen wrote: Ok, I don't understand why IP adress will bi invisible for $_SERVER variable. It should be there, but mostly because the CGI 1.1 spec requires that it be provided to the script. There is no physical requirement for it to be there. Reasons for it not being present could include: o Incomplete SAPI code; o A bug in the httpd or SAPI module, o etc... Even if it is there, it's entirely possible that it's just the IP address of a proxy--or even some other IP address entirely; it's not hard to spoof. Of course, all of this only applies when running as a CGI or module for handling web requests. No $_SERVER['REMOTE_ADDR'] will be set when running on the command line. Torben John W. Holmes [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Rosen wrote: Can I get just adress of the IP, with which the server communicates ? If you don't see the IP address somewhere in the $_SERVER variable, then NO. -- ---John Holmes... Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ php|architect: The Magazine for PHP Professionals www.phparch.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Client IP address
It's not a function, it's a variable: $_SERVER[REMOTE_ADDR]; - Original Message - From: Ron Smith [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, November 21, 2002 3:16 PM Subject: [PHP] Client IP address I know this is probably easily solved, but I'm trying to locate the PHP function which returns the client's IP address when they request a page from the server. I'm having no luck searching the php.net function list. Kindest regards, Ron Yes, they were dinking with the DNS last weekend, and it got out to the internet, then took awhile to 'repair' itself, said my friend. To which I replied, Well, 'Dinking Happens!' = -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Client IP address
It's not a function, merely a variable. $REMOTE_ADDR Chris --- Ron Smith [EMAIL PROTECTED] wrote: I know this is probably easily solved, but I'm trying to locate the PHP function which returns the client's IP address when they request a page from the server. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Client IP address
--- Chris Shiflett [EMAIL PROTECTED] wrote: It's not a function, merely a variable. $REMOTE_ADDR Actually, $_SERVER[REMOTE_ADDR] is better, as another poster suggested. Chris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Client IP address
At 21:16 21.11.2002, Ron Smith said: [snip] I know this is probably easily solved, but I'm trying to locate the PHP function which returns the client's IP address when they request a page from the server. I'm having no luck searching the php.net function list. [snip] You'll find it in the $_SERVER array ($_SERVER['REMOTE_ADDR']). Check out http://www.php.net/manual/en/reserved.variables.php#reserved.variables.serve r as there's a lot of useful information in there... -- O Ernest E. Vogelsinger (\)ICQ #13394035 ^ http://www.vogelsinger.at/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] client ip address
$REMOTE_ADDR PHP Manual, Predefined variables On Tue, 27 Nov 2001, narko wrote: Hi all How can i get client IP address thanks, Narko -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]