NameSilo

Clean Input

Spaceship Spaceship
Watch
Impact
11
These are some code snippets for use in cleaning input. Please note that these are NOT the complete security solution; for best results, you should use Whitelist-based authentication.

For AJAX requests:

Code:
foreach ($_POST as $key => $value) 
  $_POST[$key]=trim(strip_tags(urldecode($value)));

For standard forms:

Code:
foreach ($_POST as $key => $value)
  $_POST[$key]=trim(strip_tags($value));

Jason
 
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back