viernes, 5 de marzo de 2010

Evitar Inyeccion SQL Hackear

<?
// 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 ]);
}
?>




.

Saber si estas infectado con inyeccion SQL Hackear

<?
if(!isset( $_GET [ "inyeccion" ])){
header ( "location: ?inyeccion='" );
} else {
echo 'Tu servidor ' ;
if( $_GET [ "inyeccion" ] != "'" )echo 'no ' ;
echo 'tiene problemas de inyección' ;
}
?>




.