From 1e52b12c4015f15509c284b402e781cb22266374 Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Sun, 28 May 2006 00:16:52 +0000 Subject: [PATCH] r849: Make sure that when we're validating displayname and email we aren't searching against ourselves --- includes/api_user.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/includes/api_user.php b/includes/api_user.php index 371a400..9a519e0 100644 --- a/includes/api_user.php +++ b/includes/api_user.php @@ -112,7 +112,7 @@ class UserAPI extends API { return $this->registry->lang->string('The specified email is invalid.'); } - if ($this->registry->db->query_first("SELECT * FROM " . TABLE_PREFIX . "user WHERE email = '" . $this->registry->db->escape_string($this->values['email']) . "'")) + if ($this->registry->db->query_first("SELECT * FROM " . TABLE_PREFIX . "user WHERE email = '" . $this->registry->db->escape_string($this->values['email']) . "' AND userid <> " . $this->values['userid'])) { return $this->registry->lang->string('The specified email is already in use.'); } @@ -129,7 +129,7 @@ class UserAPI extends API { $this->verify_noempty('displayname'); - if ($this->registry->db->query_first("SELECT * FROM " . TABLE_PREFIX . "user WHERE displayname = '" . $this->registry->db->escape_string($this->values['displayname']) . "'")) + if ($this->registry->db->query_first("SELECT * FROM " . TABLE_PREFIX . "user WHERE displayname = '" . $this->registry->db->escape_string($this->values['displayname']) . "' AND userid <> " . $this->values['userid'])) { return $this->registry->lang->string('That display name is already in use by another user.'); } -- 2.22.5