Ver Mensaje Individual
  #3 (permalink)  
Antiguo 15/04/2009, 15:08
Avatar de farra
farra
 
Fecha de Ingreso: marzo-2008
Ubicación: Aqui estoy
Mensajes: 574
Antigüedad: 16 años, 2 meses
Puntos: 20
Respuesta: Duda sobre seguridad

htmlentities() solo te servira para ataques xss... no te va a salvar de inyecciones sql....

para inyecciones sql debes usar alguna funcion como esta:

Código PHP:
<?php
function antisqlinyection($theValue,$longitudmax) {

  
$theValue get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;

  
$theValue function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

 
$theValue strip_tags($theValue);
 
$theValue substr($theValue0$longitudmax);
 
$theValue htmlentities($theValue);

  return 
$theValue;

}
?>
__________________
Firma:
Es mas dificil para el mono entender que el hombre desciende de el....

PD: Siempre doy karma al que me da una buena respuesta... ;0)

Última edición por farra; 15/04/2009 a las 15:13