diff --git a/admin/pages/accounts.php b/admin/pages/accounts.php index d42a2ee6..bb95de6b 100644 --- a/admin/pages/accounts.php +++ b/admin/pages/accounts.php @@ -8,6 +8,7 @@ * @link https://my-aac.org */ +use MyAAC\Models\Account as AccountModel; use MyAAC\Models\Player; defined('MYAAC') or die('Direct access not allowed!'); @@ -51,9 +52,21 @@ $acc_type = setting('core.account_types'); get(); + if ($accountModel->count() == 1) { + $id = (int)$accountModel[0]->id; + } else if ($accountModel->count() > 10) { + echo_error('Specified e-mail resulted with too many accounts.'); + } + else { + echo_error('No entries found.'); + } +} else if (isset($_REQUEST['search'])) { $search_account = $_REQUEST['search']; if (strlen($search_account) < 3 && !Validator::number($search_account)) { @@ -214,7 +227,7 @@ else if (isset($_REQUEST['search'])) { } } } else if ($id == 0) { - $accounts_db = $db->query('SELECT `id`, `' . $nameOrNumberColumn . '`' . ($hasTypeColumn ? ',type' : ($hasGroupColumn ? ',group_id' : '')) . ' FROM `accounts` ORDER BY `id` ASC'); + $accounts_db = $db->query('SELECT `id`, `' . $nameOrNumberColumn . '`' . ($hasTypeColumn ? ',type' : ($hasGroupColumn ? ',group_id' : '')) . ', email FROM `accounts` ORDER BY `id` ASC'); ?>