diff --git a/webui/model/user/auth.php b/webui/model/user/auth.php index 5dc23f92..b71e4ed8 100644 --- a/webui/model/user/auth.php +++ b/webui/model/user/auth.php @@ -129,7 +129,7 @@ class ModelUserAuth extends Model { $uid = $this->model_user_user->get_uid_by_email($email); if($uid < 1) { - $uid = $this->model_user_user->get_next_uid(); + $uid = $this->model_user_user->get_next_uid(TABLE_EMAIL); $query = $this->db->query("INSERT INTO " . TABLE_EMAIL . " (uid, email) VALUES(?,?)", array($uid, $email)); } diff --git a/webui/model/user/user.php b/webui/model/user/user.php index 01c35778..2dd49960 100644 --- a/webui/model/user/user.php +++ b/webui/model/user/user.php @@ -294,9 +294,9 @@ class ModelUserUser extends Model { } - public function get_next_uid() { + public function get_next_uid($table = TABLE_USER) { - $query = $this->db->query("SELECT MAX(uid) AS last_id FROM " . TABLE_USER); + $query = $this->db->query("SELECT MAX(uid) AS last_id FROM " . $table); if(isset($query->row['last_id']) && $query->row['last_id'] > 0) { return (int)$query->row['last_id'] + 1;