From d1c7fa968e9223deff9946225c323f99d573db97 Mon Sep 17 00:00:00 2001 From: dave Date: Sun, 19 Oct 2008 23:14:02 +0000 Subject: [PATCH] - more unneeded user code --- user.inc.php | 27 ++------------------------- 1 file changed, 2 insertions(+), 25 deletions(-) diff --git a/user.inc.php b/user.inc.php index 62f31e7..5bc4686 100644 --- a/user.inc.php +++ b/user.inc.php @@ -109,30 +109,7 @@ function user_load_volunteer(&$u) function user_load($user) { - $id = 0; - - /* Sort out the type first */ - if(is_array($user)){ - /* User already loaded*/ - $id = $user['id']; - $where = "id='$id'"; - } else { - - $id = intval($user); - if($id > 0) { - /* Load by ID FIXME: if we enable load-by-email below, - * then a user could use a number at the beginning of - * their email address to exploit here, must fix that. - * */ - $where = "id='$id'"; - } else { - echo "Can't load user by non-number id"; - return false; - /* Load by email */ -// $e = stripslashes($user); -// $where = "email='$e'"; - } - } + $id = intval($user); /* So, it turns out that doing one big load is faster than loading just * from the users table then loading only the specific types the user @@ -142,7 +119,7 @@ function user_load($user) LEFT JOIN `users_judge` ON `users_judge`.`users_id`=`users`.`id` LEFT JOIN `users_volunteer` ON `users_volunteer`.`users_id`=`users`.`id` LEFT JOIN `users_fair` ON `users_fair`.`users_id`=`users`.`id` - WHERE $where + WHERE `users`.`id`='$id' AND `users`.`deleted`='no' "; $q=mysql_query($query);