Advertisement
gacanepa

Limpiar valores recibidos del POST

Aug 15th, 2012
144
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.67 KB | None | 0 0
  1.     function clean($str) {
  2.         $str = @trim($str);
  3.         if(get_magic_quotes_gpc()) {
  4.             $str = stripslashes($str);
  5.         }
  6.         return mysql_real_escape_string($str);
  7.     }
  8.    
  9.     //Limpiar los valores recibidos del POST
  10.     $nombre = clean($_POST['nombre']);
  11.     $apellido = clean($_POST['apellido']);
  12.     $telefono = clean($_POST['telefono']);
  13.     $domicilio = clean($_POST['domicilio']);
  14.     $llamamiento = clean($_POST['llamamiento']);
  15.     $agregado_por = clean($_POST['agregado_por']);
  16.    
  17. if ($db_found) {
  18.  
  19.     $SQL = "INSERT INTO contactos_tbl (nombre, apellido, telefono, domicilio, llamamiento, agregado_por) VALUES ('$nombre', '$apellido', '$telefono','$domicilio','$llamamiento','$agregado_por')";
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement