<?xml version="1.0" encoding="utf-8" ?><rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/">
<channel>
<title>Limit access to your sNews CMS login page by IP address</title>
<link>http://www.mdj.us/</link>
<description>Use this small hack to limit access to your sNews CMS login page by one or more IP addresses.</description>
<language>en</language>
<item>
<title>Matt</title>
<description></description>
<link>http://www.mdj.us/snews-cms/hacks-mods/limit-access-to-your-snews-cms-login-page-by-ip-address/#comment-433</link>
<pubDate>Thu, 04 Jun 2009 23:05:15 +0000</pubDate>
<content:encoded><![CDATA[Yeah, using .htaccess is easier and cleaner, the main reason I hard-coded it into the snews.php is because I've got the same logic inside the part that actually logs you in, <br />
<br />
i.e.<br />
<br />
if(isset($_POST['Loginform']) &amp;&amp; !_ADMIN) {<br />
    $valid_ips = array(&quot;127.0.0.1&quot;, &quot;192.168.0.1&quot;);<br />
    if(!in_array($_SERVER['REMOTE_ADDR'],$valid_ips)) {<br />
       // deny login attempt<br />
    } else {<br />
       //allow login, do all the login stuff<br />
    }<br />
}<br />
<br />
also, another trick I've done is to rename the login form elements with an md5 hash.]]></content:encoded>
</item>
<item>
<title>slemborg</title>
<description></description>
<link>http://www.mdj.us/snews-cms/hacks-mods/limit-access-to-your-snews-cms-login-page-by-ip-address/#comment-432</link>
<pubDate>Thu, 04 Jun 2009 20:29:27 +0000</pubDate>
<content:encoded><![CDATA[Nice one, I however made mine a bit different back when I wanted this feature, I used the .htaccess file using these lines:<br />
<br />
RewriteCond %{REMOTE_ADDR} !^127\.0\.0\.0*$<br />
RewriteRule ^login[^/]*$ - [F] <br />
<br />
127.0.0.1 used as an example, and ofcourse you could add an array like you did in your mod.<br />
<br />
My way will then give what ever error page you used<br />
where yours is showing the text specified, however, I like your approach too.<br />
<br />
example: <a href="http://b0rgs.net/login/" rel="nofollow">http://b0rgs.net/login/</a>]]></content:encoded>
</item>
</channel>
</rss>

