mirror of
https://bitbucket.org/jsuto/piler.git
synced 2024-12-26 06:40:12 +01:00
Fixed uid collision issue
Signed-off-by: Janos SUTO <sj@acts.hu>
This commit is contained in:
parent
e6edbc525b
commit
2c530d5268
@ -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));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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;
|
||||||
|
Loading…
Reference in New Issue
Block a user