<?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: Disable Direct Access to a Script With PHP</title>
	<atom:link href="http://fwebde.com/php/disable-direct-script-access/feed/" rel="self" type="application/rss+xml" />
	<link>http://fwebde.com/php/disable-direct-script-access/</link>
	<description>Helping people to make fantastic websites, whether you are a designer, a developer, or someone just who loves websites.</description>
	<lastBuildDate>Fri, 15 Jul 2011 11:19:41 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
	<item>
		<title>By: Jim</title>
		<link>http://fwebde.com/php/disable-direct-script-access/comment-page-1/#comment-3758</link>
		<dc:creator>Jim</dc:creator>
		<pubDate>Fri, 11 Feb 2011 08:48:17 +0000</pubDate>
		<guid isPermaLink="false">http://fwebde.com/?p=1743#comment-3758</guid>
		<description>That saved my day! Thanks for sharing this :)</description>
		<content:encoded><![CDATA[<p>That saved my day! Thanks for sharing this :)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: khen</title>
		<link>http://fwebde.com/php/disable-direct-script-access/comment-page-1/#comment-3503</link>
		<dc:creator>khen</dc:creator>
		<pubDate>Thu, 16 Dec 2010 18:45:39 +0000</pubDate>
		<guid isPermaLink="false">http://fwebde.com/?p=1743#comment-3503</guid>
		<description>heheheh.....

i wonder, how we should send &quot;xmlhttprequest&quot; to the restricted page?</description>
		<content:encoded><![CDATA[<p>heheheh.....</p>
<p>i wonder, how we should send "xmlhttprequest" to the restricted page?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Chris</title>
		<link>http://fwebde.com/php/disable-direct-script-access/comment-page-1/#comment-2114</link>
		<dc:creator>Chris</dc:creator>
		<pubDate>Wed, 27 Oct 2010 17:42:34 +0000</pubDate>
		<guid isPermaLink="false">http://fwebde.com/?p=1743#comment-2114</guid>
		<description>You might want to change it to or instead of and in your if statement.

If HTTP_X_REQUESTED_WITH can be spoofed, then all someone needs to do is spoof if and it will bypass the defined check.</description>
		<content:encoded><![CDATA[<p>You might want to change it to or instead of and in your if statement.</p>
<p>If HTTP_X_REQUESTED_WITH can be spoofed, then all someone needs to do is spoof if and it will bypass the defined check.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: kayne</title>
		<link>http://fwebde.com/php/disable-direct-script-access/comment-page-1/#comment-2051</link>
		<dc:creator>kayne</dc:creator>
		<pubDate>Tue, 07 Sep 2010 05:49:56 +0000</pubDate>
		<guid isPermaLink="false">http://fwebde.com/?p=1743#comment-2051</guid>
		<description>Great code! but both pieces of code need the closing ) 

if (!defined(&#039;BASEPATH&#039;) exit(&#039;Nothing to see here.&#039;);

needs to be

if (!defined(&#039;BASEPATH&#039;)) exit(&#039;Nothing to see here.&#039;);

and so on.</description>
		<content:encoded><![CDATA[<p>Great code! but both pieces of code need the closing ) </p>
<p>if (!defined('BASEPATH') exit('Nothing to see here.');</p>
<p>needs to be</p>
<p>if (!defined('BASEPATH')) exit('Nothing to see here.');</p>
<p>and so on.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Maïs</title>
		<link>http://fwebde.com/php/disable-direct-script-access/comment-page-1/#comment-1713</link>
		<dc:creator>Maïs</dc:creator>
		<pubDate>Wed, 02 Jun 2010 10:43:32 +0000</pubDate>
		<guid isPermaLink="false">http://fwebde.com/?p=1743#comment-1713</guid>
		<description>Thanks I was looking for that. 

But in my application I have some page that are get by iframe, so i&#039;ve add one more line and it&#039;s appear to work as i want:

if (!defined(&#039;BASEPATH&#039;) &amp;&amp;
    strtolower($_SERVER[&#039;HTTP_X_REQUESTED_WITH&#039;]) != &#039;xmlhttprequest&#039;) {
    if ($_SERVER[&#039;HTTP_REFERER&#039;] != &quot;http://---adress of my homepage---&quot;)  {
exit(&#039;Nothing to see here.&#039;);
}
}</description>
		<content:encoded><![CDATA[<p>Thanks I was looking for that. </p>
<p>But in my application I have some page that are get by iframe, so i've add one more line and it's appear to work as i want:</p>
<p>if (!defined('BASEPATH') &amp;&amp;<br />
    strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) != 'xmlhttprequest') {<br />
    if ($_SERVER['HTTP_REFERER'] != "http://---adress of my homepage---")  {<br />
exit('Nothing to see here.');<br />
}<br />
}</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Amatoc Industries</title>
		<link>http://fwebde.com/php/disable-direct-script-access/comment-page-1/#comment-1334</link>
		<dc:creator>Amatoc Industries</dc:creator>
		<pubDate>Mon, 08 Mar 2010 08:00:18 +0000</pubDate>
		<guid isPermaLink="false">http://fwebde.com/?p=1743#comment-1334</guid>
		<description>I have to wonder if there is any way to spoof the $_SERVER[&#039;HTTP_X_REQUESTED_WITH&#039;]...</description>
		<content:encoded><![CDATA[<p>I have to wonder if there is any way to spoof the $_SERVER['HTTP_X_REQUESTED_WITH']...</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Don Gilbert</title>
		<link>http://fwebde.com/php/disable-direct-script-access/comment-page-1/#comment-1035</link>
		<dc:creator>Don Gilbert</dc:creator>
		<pubDate>Sat, 30 Jan 2010 18:45:24 +0000</pubDate>
		<guid isPermaLink="false">http://fwebde.com/?p=1743#comment-1035</guid>
		<description>This answers my question perfectly. I appreciate your hard work in getting and posting this information.

Have a great day!</description>
		<content:encoded><![CDATA[<p>This answers my question perfectly. I appreciate your hard work in getting and posting this information.</p>
<p>Have a great day!</p>
]]></content:encoded>
	</item>
</channel>
</rss>

