News Feed
Sections




News Archive
Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

PHPMaster.com:
Input Validation Using Filter Functions
June 01, 2012 @ 15:53:28

On PHPMaster.com today there's a good tutorial that gives you some methods to do one of the most important things in any application - validating input. Their examples show how to use some of PHP's own filter functions to accomplish this.

Filter functions in PHP might not be sexy, but they can improve the stability, security, and even maintainability of your code if you learn how to use them correctly. In this article I'll explain why input validation is important, why using PHPs built-in functions for performing input validation is important, and then throw together some examples (namely using filter_input() and filter_var()), discuss some potential pitfalls, and finish with a nice, juicy call to action.

He talks about why validation is important to protect your application (and users) from malicious things like cross-site scripting. He emphasizes the use of PHP's own filter methods because they are established and, well, included in the language - no additional libraries needed. Example code is included showing how to use them to filter email addresses and check that something is an integer.

You can find out more about these functions on their manual pages: filter_input, filter_var.

0 comments voice your opinion now!
input validation filter tutorial bestpractice filtervar filterinput


blog comments powered by Disqus

Similar Posts

Nils Luxton's Blog: Installing PHP 5.4.0alpha1 into Wampserver

DevShed: Handling Entries for a Blogger Built with PHP

Felix Geisendörfer's Blog: How to Plugin'ize Your App

Oracle Technology Network: Creating an Ajax Process Using PHP and Oracle

Cory Fowler: Enabling PHP 5.4 in Windows Azure Web Sites


Community Events





Don't see your event here?
Let us know!


opinion application introduction language series voicesoftheelephpant laravel podcast framework symfony version tool update interview community package library composer release security

All content copyright, 2014 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework