filter_var() input validation by PHP

Posted on Friday 6 February 2009

I recently discovered a very useful function in PHP. It‘s called filter_var(). It takes three arguments: a variable and the filter and a last optional argument, the options. The last argument uses an associative array of flags/options or a single flag/option. 

filter_var(variable, filter, options);

I use it in addition to javascript validation. That way when javascript is disabled your web-application is still secure and no unwanted data enters your precious database. I mainly use the filters :

FILTER_SANITIZE_NUMBER_INT

 FILTER_SANITIZE_STRING

FILTER_SANITIZE_EMAIL

FILTER_VALIDATE_EMAIL

FILTER_VALIDATE_INT.

Read more →

filter_var() input validation by PHP

Posted on Friday 6 February 2009

I recently discovered a very useful function in PHP. It‘s called filter_var(). It takes three arguments: a variable and the filter and a last optional argument, the options. The last argument uses an associative array of flags/options or a single flag/option. 

filter_var(variable, filter, options);

I use it in addition to javascript validation. That way when javascript is disabled your web-application is still secure and no unwanted data enters your precious database. I mainly use the filters :

FILTER_SANITIZE_NUMBER_INT

 FILTER_SANITIZE_STRING

FILTER_SANITIZE_EMAIL

FILTER_VALIDATE_EMAIL

FILTER_VALIDATE_INT.

Read more →

SQLbuddy

Posted on Thursday 5 February 2009

This is a nice and worthy opponent for phpMyAdmin and other MySQL tools. It‘s also open source. SQLbuddy is extremely easy to install. You just copy the folder to your webspace and then type in your database information like database name, login, password and database server. That‘s it. It also has SQLlite support. phpMyAdmin is so hideous and not very user-friendly. The layout of SQLbuddy is intuitive and clean. 

Read more →