Fixed uid collision issue

Signed-off-by: Janos SUTO <sj@acts.hu>
This commit is contained in:
Janos SUTO 2021-01-16 15:27:37 +01:00
parent e6edbc525b
commit 2c530d5268
2 changed files with 3 additions and 3 deletions

View File

@ -349,7 +349,7 @@ class ModelUserAuth extends Model {
$uid = $this->model_user_user->get_uid_by_email($email); $uid = $this->model_user_user->get_uid_by_email($email);
if($uid < 1) { if($uid < 1) {
$uid = $this->model_user_user->get_next_uid(TABLE_EMAIL); $uid = $this->model_user_user->get_next_uid();
$query = $this->db->query("INSERT INTO " . TABLE_EMAIL . " (uid, email) VALUES(?,?)", array($uid, $email)); $query = $this->db->query("INSERT INTO " . TABLE_EMAIL . " (uid, email) VALUES(?,?)", array($uid, $email));
} }

View File

@ -306,9 +306,9 @@ class ModelUserUser extends Model {
} }
public function get_next_uid($table = TABLE_USER) { public function get_next_uid() {
$query = $this->db->query("SELECT MAX(uid) AS last_id FROM " . $table); $query = $this->db->query("SELECT MAX(uid) AS last_id FROM " . TABLE_EMAIL);
if(isset($query->row['last_id']) && $query->row['last_id'] > 0) { if(isset($query->row['last_id']) && $query->row['last_id'] > 0) {
return (int)$query->row['last_id'] + 1; return (int)$query->row['last_id'] + 1;