mirror of
https://github.com/slawkens/myaac.git
synced 2025-04-26 09:19:22 +02:00
Admin Update
-Account limit fix -Player editor full player table.
This commit is contained in:
parent
cddd915adf
commit
375bd58a0c
@ -204,7 +204,7 @@ else if (isset($_REQUEST['search'])) {
|
||||
}
|
||||
}
|
||||
} else if ($id == 0) {
|
||||
$accounts_db = $db->query('SELECT `id`, `name`,`type` FROM `accounts` ORDER BY `id` DESC LIMIT 10;');
|
||||
$accounts_db = $db->query('SELECT `id`, `name`,`type` FROM `accounts` ORDER BY `id` ASC');
|
||||
?>
|
||||
<div class="col-12 col-sm-12 col-lg-10">
|
||||
<div class="card card-info card-outline">
|
||||
|
@ -44,266 +44,299 @@ else if (isset($_REQUEST['search'])) {
|
||||
if (strlen($search_player) < 3 && !Validator::number($search_player)) {
|
||||
echo_error('Player name is too short.');
|
||||
} else {
|
||||
if (Validator::number($search_player))
|
||||
$id = (int)$search_player;
|
||||
else {
|
||||
$query = $db->query('SELECT `id` FROM `players` WHERE `name` = ' . $db->quote($search_player));
|
||||
if ($query->rowCount() == 1) {
|
||||
$query = $query->fetch();
|
||||
$id = (int)$query['id'];
|
||||
} else {
|
||||
$query = $db->query('SELECT `id`, `name` FROM `players` WHERE `name` LIKE ' . $db->quote('%' . $search_player . '%'));
|
||||
if ($query->rowCount() > 0 && $query->rowCount() <= 10) {
|
||||
$str_construct = 'Do you mean?<ul>';
|
||||
foreach ($query as $row)
|
||||
$str_construct .= '<li><a href="' . $player_base . '&id=' . $row['id'] . '">' . $row['name'] . '</a></li>';
|
||||
$str_construct .= '</ul>';
|
||||
echo_error($str_construct);
|
||||
} else if ($query->rowCount() > 10)
|
||||
echo_error('Specified name resulted with too many players.');
|
||||
else
|
||||
echo_error('No entries found.');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$groups = new OTS_Groups_List();
|
||||
if ($id > 0) {
|
||||
$player = new OTS_Player();
|
||||
$player->load($id);
|
||||
|
||||
if (isset($player) && $player->isLoaded() && isset($_POST['save'])) {// we want to save
|
||||
$error = false;
|
||||
|
||||
if ($player->isOnline())
|
||||
echo_error('This player is actually online. You can\'t edit online players.');
|
||||
|
||||
$name = $_POST['name'];
|
||||
$_error = '';
|
||||
if (!Validator::characterName($name))
|
||||
echo_error(Validator::getLastError());
|
||||
|
||||
//if(!Validator::newCharacterName($name)
|
||||
// echo_error(Validator::getLastError());
|
||||
|
||||
$player_db = new OTS_Player();
|
||||
$player_db->find($name);
|
||||
if ($player_db->isLoaded() && $player->getName() != $name)
|
||||
echo_error('This name is already used. Please choose another name!');
|
||||
|
||||
$account_id = $_POST['account_id'];
|
||||
verify_number($account_id, 'Account id', 11);
|
||||
|
||||
$account_db = new OTS_Account();
|
||||
$account_db->load($account_id);
|
||||
if (!$account_db->isLoaded())
|
||||
echo_error('Account with this id doesn\'t exist.');
|
||||
|
||||
$group = $_POST['group'];
|
||||
if ($groups->getGroup($group) == false)
|
||||
echo_error('Group with this id doesn\'t exist');
|
||||
|
||||
$level = $_POST['level'];
|
||||
verify_number($level, 'Level', 11);
|
||||
|
||||
$experience = $_POST['experience'];
|
||||
verify_number($experience, 'Experience', 20);
|
||||
|
||||
$vocation = $_POST['vocation'];
|
||||
verify_number($vocation, 'Vocation id', 11);
|
||||
|
||||
if (!isset($config['vocations'][$vocation])) {
|
||||
echo_error("Vocation with this id doesn't exist.");
|
||||
}
|
||||
|
||||
// health
|
||||
$health = $_POST['health'];
|
||||
verify_number($health, 'Health', 11);
|
||||
$health_max = $_POST['health_max'];
|
||||
verify_number($health_max, 'Health max', 11);
|
||||
|
||||
// mana
|
||||
$magic_level = $_POST['magic_level'];
|
||||
verify_number($magic_level, 'Magic_level', 11);
|
||||
$mana = $_POST['mana'];
|
||||
verify_number($mana, 'Mana', 11);
|
||||
$mana_max = $_POST['mana_max'];
|
||||
verify_number($mana_max, 'Mana max', 11);
|
||||
$mana_spent = $_POST['mana_spent'];
|
||||
verify_number($mana_spent, 'Mana spent', 11);
|
||||
|
||||
// look
|
||||
$look_body = $_POST['look_body'];
|
||||
verify_number($look_body, 'Look body', 11);
|
||||
$look_feet = $_POST['look_feet'];
|
||||
verify_number($look_feet, 'Look feet', 11);
|
||||
$look_head = $_POST['look_head'];
|
||||
verify_number($look_head, 'Look head', 11);
|
||||
$look_legs = $_POST['look_legs'];
|
||||
verify_number($look_legs, 'Look legs', 11);
|
||||
$look_type = $_POST['look_type'];
|
||||
verify_number($look_type, 'Look type', 11);
|
||||
if ($hasLookAddons) {
|
||||
$look_addons = $_POST['look_addons'];
|
||||
verify_number($look_addons, 'Look addons', 11);
|
||||
}
|
||||
|
||||
// pos
|
||||
$pos_x = $_POST['pos_x'];
|
||||
verify_number($pos_x, 'Position x', 11);
|
||||
$pos_y = $_POST['pos_y'];
|
||||
verify_number($pos_y, 'Position y', 11);
|
||||
$pos_z = $_POST['pos_z'];
|
||||
verify_number($pos_z, 'Position z', 11);
|
||||
|
||||
$soul = $_POST['soul'];
|
||||
verify_number($soul, 'Soul', 10);
|
||||
|
||||
$town = $_POST['town'];
|
||||
verify_number($town, 'Town', 11);
|
||||
|
||||
$capacity = $_POST['capacity'];
|
||||
verify_number($capacity, 'Capacity', 11);
|
||||
$sex = $_POST['sex'];
|
||||
verify_number($sex, 'Sex', 1);
|
||||
|
||||
$lastlogin = strtotime($_POST['lastlogin']);
|
||||
verify_number($lastlogin, 'Last login', 20);
|
||||
$lastlogout = strtotime($_POST['lastlogout']);
|
||||
verify_number($lastlogout, 'Last logout', 20);
|
||||
|
||||
$skull = $_POST['skull'];
|
||||
verify_number($skull, 'Skull', 1);
|
||||
$skull_time = $_POST['skull_time'];
|
||||
verify_number($skull_time, 'Skull time', 11);
|
||||
|
||||
if ($db->hasColumn('players', 'loss_experience')) {
|
||||
$loss_experience = $_POST['loss_experience'];
|
||||
verify_number($loss_experience, 'Loss experience', 11);
|
||||
$loss_mana = $_POST['loss_mana'];
|
||||
verify_number($loss_mana, 'Loss mana', 11);
|
||||
$loss_skills = $_POST['loss_skills'];
|
||||
verify_number($loss_skills, 'Loss skills', 11);
|
||||
$loss_containers = $_POST['loss_containers'];
|
||||
verify_number($loss_containers, 'Loss loss_containers', 11);
|
||||
$loss_items = $_POST['loss_items'];
|
||||
verify_number($loss_items, 'Loss items', 11);
|
||||
}
|
||||
if ($db->hasColumn('players', 'offlinetraining_time')) {
|
||||
$offlinetraining = $_POST['offlinetraining'];
|
||||
verify_number($offlinetraining, 'Offline Training time', 11);
|
||||
}
|
||||
|
||||
if ($hasBlessingsColumn) {
|
||||
$blessings = $_POST['blessings'];
|
||||
verify_number($blessings, 'Blessings', 2);
|
||||
}
|
||||
|
||||
$balance = $_POST['balance'];
|
||||
verify_number($balance, 'Balance', 20);
|
||||
if ($db->hasColumn('players', 'stamina')) {
|
||||
$stamina = $_POST['stamina'];
|
||||
verify_number($stamina, 'Stamina', 20);
|
||||
}
|
||||
|
||||
$deleted = (isset($_POST['deleted']) && $_POST['deleted'] == 'true');
|
||||
$hidden = (isset($_POST['hidden']) && $_POST['hidden'] == 'true');
|
||||
|
||||
$created = strtotime($_POST['created']);
|
||||
verify_number($created, 'Created', 11);
|
||||
|
||||
$comment = isset($_POST['comment']) ? htmlspecialchars(stripslashes(substr($_POST['comment'], 0, 2000))) : NULL;
|
||||
|
||||
foreach ($_POST['skills'] as $skill => $value)
|
||||
verify_number($value, $skills[$skill][0], 10);
|
||||
foreach ($_POST['skills_tries'] as $skill => $value)
|
||||
verify_number($value, $skills[$skill][0] . ' tries', 10);
|
||||
|
||||
if ($hasBlessingColumn) {
|
||||
$bless_count = $_POST['blesscount'];
|
||||
for ($i = 1; $i <= $bless_count; $i++) {
|
||||
$a = 'blessing' . $i;
|
||||
${'blessing' . $i} = (isset($_POST[$a]) && $_POST[$a] == 'true');
|
||||
}
|
||||
}
|
||||
|
||||
if (!$error) {
|
||||
$player->setName($name);
|
||||
$player->setAccount($account_db);
|
||||
$player->setGroup($groups->getGroup($group));
|
||||
$player->setLevel($level);
|
||||
$player->setExperience($experience);
|
||||
$player->setVocation($vocation);
|
||||
$player->setHealth($health);
|
||||
$player->setHealthMax($health_max);
|
||||
$player->setMagLevel($magic_level);
|
||||
$player->setMana($mana);
|
||||
$player->setManaMax($mana_max);
|
||||
$player->setManaSpent($mana_spent);
|
||||
$player->setLookBody($look_body);
|
||||
$player->setLookFeet($look_feet);
|
||||
$player->setLookHead($look_head);
|
||||
$player->setLookLegs($look_legs);
|
||||
$player->setLookType($look_type);
|
||||
if ($hasLookAddons)
|
||||
$player->setLookAddons($look_addons);
|
||||
if ($db->hasColumn('players', 'offlinetraining_time'))
|
||||
$player->setCustomField('offlinetraining_time', $offlinetraining);
|
||||
$player->setPosX($pos_x);
|
||||
$player->setPosY($pos_y);
|
||||
$player->setPosZ($pos_z);
|
||||
$player->setSoul($soul);
|
||||
$player->setTownId($town);
|
||||
$player->setCap($capacity);
|
||||
$player->setSex($sex);
|
||||
$player->setLastLogin($lastlogin);
|
||||
$player->setLastLogout($lastlogout);
|
||||
//$player->setLastIP(ip2long($lastip));
|
||||
$player->setSkull($skull);
|
||||
$player->setSkullTime($skull_time);
|
||||
if ($db->hasColumn('players', 'loss_experience')) {
|
||||
$player->setLossExperience($loss_experience);
|
||||
$player->setLossMana($loss_mana);
|
||||
$player->setLossSkills($loss_skills);
|
||||
$player->setLossContainers($loss_containers);
|
||||
$player->setLossItems($loss_items);
|
||||
}
|
||||
if ($db->hasColumn('players', 'blessings'))
|
||||
$player->setBlessings($blessings);
|
||||
|
||||
if ($hasBlessingColumn) {
|
||||
for ($i = 1; $i <= $bless_count; $i++) {
|
||||
$a = 'blessing' . $i;
|
||||
$player->setCustomField('blessings' . $i, ${'blessing' . $i} ? '1' : '0');
|
||||
}
|
||||
}
|
||||
$player->setBalance($balance);
|
||||
if ($db->hasColumn('players', 'stamina'))
|
||||
$player->setStamina($stamina);
|
||||
if ($db->hasColumn('players', 'deletion'))
|
||||
$player->setCustomField('deletion', $deleted ? '1' : '0');
|
||||
$query = $db->query('SELECT `id` FROM `players` WHERE `name` = ' . $db->quote($search_player));
|
||||
if ($query->rowCount() == 1) {
|
||||
$query = $query->fetch();
|
||||
$id = (int)$query['id'];
|
||||
} else {
|
||||
$query = $db->query('SELECT `id`, `name` FROM `players` WHERE `name` LIKE ' . $db->quote('%' . $search_player . '%'));
|
||||
if ($query->rowCount() > 0 && $query->rowCount() <= 10) {
|
||||
$str_construct = 'Do you mean?<ul>';
|
||||
foreach ($query as $row)
|
||||
$str_construct .= '<li><a href="' . $player_base . '&id=' . $row['id'] . '">' . $row['name'] . '</a></li>';
|
||||
$str_construct .= '</ul>';
|
||||
echo_error($str_construct);
|
||||
} else if ($query->rowCount() > 10)
|
||||
echo_error('Specified name resulted with too many players.');
|
||||
else
|
||||
$player->setCustomField('deleted', $deleted ? '1' : '0');
|
||||
$player->setCustomField('hidden', $hidden ? '1' : '0');
|
||||
$player->setCustomField('created', $created);
|
||||
if (isset($comment))
|
||||
$player->setCustomField('comment', $comment);
|
||||
|
||||
foreach ($_POST['skills'] as $skill => $value) {
|
||||
$player->setSkill($skill, $value);
|
||||
}
|
||||
foreach ($_POST['skills_tries'] as $skill => $value) {
|
||||
$player->setSkillTries($skill, $value);
|
||||
}
|
||||
$player->save();
|
||||
echo_success('Player saved at: ' . date('G:i'));
|
||||
$player->load($id);
|
||||
echo_error('No entries found.');
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
<div class="row">
|
||||
<?php
|
||||
$groups = new OTS_Groups_List();
|
||||
if ($id > 0) {
|
||||
$player = new OTS_Player();
|
||||
$player->load($id);
|
||||
|
||||
if (isset($player) && $player->isLoaded() && isset($_POST['save'])) {// we want to save
|
||||
$error = false;
|
||||
|
||||
if ($player->isOnline())
|
||||
echo_error('This player is actually online. You can\'t edit online players.');
|
||||
|
||||
$name = $_POST['name'];
|
||||
$_error = '';
|
||||
if (!Validator::characterName($name))
|
||||
echo_error(Validator::getLastError());
|
||||
|
||||
//if(!Validator::newCharacterName($name)
|
||||
// echo_error(Validator::getLastError());
|
||||
|
||||
$player_db = new OTS_Player();
|
||||
$player_db->find($name);
|
||||
if ($player_db->isLoaded() && $player->getName() != $name)
|
||||
echo_error('This name is already used. Please choose another name!');
|
||||
|
||||
$account_id = $_POST['account_id'];
|
||||
verify_number($account_id, 'Account id', 11);
|
||||
|
||||
$account_db = new OTS_Account();
|
||||
$account_db->load($account_id);
|
||||
if (!$account_db->isLoaded())
|
||||
echo_error('Account with this id doesn\'t exist.');
|
||||
|
||||
$group = $_POST['group'];
|
||||
if ($groups->getGroup($group) == false)
|
||||
echo_error('Group with this id doesn\'t exist');
|
||||
|
||||
$level = $_POST['level'];
|
||||
verify_number($level, 'Level', 11);
|
||||
|
||||
$experience = $_POST['experience'];
|
||||
verify_number($experience, 'Experience', 20);
|
||||
|
||||
$vocation = $_POST['vocation'];
|
||||
verify_number($vocation, 'Vocation id', 11);
|
||||
|
||||
if (!isset($config['vocations'][$vocation])) {
|
||||
echo_error("Vocation with this id doesn't exist.");
|
||||
}
|
||||
|
||||
// health
|
||||
$health = $_POST['health'];
|
||||
verify_number($health, 'Health', 11);
|
||||
$health_max = $_POST['health_max'];
|
||||
verify_number($health_max, 'Health max', 11);
|
||||
|
||||
// mana
|
||||
$magic_level = $_POST['magic_level'];
|
||||
verify_number($magic_level, 'Magic_level', 11);
|
||||
$mana = $_POST['mana'];
|
||||
verify_number($mana, 'Mana', 11);
|
||||
$mana_max = $_POST['mana_max'];
|
||||
verify_number($mana_max, 'Mana max', 11);
|
||||
$mana_spent = $_POST['mana_spent'];
|
||||
verify_number($mana_spent, 'Mana spent', 11);
|
||||
|
||||
// look
|
||||
$look_body = $_POST['look_body'];
|
||||
verify_number($look_body, 'Look body', 11);
|
||||
$look_feet = $_POST['look_feet'];
|
||||
verify_number($look_feet, 'Look feet', 11);
|
||||
$look_head = $_POST['look_head'];
|
||||
verify_number($look_head, 'Look head', 11);
|
||||
$look_legs = $_POST['look_legs'];
|
||||
verify_number($look_legs, 'Look legs', 11);
|
||||
$look_type = $_POST['look_type'];
|
||||
verify_number($look_type, 'Look type', 11);
|
||||
if ($hasLookAddons) {
|
||||
$look_addons = $_POST['look_addons'];
|
||||
verify_number($look_addons, 'Look addons', 11);
|
||||
}
|
||||
|
||||
// pos
|
||||
$pos_x = $_POST['pos_x'];
|
||||
verify_number($pos_x, 'Position x', 11);
|
||||
$pos_y = $_POST['pos_y'];
|
||||
verify_number($pos_y, 'Position y', 11);
|
||||
$pos_z = $_POST['pos_z'];
|
||||
verify_number($pos_z, 'Position z', 11);
|
||||
|
||||
$soul = $_POST['soul'];
|
||||
verify_number($soul, 'Soul', 10);
|
||||
|
||||
$town = $_POST['town'];
|
||||
verify_number($town, 'Town', 11);
|
||||
|
||||
$capacity = $_POST['capacity'];
|
||||
verify_number($capacity, 'Capacity', 11);
|
||||
$sex = $_POST['sex'];
|
||||
verify_number($sex, 'Sex', 1);
|
||||
|
||||
$lastlogin = strtotime($_POST['lastlogin']);
|
||||
verify_number($lastlogin, 'Last login', 20);
|
||||
$lastlogout = strtotime($_POST['lastlogout']);
|
||||
verify_number($lastlogout, 'Last logout', 20);
|
||||
|
||||
$skull = $_POST['skull'];
|
||||
verify_number($skull, 'Skull', 1);
|
||||
$skull_time = $_POST['skull_time'];
|
||||
verify_number($skull_time, 'Skull time', 11);
|
||||
|
||||
if ($db->hasColumn('players', 'loss_experience')) {
|
||||
$loss_experience = $_POST['loss_experience'];
|
||||
verify_number($loss_experience, 'Loss experience', 11);
|
||||
$loss_mana = $_POST['loss_mana'];
|
||||
verify_number($loss_mana, 'Loss mana', 11);
|
||||
$loss_skills = $_POST['loss_skills'];
|
||||
verify_number($loss_skills, 'Loss skills', 11);
|
||||
$loss_containers = $_POST['loss_containers'];
|
||||
verify_number($loss_containers, 'Loss loss_containers', 11);
|
||||
$loss_items = $_POST['loss_items'];
|
||||
verify_number($loss_items, 'Loss items', 11);
|
||||
}
|
||||
if ($db->hasColumn('players', 'offlinetraining_time')) {
|
||||
$offlinetraining = $_POST['offlinetraining'];
|
||||
verify_number($offlinetraining, 'Offline Training time', 11);
|
||||
}
|
||||
|
||||
if ($hasBlessingsColumn) {
|
||||
$blessings = $_POST['blessings'];
|
||||
verify_number($blessings, 'Blessings', 2);
|
||||
}
|
||||
|
||||
$balance = $_POST['balance'];
|
||||
verify_number($balance, 'Balance', 20);
|
||||
if ($db->hasColumn('players', 'stamina')) {
|
||||
$stamina = $_POST['stamina'];
|
||||
verify_number($stamina, 'Stamina', 20);
|
||||
}
|
||||
|
||||
$deleted = (isset($_POST['deleted']) && $_POST['deleted'] == 'true');
|
||||
$hidden = (isset($_POST['hidden']) && $_POST['hidden'] == 'true');
|
||||
|
||||
$created = strtotime($_POST['created']);
|
||||
verify_number($created, 'Created', 11);
|
||||
|
||||
$comment = isset($_POST['comment']) ? htmlspecialchars(stripslashes(substr($_POST['comment'], 0, 2000))) : NULL;
|
||||
|
||||
foreach ($_POST['skills'] as $skill => $value)
|
||||
verify_number($value, $skills[$skill][0], 10);
|
||||
foreach ($_POST['skills_tries'] as $skill => $value)
|
||||
verify_number($value, $skills[$skill][0] . ' tries', 10);
|
||||
|
||||
if ($hasBlessingColumn) {
|
||||
$bless_count = $_POST['blesscount'];
|
||||
for ($i = 1; $i <= $bless_count; $i++) {
|
||||
$a = 'blessing' . $i;
|
||||
${'blessing' . $i} = (isset($_POST[$a]) && $_POST[$a] == 'true');
|
||||
}
|
||||
}
|
||||
|
||||
if (!$error) {
|
||||
$player->setName($name);
|
||||
$player->setAccount($account_db);
|
||||
$player->setGroup($groups->getGroup($group));
|
||||
$player->setLevel($level);
|
||||
$player->setExperience($experience);
|
||||
$player->setVocation($vocation);
|
||||
$player->setHealth($health);
|
||||
$player->setHealthMax($health_max);
|
||||
$player->setMagLevel($magic_level);
|
||||
$player->setMana($mana);
|
||||
$player->setManaMax($mana_max);
|
||||
$player->setManaSpent($mana_spent);
|
||||
$player->setLookBody($look_body);
|
||||
$player->setLookFeet($look_feet);
|
||||
$player->setLookHead($look_head);
|
||||
$player->setLookLegs($look_legs);
|
||||
$player->setLookType($look_type);
|
||||
if ($hasLookAddons)
|
||||
$player->setLookAddons($look_addons);
|
||||
if ($db->hasColumn('players', 'offlinetraining_time'))
|
||||
$player->setCustomField('offlinetraining_time', $offlinetraining);
|
||||
$player->setPosX($pos_x);
|
||||
$player->setPosY($pos_y);
|
||||
$player->setPosZ($pos_z);
|
||||
$player->setSoul($soul);
|
||||
$player->setTownId($town);
|
||||
$player->setCap($capacity);
|
||||
$player->setSex($sex);
|
||||
$player->setLastLogin($lastlogin);
|
||||
$player->setLastLogout($lastlogout);
|
||||
//$player->setLastIP(ip2long($lastip));
|
||||
$player->setSkull($skull);
|
||||
$player->setSkullTime($skull_time);
|
||||
if ($db->hasColumn('players', 'loss_experience')) {
|
||||
$player->setLossExperience($loss_experience);
|
||||
$player->setLossMana($loss_mana);
|
||||
$player->setLossSkills($loss_skills);
|
||||
$player->setLossContainers($loss_containers);
|
||||
$player->setLossItems($loss_items);
|
||||
}
|
||||
if ($db->hasColumn('players', 'blessings'))
|
||||
$player->setBlessings($blessings);
|
||||
|
||||
if ($hasBlessingColumn) {
|
||||
for ($i = 1; $i <= $bless_count; $i++) {
|
||||
$a = 'blessing' . $i;
|
||||
$player->setCustomField('blessings' . $i, ${'blessing' . $i} ? '1' : '0');
|
||||
}
|
||||
}
|
||||
$player->setBalance($balance);
|
||||
if ($db->hasColumn('players', 'stamina'))
|
||||
$player->setStamina($stamina);
|
||||
if ($db->hasColumn('players', 'deletion'))
|
||||
$player->setCustomField('deletion', $deleted ? '1' : '0');
|
||||
else
|
||||
$player->setCustomField('deleted', $deleted ? '1' : '0');
|
||||
$player->setCustomField('hidden', $hidden ? '1' : '0');
|
||||
$player->setCustomField('created', $created);
|
||||
if (isset($comment))
|
||||
$player->setCustomField('comment', $comment);
|
||||
|
||||
foreach ($_POST['skills'] as $skill => $value) {
|
||||
$player->setSkill($skill, $value);
|
||||
}
|
||||
foreach ($_POST['skills_tries'] as $skill => $value) {
|
||||
$player->setSkillTries($skill, $value);
|
||||
}
|
||||
$player->save();
|
||||
echo_success('Player saved at: ' . date('G:i'));
|
||||
$player->load($id);
|
||||
}
|
||||
}
|
||||
} else if ($id == 0) {
|
||||
$players_db = $db->query('SELECT `id`, `name`, `level` FROM `players` ORDER BY `id` asc');
|
||||
?>
|
||||
<div class="col-12 col-sm-12 col-lg-10">
|
||||
<div class="card card-info card-outline">
|
||||
<div class="card-header">
|
||||
<h5 class="m-0">Players</h5>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<table class="player_datatable table table-striped table-bordered">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>ID</th>
|
||||
<th>Name</th>
|
||||
<th>Level</th>
|
||||
<th style="width: 40px">Edit</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($players_db as $player_db): ?>
|
||||
<tr>
|
||||
<th><?php echo $player_db['id']; ?></th>
|
||||
<td><?php echo $player_db['name']; ?></a></td>
|
||||
<td><?php echo $player_db['level']; ?></a></td>
|
||||
|
||||
<td><a href="?p=players&id=<?php echo $player_db['id']; ?>" class="btn btn-success btn-sm" title="Edit">
|
||||
<i class="fas fa-pencil-alt"></i>
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
<?php
|
||||
if (isset($player) && $player->isLoaded()) {
|
||||
$account = $player->getAccount();
|
||||
@ -815,11 +848,11 @@ if ($id > 0) {
|
||||
const look_feet = $('#look_feet').val();
|
||||
const look_type = $('#look_type').val();
|
||||
|
||||
<?php if($hasLookAddons): ?>
|
||||
<?php if($hasLookAddons): ?>
|
||||
const look_addons = '&addons=' + $('#look_addons').val();
|
||||
<?php else: ?>
|
||||
<?php else: ?>
|
||||
const look_addons = '';
|
||||
<?php endif; ?>
|
||||
<?php endif; ?>
|
||||
$("#player_outfit").attr("src", '<?= $config['outfit_images_url']; ?>?id=' + look_type + look_addons + '&head=' + look_head + '&body=' + look_body + '&legs=' + look_legs + '&feet=' + look_feet);
|
||||
}
|
||||
</script>
|
||||
@ -829,16 +862,34 @@ if ($id > 0) {
|
||||
<div class="card-header">
|
||||
<h5 class="m-0">Search Player</h5>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<form action="<?php echo $player_base; ?>" method="post">
|
||||
<div class="input-group input-group-sm">
|
||||
<input type="text" class="form-control" name="search" value="<?php echo $search_player; ?>" maxlength="32" size="32">
|
||||
<span class="input-group-append">
|
||||
<button type="submit" class="btn btn-info btn-flat">Search</button>
|
||||
</span>
|
||||
</div>
|
||||
</form>
|
||||
<div class="card-body row">
|
||||
<div class="col-6 col-lg-12">
|
||||
<form action="<?php echo $player_base; ?>" method="post">
|
||||
<label for="name">Player Name:</label>
|
||||
<div class="input-group input-group-sm">
|
||||
<input type="text" class="form-control" name="search" value="<?php echo $search_player; ?>" maxlength="32" size="32">
|
||||
<span class="input-group-append"><button type="submit" class="btn btn-info btn-flat">Search</button></span>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<div class="col-6 col-lg-12">
|
||||
<form action="<?php echo $player_base; ?>" method="post">
|
||||
<label for="name">Player ID:</label>
|
||||
<div class="input-group input-group-sm">
|
||||
<input type="text" class="form-control" name="id" value="" maxlength="32" size="32">
|
||||
<span class="input-group-append"><button type="submit" class="btn btn-info btn-flat">Search</button></span>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
$(document).ready(function () {
|
||||
$('.player_datatable').DataTable({
|
||||
"order": [[0, "asc"]]
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
Loading…
x
Reference in New Issue
Block a user