News Feed
Jobs 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

SitePoint PHP Blog: Dart and PHP: A Legacy Animal Guess Game

Gonzalo Ayuso's Blog: Real time monitoring PHP applications with websockets and node.js

MakeBeta Blog: Scraping Links With PHP

PHPMaster.com: Integrating Open Authentication using Opauth

The Bakery: Three New Components/Tutorials - Lightroom, DboSource & SMF


Community Events











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


introduction application composer code install symfony2 security hack opinion unittest podcast package example release framework overview hhvm component facebook language

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