jueves, 17 de julio de 2014

Evitar la inyeccion SQL

        // Evitamos la inyeccion SQL

        // Modificamos las variables pasadas por GET
        foreach( $_GET as $variable => $valor )
        {
            $_GET[$variable]=str_replace("'", "",$_GET[$variable]);
            $_GET[$variable]=str_replace("\"", "",$_GET[$variable]);
            $_GET[$variable]=str_replace("`", "",$_GET[$variable]);
            $_GET[$variable]=str_replace("´", "",$_GET[$variable]);
        }
       
        // Modificamos las variables pasadas por POST
        foreach( $_POST as $variable => $valor )
        {
            $_POST[$variable]=str_replace("'","",$_POST[$variable]);
            $_POST[$variable]=str_replace("\"","",$_POST[$variable]);
            $_POST[$variable]=str_replace("`","",$_POST[$variable]);
            $_POST[$variable]=str_replace("´","",$_POST[$variable]);
        }       
        





.

No hay comentarios: