<?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: Basic IP Banning</title>
	<atom:link href="http://www.wlscripting.com/tutorial/23/feed" rel="self" type="application/rss+xml" />
	<link>http://www.wlscripting.com/tutorial/23</link>
	<description>PHP coding tutorials</description>
	<lastBuildDate>Tue, 27 Jul 2010 02:32:09 -0400</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9-beta-1</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Rocky</title>
		<link>http://www.wlscripting.com/tutorial/23/comment-page-1#comment-185180</link>
		<dc:creator>Rocky</dc:creator>
		<pubDate>Sat, 25 Jul 2009 09:26:16 +0000</pubDate>
		<guid isPermaLink="false">http://wlscripting.com/tutorial/23#comment-185180</guid>
		<description>$denyIP = array(&#039;192.168.1.100&#039;, &#039;192.168.2.*&#039;, &#039;192.168.3.10?&#039;);

$_allowed = true;

// Loop through all IP addresses
foreach($denyIP as $dip){
	$dip = str_replace(&#039;.&#039;,&#039;\.&#039;,$dip);
	$dip = str_replace(&#039;*&#039;,&#039;[0-9]{1,3}&#039;,$dip);
	$dip = str_replace(&#039;?&#039;,&#039;[0-9]{1}&#039;,$dip);
	if(ereg(&quot;^{$dip}$&quot;, $_SERVER[REMOTE_ADDR])) $_allowed = false;
}

if(!$_allowed) {

echo &#039;You have been banned from this site. Sorry!&#039;;
exit;

} else {
// Allow Access To The Website
}
?&gt;

if (strpos($_SERVER[&#039;REMOTE_ADDR&#039;], $dip) === 0) {
$_allowed = false;
}
// Run Check</description>
		<content:encoded><![CDATA[<p>$denyIP = array(&#8216;192.168.1.100&#8242;, &#8216;192.168.2.*&#8217;, &#8216;192.168.3.10?&#8217;);</p>
<p>$_allowed = true;</p>
<p>// Loop through all IP addresses<br />
foreach($denyIP as $dip){<br />
	$dip = str_replace(&#8216;.&#8217;,'\.&#8217;,$dip);<br />
	$dip = str_replace(&#8216;*&#8217;,&#8217;[0-9]{1,3}&#8217;,$dip);<br />
	$dip = str_replace(&#8216;?&#8217;,&#8217;[0-9]{1}&#8217;,$dip);<br />
	if(ereg(&#8220;^{$dip}$&#8221;, $_SERVER[REMOTE_ADDR])) $_allowed = false;<br />
}</p>
<p>if(!$_allowed) {</p>
<p>echo &#8216;You have been banned from this site. Sorry!&#8217;;<br />
exit;</p>
<p>} else {<br />
// Allow Access To The Website<br />
}<br />
?&gt;</p>
<p>if (strpos($_SERVER['REMOTE_ADDR'], $dip) === 0) {<br />
$_allowed = false;<br />
}<br />
// Run Check</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Michael</title>
		<link>http://www.wlscripting.com/tutorial/23/comment-page-1#comment-177744</link>
		<dc:creator>Michael</dc:creator>
		<pubDate>Mon, 04 May 2009 15:52:49 +0000</pubDate>
		<guid isPermaLink="false">http://wlscripting.com/tutorial/23#comment-177744</guid>
		<description>You could use...

if (strpos($_SERVER[&#039;REMOTE_ADDR&#039;], $dip) === 0) {
 $_allowed = false;
}

... and not need to use the &#039;str_replace&#039; functions. To allow for wildcards, just stop the banned address earlier, i.e. &#039;192.168.2&#039;.</description>
		<content:encoded><![CDATA[<p>You could use&#8230;</p>
<p>if (strpos($_SERVER['REMOTE_ADDR'], $dip) === 0) {<br />
 $_allowed = false;<br />
}</p>
<p>&#8230; and not need to use the &#8217;str_replace&#8217; functions. To allow for wildcards, just stop the banned address earlier, i.e. &#8216;192.168.2&#8242;.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Daniel</title>
		<link>http://www.wlscripting.com/tutorial/23/comment-page-1#comment-138275</link>
		<dc:creator>Daniel</dc:creator>
		<pubDate>Wed, 24 Sep 2008 01:59:14 +0000</pubDate>
		<guid isPermaLink="false">http://wlscripting.com/tutorial/23#comment-138275</guid>
		<description>There is no SQL in this script so there are no possibilities of SQL injection.</description>
		<content:encoded><![CDATA[<p>There is no SQL in this script so there are no possibilities of SQL injection.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: anony</title>
		<link>http://www.wlscripting.com/tutorial/23/comment-page-1#comment-127679</link>
		<dc:creator>anony</dc:creator>
		<pubDate>Sat, 09 Aug 2008 16:24:27 +0000</pubDate>
		<guid isPermaLink="false">http://wlscripting.com/tutorial/23#comment-127679</guid>
		<description>This is a good script, though there is possibilities of SQL injection in places. Nice work though!</description>
		<content:encoded><![CDATA[<p>This is a good script, though there is possibilities of SQL injection in places. Nice work though!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: bazish</title>
		<link>http://www.wlscripting.com/tutorial/23/comment-page-1#comment-111947</link>
		<dc:creator>bazish</dc:creator>
		<pubDate>Thu, 26 Jun 2008 06:50:58 +0000</pubDate>
		<guid isPermaLink="false">http://wlscripting.com/tutorial/23#comment-111947</guid>
		<description>Excellent job, i like the way you explain your scripts and all are working accurately. which is proof of your high knowledge of PHP. 
thanks for sharing all these scripts.</description>
		<content:encoded><![CDATA[<p>Excellent job, i like the way you explain your scripts and all are working accurately. which is proof of your high knowledge of PHP.<br />
thanks for sharing all these scripts.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: r</title>
		<link>http://www.wlscripting.com/tutorial/23/comment-page-1#comment-9</link>
		<dc:creator>r</dc:creator>
		<pubDate>Fri, 04 Aug 2006 14:52:17 +0000</pubDate>
		<guid isPermaLink="false">http://wlscripting.com/tutorial/23#comment-9</guid>
		<description>this is good web site</description>
		<content:encoded><![CDATA[<p>this is good web site</p>
]]></content:encoded>
	</item>
</channel>
</rss>
