Tema: consulta md5
Ver Mensaje Individual
  #1 (permalink)  
Antiguo 05/12/2012, 13:18
matt_1985
 
Fecha de Ingreso: enero-2011
Ubicación: /root
Mensajes: 530
Antigüedad: 13 años, 3 meses
Puntos: 61
consulta md5

Tengo un script para comprobar si usuario y contraseña, intento agregarle md5 pero me arroja algunos errores , que hacen referencia a la funcion para evitar la inyeccion de sql:

Código PHP:
$query_login sprintf("SELECT    tb_usuario.usuario, tb_usuario.password, tb_usuario.ip    
                        FROM tb_usuario WHERE usuario = %s AND password = %s"
,
                        
GetSQLValueString($_POST['usuario'], "text"),
                        
GetSQLValueString(md5($_POST['password'], "text"))); 
y esta es mi otra funcion para evitar la inyeccion de sql .

Código PHP:
if (!function_exists("GetSQLValueString")) {
    function 
GetSQLValueString($theValue$theType$theDefinedValue ""$theNotDefinedValue "") {
        if (
PHP_VERSION 6) {
            
$theValue get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
        }
        
$theValue function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
        switch (
$theType) {
            case 
"text":
                
$theValue = ($theValue != "") ? "'" $theValue "'" "NULL";
                  break;    
               case 
"long":
            case 
"int":
                 
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
                break;
            case 
"double":
                
$theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
                break;
            case 
"date":
                
$theValue = ($theValue != "") ? "'" $theValue "'" "NULL";
                break;
            case 
"defined":
                
$theValue = ($theValue != "") ? $theDefinedValue $theNotDefinedValue;
                break;
        }
    return 
$theValue;
    }


Saludos