<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title><![CDATA[Code The World — How to block multiple IP adresses]]></title>
		<link>https://codetheworld.com/viewtopic.php?id=31</link>
		<atom:link href="https://codetheworld.com/extern.php?action=feed&amp;tid=31&amp;type=rss" rel="self" type="application/rss+xml" />
		<description><![CDATA[The most recent posts in How to block multiple IP adresses.]]></description>
		<lastBuildDate>Sun, 15 Jun 2008 10:17:05 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: How to block multiple IP adresses]]></title>
			<link>https://codetheworld.com/viewtopic.php?pid=117#p117</link>
			<description><![CDATA[<p>You shoud also check the VIA header when they use open proxies they will be found if the proxy sends this header</p><p>Here&#039;s a piece off code as example:</p><div class="codebox"><pre><code>&lt;?php
echo &quot;Your Ip Addres is &quot; . $_SERVER[&#039;REMOTE_ADDR&#039;] .&quot;&lt;br/&gt;&quot;;
if ( $_SERVER[&#039;HTTP_VIA&#039;] ) {
    echo &quot;Your are using proxy server &quot; . $_SERVER[&#039;HTTP_VIA&#039;] .&quot;&lt;br /&gt;&quot;;
} else {
    echo &quot;No VIA header detected&quot;;
}
//echo $_SERVER[&#039;HTTP_VIA&#039;];
if ( $_SERVER[&#039;HTTP_X_FORWARDED_FOR&#039;] ) {
    echo &quot;Your are proxied and the proxied address is &quot; . $_SERVER[&#039;HTTP_X_FORWARDED_FOR&#039;] .&quot;&lt;br /&gt;&quot;;
} else {
    echo &quot;No Forward address detected&quot;;
}
?&gt;</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (Terry)]]></author>
			<pubDate>Sun, 15 Jun 2008 10:17:05 +0000</pubDate>
			<guid>https://codetheworld.com/viewtopic.php?pid=117#p117</guid>
		</item>
		<item>
			<title><![CDATA[How to block multiple IP adresses]]></title>
			<link>https://codetheworld.com/viewtopic.php?pid=42#p42</link>
			<description><![CDATA[<div class="codebox"><pre><code>// Denied IP&#039;s.
    $deny_ips = array(
        &#039;127.0.0.1&#039;,
        &#039;192.168.100.1&#039;,
        &#039;192.168.200.1&#039;,
        &#039;192.168.300.1&#039;,
        &#039;xxx.xxx.xxx.xxx&#039;
    );
 
    // $deny_ips = file(&#039;blocked_ips.txt&#039;);
 
    // read user ip adress:
    $ip = isset($_SERVER[&#039;REMOTE_ADDR&#039;]) ? trim($_SERVER[&#039;REMOTE_ADDR&#039;]) : &#039;&#039;;
 
    // search current IP in $deny_ips array
    if (($i = array_search($ip, $deny_ips)) !== FALSE){
 
        // $i = contains the array key of the IP adress.        
 
        // user is blocked:
        print &quot;Your IP adress (&#039;$ip&#039;) was blocked!&quot;;
        exit;
    }
 
    // If we reach this section, the IP adress is valid</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (Rockers00)]]></author>
			<pubDate>Sun, 15 Jun 2008 03:44:41 +0000</pubDate>
			<guid>https://codetheworld.com/viewtopic.php?pid=42#p42</guid>
		</item>
	</channel>
</rss>
