Limpiar variables $_POST/$_GET contra SQL Injection PHP


/ Published in: PHP
Save to your folder(s)

Esta funcion limpia un array contra inyección SQL.


Copy this code and paste it in your HTML
  1. function clean_array_for_post($post){
  2. foreach($post as $key => $value){
  3. if(get_magic_quotes_gpc()) $post[$key] = stripslashes($value);
  4. if(!is_numeric($value)) $post[$key] = mysql_real_escape_string($value);
  5. $post[$key] = strip_tags($value);
  6. }
  7. return $post;
  8. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.