Posted By

sjacunningham on 10/14/10


Tagged

php variables sanitize


Versions (?)

Who likes this?

2 people have marked this snippet as a favorite

pytheas
mmcachran


PHP sanitize variables


 / Published in: PHP
 

  1. //SANITIZE ALL DATA
  2. $_GET = array_map('trim', $_GET);
  3. $_POST = array_map('trim', $_POST);
  4. $_COOKIE = array_map('trim', $_COOKIE);
  5. $_REQUEST = array_map('trim', $_REQUEST);
  6. $_GET = array_map('stripslashes', $_GET);
  7. $_POST = array_map('stripslashes', $_POST);
  8. $_COOKIE = array_map('stripslashes', $_COOKIE);
  9. $_REQUEST = array_map('stripslashes', $_REQUEST);
  10. endif;
  11. $_GET = array_map('mysql_real_escape_string', $_GET);
  12. $_POST = array_map('mysql_real_escape_string', $_POST);
  13. $_COOKIE = array_map('mysql_real_escape_string', $_COOKIE);
  14. $_REQUEST = array_map('mysql_real_escape_string', $_REQUEST);

Report this snippet  

You need to login to post a comment.