Segun en un foro
puedes verificar si tu servidor podria sufrir de este tipo de problema con este codigo.
Código PHP:
if(!isset( $_GET [ "inyeccion" ])){
header ( "location: ?inyeccion='" );
} else {
echo 'Tu servidor ' ;
if( $_GET [ "inyeccion" ] != "'" )echo 'no ' ;
echo 'tiene problemas de inyección' ;
}
y en caso de que tengas el problema
inyeccion.php Código PHP:
<?
// Evitamos la inyeccion SQL
// Modificamos las variables pasadas por URL
foreach( $_GET as $variable => $valor ){
$_GET [ $variable ] = str_replace ( "'" , "'" , $_GET [ $variable ]);
}
// Modificamos las variables de formularios
foreach( $_POST as $variable => $valor ){
$_POST [ $variable ] = str_replace ( "'" , "'" , $_POST [ $variable ]);
}
?>
Y incluiremos este script en todas las páginas en las que realizemos consultas a la base de datos:
Código PHP:
<?
// Evitamos la inyeccion SQL
include 'inyeccion.php' ;
//
// Contenido de la página PHP
//
?>