Try something like:
function authentification($login,$mdp){
$Log_query = mysql_query("SELECT user_id FROM reg_users WHERE username ='$login' AND password ='$mdp'") or die(mysql_error());
//The user should be unique, not more than 0
if($Log_query && mysql_num_rows($Log_query) === 1){
while ($Res_user = mysql_fetch_array($Log_query) ) {
$user = $Res_user['user_id'];
}
return $user;
}else{
return 0;
}
}
You should also escape $login
and $mdp
with:
mysql_real_escape_string($var);