<?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: Restict Logins by IP Address</title>
	<atom:link href="http://deadlytechnology.com/php/ip-address-script/feed/" rel="self" type="application/rss+xml" />
	<link>http://deadlytechnology.com/php/ip-address-script/</link>
	<description></description>
	<lastBuildDate>Sun, 15 Apr 2012 21:04:00 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.3</generator>
<xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex" />
	<item>
		<title>By: Nickmokisasian</title>
		<link>http://deadlytechnology.com/php/ip-address-script/comment-page-1/#comment-1293</link>
		<dc:creator>Nickmokisasian</dc:creator>
		<pubDate>Sat, 25 Feb 2012 07:13:00 +0000</pubDate>
		<guid isPermaLink="false">http://deadlytechnology.com/scripts/php/ip-address-script/#comment-1293</guid>
		<description>What happens if one of the persons ip address changes?</description>
		<content:encoded><![CDATA[<p>What happens if one of the persons ip address changes?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Vinceas3</title>
		<link>http://deadlytechnology.com/php/ip-address-script/comment-page-1/#comment-1261</link>
		<dc:creator>Vinceas3</dc:creator>
		<pubDate>Tue, 29 Nov 2011 21:40:00 +0000</pubDate>
		<guid isPermaLink="false">http://deadlytechnology.com/scripts/php/ip-address-script/#comment-1261</guid>
		<description>That worked. Franks did not work, unfortunately, kept getting an error for preg match, but this works beautifully. I replaced everything in the for loop with your nice &quot;if&quot; statement, and it works like a charm. Thanks!!</description>
		<content:encoded><![CDATA[<p>That worked. Franks did not work, unfortunately, kept getting an error for preg match, but this works beautifully. I replaced everything in the for loop with your nice &#8220;if&#8221; statement, and it works like a charm. Thanks!!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Project707</title>
		<link>http://deadlytechnology.com/php/ip-address-script/comment-page-1/#comment-1249</link>
		<dc:creator>Project707</dc:creator>
		<pubDate>Fri, 28 Oct 2011 19:24:00 +0000</pubDate>
		<guid isPermaLink="false">http://deadlytechnology.com/scripts/php/ip-address-script/#comment-1249</guid>
		<description>Actually you don&#039;t even need the asterisks or to run all of that regex. Just enter the part of the IP you want to match on followed by a &quot;.&quot; so that say, .3 can&#039;t become .345 (unless that&#039;s desired functionality), and then use strpos() which tends to be faster for short string checks like this anyhow.

To do it this way, if your array is:
$ip = array();
$ip[] = &#039;10.10.3.&#039;;
$ip[] = &#039;211.109.238.74&#039;;
$ip[] = &#039;254.254.254.2&#039;;

then this is all you need within the for loop (0 makes sure it matches from the beginning):
if( strpos($_SERVER[&#039;REMOTE_ADDR&#039;], $ip[$i]) === 0)
     return true;</description>
		<content:encoded><![CDATA[<p>Actually you don&#8217;t even need the asterisks or to run all of that regex. Just enter the part of the IP you want to match on followed by a &#8220;.&#8221; so that say, .3 can&#8217;t become .345 (unless that&#8217;s desired functionality), and then use strpos() which tends to be faster for short string checks like this anyhow.</p>
<p>To do it this way, if your array is:<br />
$ip = array();<br />
$ip[] = &#8217;10.10.3.&#8217;;<br />
$ip[] = &#8217;211.109.238.74&#8242;;<br />
$ip[] = &#8217;254.254.254.2&#8242;;</p>
<p>then this is all you need within the for loop (0 makes sure it matches from the beginning):<br />
if( strpos($_SERVER['REMOTE_ADDR'], $ip[$i]) === 0)<br />
     return true;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: frank</title>
		<link>http://deadlytechnology.com/php/ip-address-script/comment-page-1/#comment-1057</link>
		<dc:creator>frank</dc:creator>
		<pubDate>Mon, 27 Dec 2010 22:47:08 +0000</pubDate>
		<guid isPermaLink="false">http://deadlytechnology.com/scripts/php/ip-address-script/#comment-1057</guid>
		<description>hi roger, not sure I follow why the for loop doesn&#039;t work...</description>
		<content:encoded><![CDATA[<p>hi roger, not sure I follow why the for loop doesn&#8217;t work&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: roger</title>
		<link>http://deadlytechnology.com/php/ip-address-script/comment-page-1/#comment-1054</link>
		<dc:creator>roger</dc:creator>
		<pubDate>Mon, 27 Dec 2010 11:07:03 +0000</pubDate>
		<guid isPermaLink="false">http://deadlytechnology.com/scripts/php/ip-address-script/#comment-1054</guid>
		<description>loop for doesn&#039;t work. There is return false and return true. Loop will never iterate through count($ip)</description>
		<content:encoded><![CDATA[<p>loop for doesn&#8217;t work. There is return false and return true. Loop will never iterate through count($ip)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: scott</title>
		<link>http://deadlytechnology.com/php/ip-address-script/comment-page-1/#comment-1034</link>
		<dc:creator>scott</dc:creator>
		<pubDate>Thu, 11 Nov 2010 03:12:14 +0000</pubDate>
		<guid isPermaLink="false">http://deadlytechnology.com/scripts/php/ip-address-script/#comment-1034</guid>
		<description>Any suggestions on how to add masks?
Eg: 10.0.0.1/29 - would allow IP&#039;s 10.0.0.1, 10.0.0.2, 10.0.0.3, 10.0.0.4, 10.0.0.5, 10.0.0.6</description>
		<content:encoded><![CDATA[<p>Any suggestions on how to add masks?<br />
Eg: 10.0.0.1/29 &#8211; would allow IP&#8217;s 10.0.0.1, 10.0.0.2, 10.0.0.3, 10.0.0.4, 10.0.0.5, 10.0.0.6</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: frank</title>
		<link>http://deadlytechnology.com/php/ip-address-script/comment-page-1/#comment-710</link>
		<dc:creator>frank</dc:creator>
		<pubDate>Tue, 07 Sep 2010 10:25:26 +0000</pubDate>
		<guid isPermaLink="false">http://deadlytechnology.com/scripts/php/ip-address-script/#comment-710</guid>
		<description>Thanks Jen, good spotting, all fixed.</description>
		<content:encoded><![CDATA[<p>Thanks Jen, good spotting, all fixed.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jen</title>
		<link>http://deadlytechnology.com/php/ip-address-script/comment-page-1/#comment-354</link>
		<dc:creator>Jen</dc:creator>
		<pubDate>Wed, 15 Apr 2009 09:19:36 +0000</pubDate>
		<guid isPermaLink="false">http://deadlytechnology.com/scripts/php/ip-address-script/#comment-354</guid>
		<description>Thanks for the function btw, its been really useful, one small tweak though....

instead of 
&#039;/&#039;.$ipregex.&#039;/&#039;

should be:
&#039;/^&#039;.$ipregex.&#039;/&#039;

Only because if an allowed IP was 
$ip[] = &#039;&#039;211.*.*.*&#039;&#039;;

it would also allow an IP of 74.192.211.23</description>
		<content:encoded><![CDATA[<p>Thanks for the function btw, its been really useful, one small tweak though&#8230;.</p>
<p>instead of<br />
&#8216;/&#8217;.$ipregex.&#8217;/&#8217;</p>
<p>should be:<br />
&#8216;/^&#8217;.$ipregex.&#8217;/&#8217;</p>
<p>Only because if an allowed IP was<br />
$ip[] = &#8221;211.*.*.*&#8221;;</p>
<p>it would also allow an IP of 74.192.211.23</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Luke Eckley</title>
		<link>http://deadlytechnology.com/php/ip-address-script/comment-page-1/#comment-159</link>
		<dc:creator>Luke Eckley</dc:creator>
		<pubDate>Wed, 15 Oct 2008 15:20:13 +0000</pubDate>
		<guid isPermaLink="false">http://deadlytechnology.com/scripts/php/ip-address-script/#comment-159</guid>
		<description>Thanks for the great PHP tip.</description>
		<content:encoded><![CDATA[<p>Thanks for the great PHP tip.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: du</title>
		<link>http://deadlytechnology.com/php/ip-address-script/comment-page-1/#comment-158</link>
		<dc:creator>du</dc:creator>
		<pubDate>Fri, 17 Aug 2007 14:08:20 +0000</pubDate>
		<guid isPermaLink="false">http://deadlytechnology.com/scripts/php/ip-address-script/#comment-158</guid>
		<description>thank you. I was trying to make this on my own when I came across yours. Why do more work :) Very nice, short, and simple.

du</description>
		<content:encoded><![CDATA[<p>thank you. I was trying to make this on my own when I came across yours. Why do more work :) Very nice, short, and simple.</p>
<p>du</p>
]]></content:encoded>
	</item>
</channel>
</rss>

