Linux Today: Linux News On Internet Time.

Data Filtering with PHP

Jun 30, 2009, 17:32 (0 Talkback[s])
(Other stories by J. Leidago Noabeb)

"So what exactly do we mean by data validation and why is it so important? Validating data becomes important when your application starts to accept user input. The rule of thumb is not to trust any data that comes from outside your application i.e. from forms or through the browser. While any data that originate from within your application is 'safe'. Any data that comes from outside needs to be 'sanitized' before it is accepted into your application. Example of 'safe' data is:

$myvar = "A safe variable";

"The code above contains a variable that is defined within your application and can therefore be trusted. While the following data cannot be trusted:

$user = $_POST['username'];
$ID = $_GET['id'];"

Complete Story

Related Stories: