<?xml version="1.0" encoding="iso-8859-2"?>
<!-- name="generator" content="pyblosxom/1.0.0 (May 24, 2004)" -->
<!DOCTYPE rss PUBLIC "-//Netscape Communications//DTD RSS 0.91//EN" "http://my.netscape.com/publish/formats/rss-0.91.dtd">

<rss version="0.91">
<channel>
<title>... with flags unfurled... : programming/phpiing   </title>
<link>http://znouza.meinlschmidt.org/blog/programming/phpiing/index.rss</link>
<description>we reached the dizzy heights...</description>
<language>en</language>
<item>
    <title>Simple PHP security patch</title>
    <link>http://znouza.meinlschmidt.org/blog/programming/phpiing/050307-0941.html</link>
    <description>&lt;p&gt;
I&apos;ve created (after some strange experiences with users in my hosting) small
php patch (for version 4.3.10), which disables remote includes.&lt;strong&gt;This patch doesn&apos;t work with Zend Optimizer enabled unfortunately :(&lt;/strong&gt;
&lt;/p&gt;

&lt;p&gt;
Download the patch &lt;a href=&quot;http://orin.meinlschmidt.org/~znouza/php_patch.txt&quot;&gt;there&lt;/a&gt;. 
After applying, see php.ini-dist and readme.security
&lt;/p&gt;

&lt;p&gt;
example of bad code:
&lt;xmp&gt;
&lt;?php
	$page = $_GET[&apos;page&apos;];
	include ($page);
?&gt;
&lt;/xmp&gt;
&lt;/p&gt;

&lt;p&gt;
example of better code:
&lt;xmp&gt;
&lt;?php
	// filter all unneeded characters
	$page = eregi_replace(&quot;[^a-z0-9_]&quot;,&quot;&quot;, $_GET[&apos;page&apos;]).&quot;.inc.php&quot;;

	// test if $page exists and is file
	if (strlen($page) &amp;&amp; @file_exists($page) &amp;&amp; @is_file($page)) {
		require_once ($page);
	}
?&gt;
&lt;/xmp&gt;
&lt;/p&gt;
&lt;p&gt;
Links:
&lt;div class=&quot;box&quot;&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://php.net/include/&quot;&gt;http://php.net/include/&lt;/a&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;/p&gt;
</description>
  </item>
   </channel>
</rss>