Ver Mensaje Individual
  #1 (permalink)  
Antiguo 16/01/2010, 11:15
claudia_1109
 
Fecha de Ingreso: mayo-2008
Ubicación: Chihuahua
Mensajes: 30
Antigüedad: 16 años
Puntos: 1
Prevención contra inyección de código SQL

Hola a todos!
Encontre en St. Google un código que supuestamente previene la inyección de código SQL es este:

Código PHP:
<?php
if(is_array($_GET) )
{
foreach (
$_GET as $_GET_nombre=>$_GET_contenido)
{
$_GET[$_GET_nombre]= seguridad_x($_GET_contenido);
}
}
if(
is_array($_POST) )
{
foreach (
$_POST as $_POST_nombre=>$_POST_contenido)
{
$_GET[$_POST_nombre]= seguridad_x($_POST_contenido);
}
}
function 
seguridad_x($texto){
$texto    stripslashes($texto);
$texto    addslashes($texto);
$textoereg_replace(";","",$texto);
$textoereg_replace("<","",$texto);
$textoereg_replace(">","",$texto);
$textoereg_replace("/","",$texto);
$textoereg_replace(':',"",$texto);
return 
$texto;
}
?>
Después insertas el script
Código PHP:
<?
include('no_ataques.php');
//Tu codigo
echo ('hooola Mundo');
?>

Alquien me podría decir si creen en su funcionabilidad, plis :]