<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Code The World — Displaye your real ip]]></title>
	<link rel="self" href="https://codetheworld.com/extern.php?action=feed&amp;tid=46&amp;type=atom" />
	<updated>2008-06-15T07:37:02Z</updated>
	<generator>PunBB</generator>
	<id>https://codetheworld.com/viewtopic.php?id=46</id>
		<entry>
			<title type="html"><![CDATA[Re: Displaye your real ip]]></title>
			<link rel="alternate" href="https://codetheworld.com/viewtopic.php?pid=82#p82" />
			<content type="html"><![CDATA[<p>Cool...</p><p>$_SERVER[&#039;HTTP_X_FORWARDED_FOR&#039;] is proxy behind the NAT router. And it could contain multiple IP addresses if the request was forwarded trough multiple proxies. So, maybe convert it to an array, something like this:<br /></p><div class="codebox"><pre><code> $ip = array();
    // check if it&#039;s set, and if it&#039;s more then one
    if  (isset($_SERVER[&#039;HTTP_X_FORWARDED_FOR&#039;]) &amp;&amp; strpos($_SERVER[&#039;HTTP_X_FORWARDED_FOR&#039;],&#039;,&#039;))  
    {
        $ip +=  explode(&#039;,&#039;,$_SERVER[&#039;HTTP_X_FORWARDED_FOR&#039;]);     //add IPs from all proxies to the ip array
    } elseif (isset($_SERVER[&#039;HTTP_X_FORWARDED_FOR&#039;])) 
    {
        $ip[] = $_SERVER[&#039;HTTP_X_FORWARDED_FOR&#039;];                      // add the one that you got
    }
   $ip[] = $_SERVER[&#039;REMOTE_ADDR&#039;];                                            // the default one</code></pre></div>]]></content>
			<author>
				<name><![CDATA[3bep]]></name>
				<uri>https://codetheworld.com/profile.php?id=64</uri>
			</author>
			<updated>2008-06-15T07:37:02Z</updated>
			<id>https://codetheworld.com/viewtopic.php?pid=82#p82</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Displaye your real ip]]></title>
			<link rel="alternate" href="https://codetheworld.com/viewtopic.php?pid=71#p71" />
			<content type="html"><![CDATA[<p>&lt;?php<br />$ip = isset($_SERVER[&#039;HTTP_X_FORWARDED_FOR&#039;]) ? $_SERVER[&#039;HTTP_X_FORWARDED_FOR&#039;] : $_SERVER[&#039;REMOTE_ADDR&#039;];<br />echo &#039;Your IP is: &#039;.$ip; ?&gt;</p><p>What do youse think?</p>]]></content>
			<author>
				<name><![CDATA[Hornet]]></name>
			</author>
			<updated>2008-06-15T07:07:08Z</updated>
			<id>https://codetheworld.com/viewtopic.php?pid=71#p71</id>
		</entry>
</feed>
