From 95712c2e3aa412fed8223b8010ae73441636148e Mon Sep 17 00:00:00 2001 From: Harvie Date: Sat, 8 Jan 2011 22:41:21 +0100 Subject: [PATCH] Login event cleanup --- wwwroot/inc/eventz/login.inc | 37 ++++++++++++++++-------------------- 1 file changed, 16 insertions(+), 21 deletions(-) diff --git a/wwwroot/inc/eventz/login.inc b/wwwroot/inc/eventz/login.inc index 1fb4a04..60aa400 100644 --- a/wwwroot/inc/eventz/login.inc +++ b/wwwroot/inc/eventz/login.inc @@ -20,27 +20,22 @@ function login() { return false; } - switch ($login_type) { - case "name": - $q = "select * from users where login='$login' and $hash_query"; - $set = $db->query($q); - $set->next(); - $user_id = $set->getString('user_id'); - $user_name = $set->getString('login'); - break; - case "base36id": - $login = base_convert($login, 36, 10); - case "id": - // HA! if it is number, escape_string is not enough - $login=intval($login); - - $q="select * from users where user_id='$login' and $hash_query"; - $set=$db->query($q); - $set->next(); - $user_id=$set->getString('user_id'); - $user_name=$set->getString('login'); - break; - } + switch ($login_type) { + case "name": + $q = "select * from users where login='$login' and $hash_query"; + break; + case "base36id": + $login = base_convert($login, 36, 10); + case "id": + $login=intval($login); //HA! if it is number, escape_string is not enough + $q="select * from users where user_id='$login' and $hash_query"; + break; + } + + $set = $db->query($q); + $set->next(); + $user_id = $set->getString('user_id'); + $user_name = $set->getString('login'); if (!$set) { //XXX test $error="Zadal si nespravne uzivatelske meno [alebo id] alebo heslo. Rob so sebou nieco"; -- 2.30.2