hasColumn('accounts', 'secret'); $hasCoinsColumn = $db->hasColumn('accounts', 'coins'); $hasPointsColumn = $db->hasColumn('accounts', 'premium_points'); $hasTypeColumn = $db->hasColumn('accounts', 'type'); $hasGroupColumn = $db->hasColumn('accounts', 'group_id'); if (setting('core.account_country')) { $countries = array(); foreach (array('pl', 'se', 'br', 'us', 'gb') as $c) $countries[$c] = $config['countries'][$c]; $countries['--'] = '----------'; foreach ($config['countries'] as $code => $c) $countries[$code] = $c; } $web_acc = ACCOUNT_WEB_FLAGS; $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)) { echo_error('Player name is too short.'); } else { $query = $db->query('SELECT `id` FROM `accounts` WHERE `' . $nameOrNumberColumn . '` = ' . $db->quote($search_account)); if ($query->rowCount() == 1) { $query = $query->fetch(); $id = (int)$query['id']; } else { $query = $db->query('SELECT `id`, `' . $nameOrNumberColumn . '` FROM `accounts` WHERE `' . $nameOrNumberColumn . '` LIKE ' . $db->quote('%' . $search_account . '%')); if ($query->rowCount() > 0 && $query->rowCount() <= 10) { $str_construct = 'Do you mean?'; echo_error($str_construct); } else if ($query->rowCount() > 10) echo_error('Specified name resulted with too many accounts.'); else echo_error('No entries found.'); } } } ?>
0) { $account = new OTS_Account(); $account->load($id); if (isset($_POST['save']) && $account->isLoaded()) { $error = false; $_error = ''; $account_db = new OTS_Account(); if (USE_ACCOUNT_NAME) { $name = $_POST['name']; $account_db->find($name); if ($account_db->isLoaded() && $account->getName() != $name) echo_error('This name is already used. Please choose another name!'); } $account_db->load($id); if (!$account_db->isLoaded()) echo_error('Account with this id doesn\'t exist.'); //type/group if ($hasTypeColumn || $hasGroupColumn) { $group = $_POST['group']; } $password = ((!empty($_POST["pass"]) ? $_POST['pass'] : null)); if (!Validator::password($password)) { $errors['password'] = Validator::getLastError(); } //secret if ($hasSecretColumn) { $secret = $_POST['secret']; } //key $key = $_POST['key']; $email = $_POST['email']; if (!Validator::email($email)) $errors['email'] = Validator::getLastError(); //tibia coins if ($hasCoinsColumn) { $t_coins = $_POST['t_coins']; verify_number($t_coins, 'Tibia coins', 12); } // prem days $p_days = (int)$_POST['p_days']; verify_number($p_days, 'Prem days', 11); //prem points $p_points = $_POST['p_points']; verify_number($p_points, 'Prem Points', 11); //rl name $rl_name = $_POST['rl_name']; //location $rl_loca = $_POST['rl_loca']; //country $rl_country = $_POST['rl_country']; $web_flags = $_POST['web_flags']; verify_number($web_flags, 'Web Flags', 1); //created $created = strtotime($_POST['created']); verify_number($created, 'Created', 11); //web last login $web_lastlogin = strtotime($_POST['web_lastlogin']); verify_number($web_lastlogin, 'Web Last login', 11); if (!$error && $hooks->trigger(HOOK_ADMIN_ACCOUNTS_SAVE_POST, ['account_id' => $account->getId(), 'account_email' => $account->getEMail()])) { if (USE_ACCOUNT_NAME) { $account->setName($name); } if ($hasTypeColumn) { $account->setCustomField('type', $group); } elseif ($hasGroupColumn) { $account->setCustomField('group_id', $group); } if ($hasSecretColumn) { $account->setCustomField('secret', $secret); } $account->setCustomField('key', $key); $account->setEMail($email); if ($hasCoinsColumn) { $account->setCustomField('coins', $t_coins); } $lastDay = 0; if($p_days != 0 && $p_days != OTS_Account::GRATIS_PREMIUM_DAYS) { $lastDay = time(); } else if ($lastDay != 0) { $lastDay = 0; } $account->setPremDays($p_days); $account->setLastLogin($lastDay); if ($hasPointsColumn) { $account->setCustomField('premium_points', $p_points); } $account->setRLName($rl_name); $account->setLocation($rl_loca); $account->setCountry($rl_country); $account->setCustomField('created', $created); $account->setWebFlags($web_flags); $account->setCustomField('web_lastlogin', $web_lastlogin); if (isset($password)) { if (USE_ACCOUNT_SALT) { $salt = generateRandomString(10, false, true, true); $password = $salt . $password; $account->setCustomField('salt', $salt); } $password = encrypt($password); $account->setPassword($password); if (USE_ACCOUNT_SALT) $account->setCustomField('salt', $salt); } $account->save(); echo_success('Account saved at: ' . date('G:i')); } } } else if ($id == 0) { $accounts_db = $db->query('SELECT `id`, `' . $nameOrNumberColumn . '`' . ($hasTypeColumn ? ',type' : ($hasGroupColumn ? ',group_id' : '')) . ', email FROM `accounts` ORDER BY `id` ASC'); ?>
Accounts
ID E-Mail Position Edit
getGroups(); echo $group[$account_lst['group_id']]; } ?>
isLoaded()) { ?>
getAccGroupId(); if ($hasTypeColumn) { ?>
getEMail() . '">Send Mail)' : ''); ?>
getCustomField('created')); ?>"/>
getCustomField('web_lastlogin')); ?>"/>
Cancel
getId())->orderByDesc('date')->get(); foreach ($accountActions as $i => $log): $log->ip = ($log->ip != 0 ? long2ip($log->ip) : inet_ntop($log->ipv6)); ?>
# Date Action IP
date); ?> action; ?> ip; ?>
isLoaded()) { $account_players = Player::where('account_id', $account->getId())->orderBy('id')->get(); if (isset($account_players)) { ?> $player): ?>
# Name Level Vocation Edit
name; ?> level; ?> vocation_name; ?>
hasTable('bans')) : ?>
query('SELECT * FROM ' . $db->tableName('bans') . ' WHERE ' . $db->fieldName('active') . ' = 1 AND ' . $db->fieldName('id') . ' = ' . $account->getId() . ' ORDER BY ' . $db->fieldName('added') . ' DESC LIMIT 10'); if ($bans->rowCount()) { ?>
Nick Type Expires Reason Comment Added by:
' . $pName . ''; ?> ' . date("d M Y", $ban['expires']); ?> ' . $aName . ''; echo '
' . date("d.m.Y", $ban['added']); ?>
hasTable('store_history') && $db->hasColumn('store_history', 'time')) { ?>
query('SELECT * FROM `store_history` WHERE `account_id` = "' . $account->getId() . '" ORDER BY `time` DESC')->fetchAll(); ?>
Description Coins Date
Search Accounts