<?xml version="1.0"?><rss version="2.0"><channel><title>Comments on Writing Secure PHP, Part 2 - AddedBytes.com</title><link>http://www.addedbytes.com/article/writing-secure-php-2/</link><description>Latest comments on Writing Secure PHP, Part 2 on AddedBytes.com</description><!-- ckey="76C662BB" --><item><title>Comment on Writing Secure PHP, Part 2</title><link>http://www.addedbytes.com/article/writing-secure-php-2/comments/</link><guid>http://www.addedbytes.com/article/writing-secure-php-2/comments/</guid><description>Comment by Web ( &lt;a href=""&gt;&lt;/a&gt; )&lt;br /&gt;&lt;br /&gt;Thank you so much for the posts! Very very helpful, I appreciate you for writing these security issues in PHP, I've learned quite a bit! CHEERS!</description></item><item><title>Comment on Writing Secure PHP, Part 2</title><link>http://www.addedbytes.com/article/writing-secure-php-2/comments/</link><guid>http://www.addedbytes.com/article/writing-secure-php-2/comments/</guid><description>Comment by Jamie ( &lt;a href=""&gt;&lt;/a&gt; )&lt;br /&gt;&lt;br /&gt;Great article! Thanks for sharing your knowledge!&lt;br /&gt;&lt;br /&gt;Is there any reason you can't use .htaccess to protect your .inc files (like below) without putting them in an /include folder?&lt;br /&gt;&lt;br /&gt;.htaccess file:&lt;br /&gt;&lt;Files ~ &quot;\.inc$&quot;&gt;&lt;br /&gt;   Order allow,deny&lt;br /&gt;   Deny from all&lt;br /&gt;&lt;/Files&gt;&lt;br /&gt;&lt;br /&gt;I was under the impression this was safe...</description></item><item><title>Comment on Writing Secure PHP, Part 2</title><link>http://www.addedbytes.com/article/writing-secure-php-2/comments/</link><guid>http://www.addedbytes.com/article/writing-secure-php-2/comments/</guid><description>Comment by Malanie ( &lt;a href="http://aber-natuerlich.de"&gt;http://aber-natuerlich.de&lt;/a&gt; )&lt;br /&gt;&lt;br /&gt;Good article. Event it is from 2005 the issues are still there. Advanced search technics like google's inurl makes it realy easy to find sites which use include folder, .inc files or whatever you are interestet in.</description></item><item><title>Comment on Writing Secure PHP, Part 2</title><link>http://www.addedbytes.com/article/writing-secure-php-2/comments/</link><guid>http://www.addedbytes.com/article/writing-secure-php-2/comments/</guid><description>Comment by Alan Walker ( &lt;a href="http://www.highforce.com"&gt;http://www.highforce.com&lt;/a&gt; )&lt;br /&gt;&lt;br /&gt;I have found the best way for looking at input, is to check the value for http or the length of the input as well as commands that should not be in there like ? = , as these script kiddies will do anything to hack your programs.&lt;br /&gt;All the best from Alan</description></item><item><title>Comment on Writing Secure PHP, Part 2</title><link>http://www.addedbytes.com/article/writing-secure-php-2/comments/</link><guid>http://www.addedbytes.com/article/writing-secure-php-2/comments/</guid><description>Comment by Anonymous ( &lt;a href=""&gt;&lt;/a&gt; )&lt;br /&gt;&lt;br /&gt;I do like this.. at the top of the include file.&lt;br /&gt;&lt;br /&gt;if ($ping != &quot;pong&quot;)&lt;br /&gt;{      &lt;br /&gt;    echo 'Redirect here, or print something :p';&lt;br /&gt;    exit;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;then in the script that's including it:&lt;br /&gt;&lt;br /&gt;$ping = &quot;pong&quot;;&lt;br /&gt;include(yourfile.....);&lt;br /&gt;&lt;br /&gt;Seems to work fine too.</description></item><item><title>Comment on Writing Secure PHP, Part 2</title><link>http://www.addedbytes.com/article/writing-secure-php-2/comments/</link><guid>http://www.addedbytes.com/article/writing-secure-php-2/comments/</guid><description>Comment by Frederik ( &lt;a href="http://www.misterbob.nl"&gt;http://www.misterbob.nl&lt;/a&gt; )&lt;br /&gt;&lt;br /&gt;Don't use safe mode, it will be dropped in PHP6</description></item><item><title>Comment on Writing Secure PHP, Part 2</title><link>http://www.addedbytes.com/article/writing-secure-php-2/comments/</link><guid>http://www.addedbytes.com/article/writing-secure-php-2/comments/</guid><description>Comment by alex boia ( &lt;a href=""&gt;&lt;/a&gt; )&lt;br /&gt;&lt;br /&gt;ok..so there are a lot of comments and so little time for me to read them. so i'm sorry if what that the topic this reply adresses has been already covered. but enough with the smalltalk.:)&lt;br /&gt;what i wnat to say is that if you want to protect your inlcuded php files to be executed from outside the script that uses them you can use something like:&lt;br /&gt;&lt;?php&lt;br /&gt;   define ('IS_INCLUDED_SOMEFILE', true);&lt;br /&gt;   require_once 'somefile.php';&lt;br /&gt;?&gt;&lt;br /&gt;in the script that requires the file and&lt;br /&gt;&lt;?php&lt;br /&gt;   if (!defined('IS_INCLUDED_SOMEFILE')) exit;&lt;br /&gt;   if (IS_INCLUDED_SOMEFILE !== true) exit;&lt;br /&gt;?&gt;&lt;br /&gt;in the required file.&lt;br /&gt;works very fine, as you define this constant only where you need to include the files&lt;br /&gt;?&gt;</description></item><item><title>Comment on Writing Secure PHP, Part 2</title><link>http://www.addedbytes.com/article/writing-secure-php-2/comments/</link><guid>http://www.addedbytes.com/article/writing-secure-php-2/comments/</guid><description>Comment by shopje ( &lt;a href="http://www.shopje.net"&gt;http://www.shopje.net&lt;/a&gt; )&lt;br /&gt;&lt;br /&gt;This one is a bit an expansion and elaboration to former part1 .&lt;br /&gt;I missed the usefull code examples you used in part 1.&lt;br /&gt;How about buffer overflows?&lt;br /&gt;Maybe you could be elaborating cross site scripting attacks?&lt;br /&gt;More methods of sql injection?&lt;br /&gt;Maybe a &quot;best way to secure&quot; part with the code examples to use for the newbies among us.&lt;br /&gt;And please get that link for a printable version.&lt;br /&gt;I of to read part 3</description></item><item><title>Comment on Writing Secure PHP, Part 2</title><link>http://www.addedbytes.com/article/writing-secure-php-2/comments/</link><guid>http://www.addedbytes.com/article/writing-secure-php-2/comments/</guid><description>Comment by Dave Child ( &lt;a href="http://www.addedbytes.com"&gt;http://www.addedbytes.com&lt;/a&gt; )&lt;br /&gt;&lt;br /&gt;Hi Keith.&lt;br /&gt;&lt;br /&gt;It's not the code that is the risk, it's what the code can do. Administration files can delete and modify information, and administration areas have the same capabilities - someone managing to access these files could cause serious problems to a site.</description></item><item><title>Comment on Writing Secure PHP, Part 2</title><link>http://www.addedbytes.com/article/writing-secure-php-2/comments/</link><guid>http://www.addedbytes.com/article/writing-secure-php-2/comments/</guid><description>Comment by Keith ( &lt;a href=""&gt;&lt;/a&gt; )&lt;br /&gt;&lt;br /&gt;Quote: &quot;Placing important files in predictable places with predictable names is a recipe for disaster.&quot; &lt;br /&gt;&lt;br /&gt;As long as I name my files .php what is the problem?  I have seen several sites that tell you to put the includes outsite of the root, but I have not seen an explanation as to why this is critical - as long as the file is parsed?&lt;br /&gt;&lt;br /&gt;Thanks.</description></item></channel></rss>