Posted By

n19ht on 07/28/11


Tagged

sql php variables injection Contra postget Limpiar


Versions (?)

Limpiar variables $_POST/$_GET contra SQL Injection PHP


 / Published in: PHP
 

Esta funcion limpia un array contra inyección SQL.

  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  

You need to login to post a comment.