|
|
@ -256,7 +256,8 @@ class Database { |
|
|
|
throw new User\Exception("alreadyExists", ["action" => __FUNCTION__, "user" => $user]); |
|
|
|
} |
|
|
|
$hash = (strlen($password) > 0) ? password_hash($password, \PASSWORD_DEFAULT) : ""; |
|
|
|
$this->db->prepare("INSERT INTO arsse_users(id,password,num) values(?, ?, coalesce((select max(num) from arsse_users), 0) + 1)", "str", "str")->runArray([$user,$hash]); |
|
|
|
// NOTE: This roundabout construction (with 'select' rather than 'values') is required by MySQL, because MySQL is riddled with pitfalls and exceptions |
|
|
|
$this->db->prepare("INSERT INTO arsse_users(id,password,num) select ?, ?, ((select max(num) from arsse_users) + 1)", "str", "str")->runArray([$user,$hash]); |
|
|
|
return true; |
|
|
|
} |
|
|
|
|
|
|
|