From 76d73d8db6bfb8ee7b4712681160954f472d61b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20T=C3=A4nzer?= Date: Fri, 16 Sep 2011 04:12:09 +0200 Subject: bug 975: Many fixes to the fix MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - also include accounts without an entry in the email table when searching by id - revert the breakage of an indentation - always use backticks around non-SQL keywords or functions - fix a problem when the primary email had been deleted and readded before - use HTML to do the line breaking for us and fix typo Signed-off-by: Michael Tänzer --- pages/account/43.php | 34 +++++++++++++++++++++++++++------- 1 file changed, 27 insertions(+), 7 deletions(-) (limited to 'pages') diff --git a/pages/account/43.php b/pages/account/43.php index 3a96416..5bd86bf 100755 --- a/pages/account/43.php +++ b/pages/account/43.php @@ -41,9 +41,10 @@ // bug-975 ted+uli changes --- begin if(preg_match("/^[0-9]+$/", $email)) { // $email consists of digits only ==> search for IDs - $query = "select `users`.`id` as `id`, `email`.`email` as `email` from `users`,`email` - where `users`.`id`=`email`.`memid` - and (`email`.`id`='$email' or `users`.`id`='$email') + // Be defensive here (outer join) if primary mail is not listed in email table + $query = "select `users`.`id` as `id`, `email`.`email` as `email` + from `users` left outer join `email` on (`users`.`id`=`email`.`memid`) + where (`email`.`id`='$email' or `users`.`id`='$email') and `users`.`deleted`=0 group by `users`.`id` limit 100"; } else { @@ -149,7 +150,7 @@ { echo "$i"; } ?> @@ -404,7 +405,8 @@ $inconsistencydisp = ""; $inccause = ""; // current userid intval($row['id']) - $query = "select email as uemail, deleted as udeleted, verified, locked from `users` where `id`='".intval($row['id'])."' "; + $query = "select `email` as `uemail`, `deleted` as `udeleted`, `verified`, `locked` + from `users` where `id`='".intval($row['id'])."' "; $dres = mysql_query($query); $drow = mysql_fetch_assoc($dres); $uemail = $drow['uemail']; @@ -412,9 +414,23 @@ $uverified = $drow['verified']; $ulocked = $drow['locked']; - $query = "select hash, deleted as edeleted, email as eemail from `email` where `memid`='".intval($row['id'])."' and email='".$uemail."' "; + $query = "select `hash`, `email` as `eemail` from `email` + where `memid`='".intval($row['id'])."' and + `email` ='".$uemail."' and + `deleted` = 0"; $dres = mysql_query($query); if ($drow = mysql_fetch_assoc($dres)) { + $drow['edeleted'] = 0; + } else { + // try if there are deleted entries + $query = "select `hash`, `deleted` as `edeleted`, `email` as `eemail` from `email` + where `memid`='".intval($row['id'])."' and + `email` ='".$uemail."'"; + $dres = mysql_query($query); + $drow = mysql_fetch_assoc($dres); + } + + if ($drow) { $eemail = $drow['eemail']; $edeleted = $drow['edeleted']; $ehash = $drow['hash']; @@ -450,7 +466,11 @@
code: - that needs to be fixed manualy thru arbitration/critical team.")?> + + +