Allow selecting by login.

This commit is contained in:
Igor Barkov (iwork) 2020-07-03 16:33:34 +03:00
parent ff7d7ac86d
commit 19dae67b95

View File

@ -27,9 +27,9 @@ class User
public $room; public $room;
public $block; public $block;
public function __construct($userid) public function __construct($user)
{ {
$user_query = db::c()->query('SELECT * FROM users WHERE id = ?i', $userid)->fetch_assoc(); $user_query = db::c()->query('SELECT * FROM users WHERE id = ?i OR login = "?s"', $user, $user)->fetch_assoc();
foreach ($this as $key => $value) { foreach ($this as $key => $value) {
if (isset($user_query[$key])) { if (isset($user_query[$key])) {
$this->$key = $user_query[$key]; $this->$key = $user_query[$key];