Zend has a new article in their PHP 101 series posted today - PHP 101 (part 13): The Trashman Cometh. In this tutorial they dive into a hot topic in today's security-minded world - input validation.
If you're serious about using PHP for web development, one of the most important things you must learn is how to validate user input and deal with potentially unsafe data. Such input verification is one of the most important safeguards a developer can build into an application, and a failure to do this can snowball into serious problems, or even cause your application to break when it encounters invalid or corrupt data.
They continue on with some examples, ways to ensure your data is not empty, that it's the correct type, that it's a valid date (always a tricky one), and even the use of regular expressions to check for a valid format. Take all of this knowledge, wrap it up in a class, and you'll have their good example of a simple validation class. Now, obviously, this is just a starting point, but, from what I've seen, it's more than a lot of sites worry about...




