scape the login

master
pecesama 2007-07-23 02:49:26 +00:00
parent c37cc7cd41
commit 57a29ee36c
2 changed files with 13 additions and 1 deletions

View File

@ -327,4 +327,16 @@
$dirs = array_unique($dirs);
return $dirs;
}
function sql_escape($value) {
if(get_magic_quotes_gpc()) {
$value = stripslashes($value);
}
if( function_exists("mysql_real_escape_string")) {
$value = mysql_real_escape_string($value);
} else {
$value = addslashes($value);
}
return $value;
}
?>

View File

@ -41,7 +41,7 @@ class user extends Conexion_Mysql {
}
function validateUser($user="", $password="") {
if ($this->ejecutarConsulta("SELECT id_user, login, password FROM ".$this->conf->tablePrefix."users WHERE login='".$user."' AND password='".$password."'")) {
if ($this->ejecutarConsulta("SELECT id_user, login, password FROM ".$this->conf->tablePrefix."users WHERE login='".sql_escape($user)."' AND password='".$password."'")) {
if ($this->contarRegistros()>0) {
$register=$this->obtenerRegistro();
$_SESSION['user_id']=$register["id_user"];