<?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"
	>
<channel>
	<title>Comments on: Control htaccess Basic Authentication with PHP and mod_rewrite</title>
	<atom:link href="http://www.askapache.com/htaccess/tricks-for-controlling-htaccess-basic-authentication-with-php-and-mod_rewrite.html/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.askapache.com/htaccess/tricks-for-controlling-htaccess-basic-authentication-with-php-and-mod_rewrite.html</link>
	<description>Web Development</description>
	<pubDate>Fri, 29 Aug 2008 19:17:03 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6.1</generator>
		<item>
		<title>By: John Drummond</title>
		<link>http://www.askapache.com/htaccess/tricks-for-controlling-htaccess-basic-authentication-with-php-and-mod_rewrite.html#comment-37070</link>
		<dc:creator>John Drummond</dc:creator>
		<pubDate>Tue, 11 Mar 2008 10:35:19 +0000</pubDate>
		<guid isPermaLink="false">http://www.askapache.com.com/htaccess/tricks-for-controlling-htaccess-basic-authentication-with-php-and-mod_rewrite.html#comment-37070</guid>
		<description>At last, I found this at AlistApart: &lt;a href="http://alistapart.com/articles/succeed" rel="nofollow"&gt;How to Succeed With URLs&lt;/a&gt;

&lt;pre&gt;&lt;br /&gt;
session_start();&lt;br /&gt;
if (session_is_registered(pdb_sessname))&lt;br /&gt;
{&lt;br /&gt;
&#160;&#160;if(file_exists($DOCUMENT_ROOT.$REQUEST_URI) and&lt;br /&gt;
($SCRIPT_FILENAME!=$DOCUMENT_ROOT.$REQUEST_URI) and ($REQUEST_URI!=&#34;/&#34;))&lt;br /&gt;
&#160;&#160;{&lt;br /&gt;
&#160;&#160;&#160;&#160;$url=$REQUEST_URI;&lt;br /&gt;
&#160;&#160;&#160;&#160;include($DOCUMENT_ROOT.$url);&lt;br /&gt;
&#160;&#160;&#160;&#160;exit();&lt;br /&gt;
&#160;&#160;}&lt;br /&gt;
}&lt;br /&gt;
&lt;/pre&gt;</description>
		<content:encoded><![CDATA[<p>At last, I found this at AlistApart: <a href="http://alistapart.com/articles/succeed" rel="nofollow">How to Succeed With URLs</a></p>
<pre>
session_start();
if (session_is_registered(pdb_sessname))
{
&nbsp;&nbsp;if(file_exists($DOCUMENT_ROOT.$REQUEST_URI) and
($SCRIPT_FILENAME!=$DOCUMENT_ROOT.$REQUEST_URI) and ($REQUEST_URI!=&quot;/&quot;))
&nbsp;&nbsp;{
&nbsp;&nbsp;&nbsp;&nbsp;$url=$REQUEST_URI;
&nbsp;&nbsp;&nbsp;&nbsp;include($DOCUMENT_ROOT.$url);
&nbsp;&nbsp;&nbsp;&nbsp;exit();
&nbsp;&nbsp;}
}
</pre>
]]></content:encoded>
	</item>
	<item>
		<title>By: Alfred</title>
		<link>http://www.askapache.com/htaccess/tricks-for-controlling-htaccess-basic-authentication-with-php-and-mod_rewrite.html#comment-21643</link>
		<dc:creator>Alfred</dc:creator>
		<pubDate>Fri, 05 Oct 2007 06:59:50 +0000</pubDate>
		<guid isPermaLink="false">http://www.askapache.com.com/htaccess/tricks-for-controlling-htaccess-basic-authentication-with-php-and-mod_rewrite.html#comment-21643</guid>
		<description>I would like to implement the AddHandler tip to restrict access to CONTENT.HTML (and other HTML files) to authorised users.

Content of .htaccess:

&lt;blockquote cite=""&gt;
&lt;code&gt;&lt;br /&gt;
AddHandler mywrapper .html&lt;br /&gt;
Action mywrapper /secure.php&lt;br /&gt;
&lt;/code&gt;
&lt;/blockquote&gt;

Contents of secure.php:
&lt;blockquote cite=""&gt;
&lt;code&gt;&lt;br /&gt;
session_start();&lt;br /&gt;
if(!$_SESSION[&#039;authorised&#039;]){&lt;br /&gt;
&#160;&#160;die(&#039;You are not authorised to access this content!&#039;);&lt;br /&gt;
} else {&lt;br /&gt;
&#160;&#160;// THIS IS WHERE I DONT KNOW WHAT TO DO&lt;br /&gt;
}&lt;br /&gt;
&lt;/code&gt;
&lt;/blockquote&gt;

How do I get CONTENT.HTML to display if $_SESSION['authorised'] is &lt;code&gt;true&lt;/code&gt;?</description>
		<content:encoded><![CDATA[<p>I would like to implement the AddHandler tip to restrict access to CONTENT.HTML (and other HTML files) to authorised users.</p>
<p>Content of .htaccess:</p>
<blockquote cite=""><p>
<code><br />
AddHandler mywrapper .html<br />
Action mywrapper /secure.php<br />
</code>
</p></blockquote>
<p>Contents of secure.php:</p>
<blockquote cite=""><p>
<code><br />
session_start();<br />
if(!$_SESSION[&#039;authorised&#039;]){<br />
&nbsp;&nbsp;die(&#039;You are not authorised to access this content!&#039;);<br />
} else {<br />
&nbsp;&nbsp;// THIS IS WHERE I DONT KNOW WHAT TO DO<br />
}<br />
</code>
</p></blockquote>
<p>How do I get CONTENT.HTML to display if $_SESSION['authorised'] is <code>true</code>?</p>
]]></content:encoded>
	</item>
</channel>
</rss>
