<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: How To Block Multiple IP Addresses Using PHP</title>
	<atom:link href="http://vidiame.com/php/how-to-block-multiple-ip-addresses-using-php/feed" rel="self" type="application/rss+xml" />
	<link>http://vidiame.com/php/how-to-block-multiple-ip-addresses-using-php</link>
	<description>Web development articles, including PHP, jQuery, CSS and more.</description>
	<lastBuildDate>Thu, 02 Feb 2012 16:27:11 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: Ubbe</title>
		<link>http://vidiame.com/php/how-to-block-multiple-ip-addresses-using-php/comment-page-1#comment-1009</link>
		<dc:creator>Ubbe</dc:creator>
		<pubDate>Thu, 02 Feb 2012 16:27:11 +0000</pubDate>
		<guid isPermaLink="false">http://vidiame.com/?p=178#comment-1009</guid>
		<description>Finally, a way to fight the senseless WebSense bots! hurray
Last i checked, 208.80.194.*</description>
		<content:encoded><![CDATA[<p>Finally, a way to fight the senseless WebSense bots! hurray<br />
Last i checked, 208.80.194.*</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: faiyaz</title>
		<link>http://vidiame.com/php/how-to-block-multiple-ip-addresses-using-php/comment-page-1#comment-990</link>
		<dc:creator>faiyaz</dc:creator>
		<pubDate>Sat, 01 Oct 2011 08:22:30 +0000</pubDate>
		<guid isPermaLink="false">http://vidiame.com/?p=178#comment-990</guid>
		<description>kindly send me a code for checking blacklisted ip using post or get method</description>
		<content:encoded><![CDATA[<p>kindly send me a code for checking blacklisted ip using post or get method</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Joel Urbina</title>
		<link>http://vidiame.com/php/how-to-block-multiple-ip-addresses-using-php/comment-page-1#comment-989</link>
		<dc:creator>Joel Urbina</dc:creator>
		<pubDate>Tue, 27 Sep 2011 15:47:54 +0000</pubDate>
		<guid isPermaLink="false">http://vidiame.com/?p=178#comment-989</guid>
		<description>PS Thanks for the code!

(oops the code I added wasn&#039;t visible last time)


[code lang=&quot;php&quot;]
$denied_ips = array(
            &#039;222.186.2&#039;,
            &#039;60.169.78&#039;,
            &#039;61.160.232&#039;
        );
 
function getUserIP()
{
    //check ip from share internet
    if (!empty($_SERVER[&#039;HTTP_CLIENT_IP&#039;]))
    {
      $ip=$_SERVER[&#039;HTTP_CLIENT_IP&#039;];
    }
    //to check ip is pass from proxy
    elseif (!empty($_SERVER[&#039;HTTP_X_FORWARDED_FOR&#039;]))
    {
      $ip=$_SERVER[&#039;HTTP_X_FORWARDED_FOR&#039;];
    }
    else
    {
      $ip=$_SERVER[&#039;REMOTE_ADDR&#039;];
    }
    return $ip;
}
 
$visitorIp = getUserIP();

foreach($denied_ips as $dip){
	if(stristr($$visitorIP,$dip)){
		echo &quot;YOUR IP HAS BEEN BANNED.&quot;;
    exit;
}
}

[/code]</description>
		<content:encoded><![CDATA[<p>PS Thanks for the code!</p>
<p>(oops the code I added wasn&#8217;t visible last time)</p>
<pre class="brush: php; title: ; notranslate">
$denied_ips = array(
            '222.186.2',
            '60.169.78',
            '61.160.232'
        );

function getUserIP()
{
    //check ip from share internet
    if (!empty($_SERVER['HTTP_CLIENT_IP']))
    {
      $ip=$_SERVER['HTTP_CLIENT_IP'];
    }
    //to check ip is pass from proxy
    elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR']))
    {
      $ip=$_SERVER['HTTP_X_FORWARDED_FOR'];
    }
    else
    {
      $ip=$_SERVER['REMOTE_ADDR'];
    }
    return $ip;
}

$visitorIp = getUserIP();

foreach($denied_ips as $dip){
	if(stristr($$visitorIP,$dip)){
		echo &quot;YOUR IP HAS BEEN BANNED.&quot;;
    exit;
}
}
</pre>
]]></content:encoded>
	</item>
	<item>
		<title>By: Joel Urbina</title>
		<link>http://vidiame.com/php/how-to-block-multiple-ip-addresses-using-php/comment-page-1#comment-988</link>
		<dc:creator>Joel Urbina</dc:creator>
		<pubDate>Tue, 27 Sep 2011 15:45:56 +0000</pubDate>
		<guid isPermaLink="false">http://vidiame.com/?p=178#comment-988</guid>
		<description>Altered it a bit (view below) to function to block out not just single IPs, but blocks of IPs... really simple change, works on the same basis. (in this example I used it to stop some blocks of Chinese IPs that were spamming our Joomla site with junk users)

</description>
		<content:encoded><![CDATA[<p>Altered it a bit (view below) to function to block out not just single IPs, but blocks of IPs&#8230; really simple change, works on the same basis. (in this example I used it to stop some blocks of Chinese IPs that were spamming our Joomla site with junk users)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Saw13</title>
		<link>http://vidiame.com/php/how-to-block-multiple-ip-addresses-using-php/comment-page-1#comment-964</link>
		<dc:creator>Saw13</dc:creator>
		<pubDate>Tue, 19 Apr 2011 22:33:33 +0000</pubDate>
		<guid isPermaLink="false">http://vidiame.com/?p=178#comment-964</guid>
		<description>Thanks , that helped me :)</description>
		<content:encoded><![CDATA[<p>Thanks , that helped me <img src='http://vidiame.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
</channel>
</rss>
<!-- WP Super Cache is installed but broken. The path to wp-cache-phase1.php in wp-content/advanced-cache.php must be fixed! -->
