<?xml version="1.0"?>
<rss version="2.0">
  <channel>
    <title>PHPDeveloper.org</title>
    <link>http://www.phpdeveloper.org</link>
    <description>Up-to-the Minute PHP News, views and community</description>
    <language>en-us</language>
    <pubDate>Wed, 23 May 2012 04:53:10 -0500</pubDate>
    <ttl>30</ttl>
    <item>
      <title><![CDATA[Reddit.com: Protecting against attack?]]></title>
      <guid>http://www.phpdeveloper.org/news/17978</guid>
      <link>http://www.phpdeveloper.org/news/17978</link>
      <description><![CDATA[<p>
In <a href="http://www.reddit.com/r/PHP/comments/tnval/protecting_against_attack/">this recent post</a> to Reddit.com, the question of application security is asked - the poster wants recommendations on how he should keep his app safe from would-be attackers:
</p>
<blockquote>
I can code fairly well in PHP these days, but my security isn't so hot. Is there a tutorial or plugin you guys can recommend as to how I should be protecting my php pages/inputs? I want to avoid common attacks like XSS, inputs with NULL or DROP TABLE etc?
</blockquote>
<p>
Responses <a href="http://www.reddit.com/r/PHP/comments/tnval/protecting_against_attack/">on the post</a> include recommendations related to:
</p>
<ul>
<li>Using the <a href="https://chorizo-scanner.com/">Chorizo scanner</a> to find common issues in your code
<li>Using PDO for database connections (with bound parameters)
<li>Not trusting "$_SERVER" 
<li>Data sanitization
</ul>
<p>
There's also links to <a href="http://phpmaster.com/php-security-cross-site-scripting-attacks-xss/">a few</a> <a href="https://www.owasp.org/index.php/Category:OWASP_Enterprise_Security_API">other</a> <a href="http://stackoverflow.com/questions/1732348/regex-match-open-tags-except-xhtml-self-contained-tags/1732454#1732454">resources</a> with more details.
</p>]]></description>
      <pubDate>Fri, 18 May 2012 10:19:35 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[PHPMaster.com: PHP Security: Cross-Site Scripting Attacks (XSS)]]></title>
      <guid>http://www.phpdeveloper.org/news/17890</guid>
      <link>http://www.phpdeveloper.org/news/17890</link>
      <description><![CDATA[<p>
PHPMaster.com has a new tutorial posted today (by <i>George Fekete</i>) about <a href="http://phpmaster.com/php-security-cross-site-scripting-attacks-xss/">preventing cross-site scripting attacks</a> in your PHP-based applications.
</p>
<blockquote>
Unfortunately, cross-site scripting attacks occurs mostly, because developers are failing to deliver secure code. Every PHP programmer has the responsibility to understand how attacks can be carried out against their PHP scripts to exploit possible security vulnerabilities. Reading this article, you'll find out more about cross-site scripting attacks and how to prevent them in your code.
</blockquote>
<p>
Included in the tutorial is an example with a simple form and definitions of different types of XSS attacks - reflected XSS, persistent XSS and three ways to prevent them: data filtering, output filtering and data validation. He also links to a few "cheatsheets" to help even more (including <a href="http://ha.ckers.org/xss.html">this guide</a> and a Zend Framework set of <a href="http://www.zfsnippets.com/snippets/view/id/5">XSS test data</a>.
</p>]]></description>
      <pubDate>Tue, 01 May 2012 11:59:28 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Joshua Thijssen's Blog: Bloom Filters]]></title>
      <guid>http://www.phpdeveloper.org/news/17792</guid>
      <link>http://www.phpdeveloper.org/news/17792</link>
      <description><![CDATA[<p>
In <a href="http://www.adayinthelifeof.nl/2012/04/09/bloom-filters/">this new post</a> to his blog <i>Joshua Thijssen</i> describes something that can help when processing large amounts of data (like, in his example, the text of a book) to search through the information and find if a certain piece of data is in the set - a bloom filter.
</p>
<blockquote>
Most of my co-workers never really heard of bloom filters, and I'm continuously need to explain what they are, what their purpose is and why it's a better solution than other ones. So let's do an introduction on bloom filters. [...] Bloom filters have the property of being exceptionally fast AND exceptionally small compared to other structures but it comes with a price: it MIGHT be possible that our bloom filter thinks that an element is inside our set, when it really isn't. Luckily, the reverse is not possible: when a bloom filter says something is NOT in the set, you are 100% sure that it isn't part of the set.
</blockquote>
<p>
He explains how the filter works, noting how it's better for memory consumption and how it's possible for it to give a "maybe" response instead of ab absolute "yes" or "no". He also points out <a href="http://pecl.php.net/package/bloomy">a PHP extension, bloomy</a> that takes the hard work out of it for you.
</p>]]></description>
      <pubDate>Mon, 09 Apr 2012 11:13:32 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[NetTuts.com: Create Instagram Filters With PHP]]></title>
      <guid>http://www.phpdeveloper.org/news/17728</guid>
      <link>http://www.phpdeveloper.org/news/17728</link>
      <description><![CDATA[<p>
On NetTuts.com there's a new tutorial showing how you can <a href="http://net.tutsplus.com/tutorials/php/create-instagram-filters-with-php/">create Instagram-like filters</a> in PHP using the <a href="http://www.imagemagick.org/script/index.php">ImageMagick</a> library/extension.
</p>
<blockquote>
PHP comes bundled with <a href="http://www.php.net/manual/en/book.image.php">GD</a> (GIF Draw/Graphics Draw), which is a library for the dynamic creation of images. It can be used for simpler image operation, such as resizing, cropping, adding watermarks, <a href="http://net.tutsplus.com/articles/news/how-to-dynamically-create-thumbnails/">creating thumbnails</a> (Jeffrey wrote about it), applying basic photo filters - you've probably used it before. Unfortunately, if you want to create something more complex with GD, like Instagram effects, you can't. Luckily, though, we have ImageMagick!
</blockquote>
<p>
He starts off by comparing the two graphics libraries and talks briefly about <a href="http://www.imagemagick.org/script/binary-releases.php">how to downliad</a> and install Imagemagick on your development platform. Included is a PHP class to help you use it, coming complete with functions for changing the color tone of the image, adding a border and adding a <a href="http://en.wikipedia.org/wiki/Vignetting">vignette</a> to the image. Also included are some "presets" represented in a few simple functions:
</p>
<ul>
<li>Gotham
<li>Toaster
<li>Nashville
<li>Lomo
<li>Kelvin
</ul>
<p>
There's also a few links to other resources you can use to find out more details on what Imagemagick has to offer.
</p>]]></description>
      <pubDate>Mon, 26 Mar 2012 10:07:37 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[PHPMaster.com: ClamAV as a Validation Filter in Zend Framework]]></title>
      <guid>http://www.phpdeveloper.org/news/17365</guid>
      <link>http://www.phpdeveloper.org/news/17365</link>
      <description><![CDATA[<p>
New on PHPMaster.com there's a tutorial showing you how to use <a href="http://www.clamav.net/lang/en/">ClamAV</a> support to <a href="http://phpmaster.com/zf-clamav/">work as a validation filter</a> in a Zend Framework application. ClamAV is an open source project that helps identify malicious threats like trojeans, viruses and malware.
</p>
<blockquote>
Ok, so you're pretty comfortable with using the Zend Framework, specifically the use of Forms. Along with that, you have a good working knowledge of how to combine a host of <a href="http://framework.zend.com/manual/en/zend.validate.html">standard validators</a> [...] but what do you do when a situation arises that's outside the scope of the pre-packaged validators and filters? Let's say you want to guard against users uploading files that contain viruses, for example. You would have to write a custom validator that checks the uploads aren't infected.
</blockquote>
<p>
You'll need to install the <a href="http://sourceforge.net/projects/php-clamav">ClamAV extension</a> on your loal machine for the feature to work. Once it's there, though, it's as simple as setting up the validator (based on Zend_Validate_Abstract) and calling the "cl_scanfile" method on the uploaded file. Also included is the code for a sample controller with a Zend_Form instance and an upload file field to help prove it's working.
</p>]]></description>
      <pubDate>Mon, 09 Jan 2012 12:20:48 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[Jake Smith's Blog: Callback Filter Iterator in PHP 5.3/5.4]]></title>
      <guid>http://www.phpdeveloper.org/news/17202</guid>
      <link>http://www.phpdeveloper.org/news/17202</link>
      <description><![CDATA[<p>
<i>Jake Smith</i> has a new post to his blog today about a feature included in PHP's <a href="http://php.net/spl">Standard PHP Library</a> that you might have overlooked - <a href="http://jakefolio.com/2011/12/callback-filter-iterator-in-php/">the FilterIterator's callback functionality</a>.
</p>
<blockquote>
The Filter Iterator is probably my second favorite iterator, next to Directory Iterator.  There are many great use cases for the Filter Iterator, and when you do filter the original data is left untouched. A Filter Iterator is really simple to use, create a class that extends FilterIterator and adjust the accept method to meet your criteria.  This is great and all, but having the ability to create filter iterators on the fly, ones that won't be used application wide, without having to create a class is even better.
</blockquote>
<p>
He includes a bit of code defining a FilterCallbackIterator class with a "callback" parameter passed into the constructor (in his case, a closure). Also included is some sample code of it in use - handling an array (well, ArrayIterator) with a simple true/false check on the current array value. You can find out more about this functionality in <a href="http://www.php.net/manual/en/class.callbackfilteriterator.php">the PHP manual</a>.
</p>]]></description>
      <pubDate>Fri, 02 Dec 2011 08:44:34 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[Reddit.com: How do YOU sanitize input?]]></title>
      <guid>http://www.phpdeveloper.org/news/17082</guid>
      <link>http://www.phpdeveloper.org/news/17082</link>
      <description><![CDATA[<p>
On Reddit.com there's a recent post that asks the question <a href="http://www.reddit.com/r/PHP/comments/luprk/how_do_you_sanitize_input/">How do YOU sanitize input</a> in your PHP applications?
</p>
<blockquote>
I am developing some software for my high school using HTML, CSS, MySQL, and most importantly PHP. [...] So I pose this question, what is YOUR favorite way to sanitize input for inserting, updating, or selecting from a database? Also, is there any way you prefer to verify that input is of a certain type, and only of that type ie, if you're expecting an int or a string, how would you make sure you are receiving one?
</blockquote>
<p>
Answers on <a href="http://www.reddit.com/r/PHP/comments/luprk/how_do_you_sanitize_input/">the post</a> touch on things like:
</p>
<ul>
<li>parametrised queries for databases
<li><a href="http://php.net/filter_var">filter_var</a>/<a href="http://php.net/manual/en/filter.filters.php">filter_types</a>
<li>Sanitized versus "database-safe"
<li>using <a href="http://php.net/pdo">PDO</a>
<li>avoiding the false sense of security things like <a href="http://php.net/mysql_escape_string">mysql_escape_string</a> and <a href="http://php.net/mysql_real_escape_string">mysql_real_escape_string</a>
</ul>]]></description>
      <pubDate>Thu, 03 Nov 2011 11:04:02 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[DeveloperDrive.com: Common Mistakes to Avoid When Coding in PHP]]></title>
      <guid>http://www.phpdeveloper.org/news/17012</guid>
      <link>http://www.phpdeveloper.org/news/17012</link>
      <description><![CDATA[<p>
On the DeveloperDrive.com site today, there's a new post with a few reminders for PHP developers out there of things it's easy to forget when writing your applications - some <a href="http://www.developerdrive.com/2011/10/common-mistakes-to-avoid-when-coding-in-php/">common mistakes to avoid</a>.
</p>
<blockquote>
Despite the high expectations placed on them at times, developers are human. They were the last time we checked anyways. As humans, we are bound to make mistakes from time to time. And simple, common mistakes often slip past our filters the more comfortable we become with something. [...] But knowing what these common mistakes are and how to avoid them can really help speed up the development process and keep our clients smiling.
</blockquote>
<p>
His list includes three big ones that, if forgotten, could end up being detrimental to your application (sooner or later) - poor housekeeping/organization of code, forgetting punctuation and forgetting to validate input from users.
</p>]]></description>
      <pubDate>Wed, 19 Oct 2011 09:17:59 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[DeveloperDrive.com: What Web Developers Need to Know About Cross-Site Scripting]]></title>
      <guid>http://www.phpdeveloper.org/news/17002</guid>
      <link>http://www.phpdeveloper.org/news/17002</link>
      <description><![CDATA[<p>
On the DeveloperDrive.com site there's a recent post anyone wondering about cross-site scripting should give a read. They <a href="http://www.developerdrive.com/2011/10/what-web-developers-need-to-know-about-cross-site-scripting/">introduce you to the basic concept</a> and two things you can do to help prevent them.
</p>
<blockquote>
This little fable describes the most common vulnerability found in web sites, the Cross Site Scripting (XSS) attack. According to a report from <a href="http://www.darkreading.com/security/app-security/showArticle.jhtml?articleID=221601529">WhiteHat Security</a> 83 percent of websites they tested have had at least one serious vulnerability and 66 percent of all websites with vulnerabilities are susceptible to XSS attacks making it the most common vulnerability web developers face. To fix this, it takes 67 days on average. Tools like <a href="http://www.owasp.org/index.php/Main_Page">WebScarab</a> and <a href="http://www.parosproxy.org/index.shtml">Paros Proxy</a> can be used to scan sites for possible vulnerabilities.
</blockquote>
<p>
They offer two simple pieces of advice that it's all too easy to forget when developing applications - validate all user input to ensure it's what it should be and escape any untrusted output (even sometimes your own!) before pushing it out to the page.
</p>]]></description>
      <pubDate>Mon, 17 Oct 2011 13:39:23 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[PHPMaster.com: File Uploads with PHP]]></title>
      <guid>http://www.phpdeveloper.org/news/16907</guid>
      <link>http://www.phpdeveloper.org/news/16907</link>
      <description><![CDATA[<p>
SitePoint's PHPMaster.com site has a new tutorial today from <i>Timothy Boronczky</i> about <a href="http://phpmaster.com/file-uploads-with-php/">handling file uploads</a> in PHP. It's a pretty low-level introduction and is perfect for those new to PHP.
</p>
<blockquote>
What do pictures in an online photo album, email attachments in a web-based mail client, and data files submitted to an online application for batch processing all have in common? They all rely on the ability to upload files across the Internet from the user's web browser. Indeed, uploading files is an important feature of many of the sites and web-based applications we use on a daily basis. In this post, I show you how to add support for file uploads to your site using PHP.
</blockquote>
<p>
He starts with the changes you might need to make to your php.ini configuration file (for allowing uploads and setting a temporary directory) and a basic "form" tag with the necessary "enctype" setting. The sample form includes a "file" type field that submits the file data to a waiting PHP script on the backend. The script looks for the submit (in the $_FILES superglobal) and, after doing some filtering on the name and content type, moves it to a new directory.
</p>]]></description>
      <pubDate>Mon, 26 Sep 2011 11:42:40 -0500</pubDate>
    </item>
  </channel>
</rss>

