mirror of
https://github.com/Shadowss/TravianZ.git
synced 2026-09-02 08:27:15 +00:00
Full Refactor Admin Panel & Logs
Full Refactor Admin Panel & Logs (now you can see detailed logs in admin panel)
This commit is contained in:
+120
-35
@@ -1,55 +1,140 @@
|
|||||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||||||
<head>
|
<head>
|
||||||
|
<link rel="shortcut icon" href="favicon.ico"/>
|
||||||
<link REL="shortcut icon" HREF="favicon.ico"/>
|
<title><?php echo ($_SESSION['access'] == ADMIN ? 'Admin Control Panel' : 'Multihunter Control Panel'); ?> - TravianZ</title>
|
||||||
|
<link rel="stylesheet" type="text/css" href="../img/admin/admin.css">
|
||||||
<title><?php if($_SESSION['access'] == ADMIN){ echo 'Admin Control Panel - TravianX'; } else if($_SESSION['access'] == MULTIHUNTER){ echo 'Multihunter Control Panel - TravianX'; } ?></title>
|
<link rel="stylesheet" type="text/css" href="../img/admin/acp.css">
|
||||||
|
<link rel="stylesheet" type="text/css" href="../img/../img.css">
|
||||||
<link rel=stylesheet type="text/css" href="../img/admin/admin.css">
|
|
||||||
|
|
||||||
<link rel=stylesheet type="text/css" href="../img/admin/acp.css">
|
|
||||||
|
|
||||||
<link rel=stylesheet type="text/css" href="../img/../img.css">
|
|
||||||
|
|
||||||
<script src="mt-full.js?423cb" type="text/javascript"></script>
|
<script src="mt-full.js?423cb" type="text/javascript"></script>
|
||||||
|
|
||||||
<script src="ajax.js" type="text/javascript"></script>
|
<script src="ajax.js" type="text/javascript"></script>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
|
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
|
||||||
|
|
||||||
<meta http-equiv="imagetoolbar" content="no">
|
<meta http-equiv="imagetoolbar" content="no">
|
||||||
|
<style>
|
||||||
|
.logTable { width:100%; border-collapse:collapse; margin-top:10px; }
|
||||||
|
.logTable th { background:#222; color:#fff; padding:6px; text-align:left; font-size:12px; }
|
||||||
|
.logTable td { padding:6px; border-bottom:1px solid #ddd; font-size:12px; vertical-align:top; }
|
||||||
|
.logTable tr:hover { background:#f5f5f5; }
|
||||||
|
.logCat { font-weight:bold; padding:2px 6px; border-radius:3px; color:#fff; font-size:11px; }
|
||||||
|
.cat-gold { background:#d4af37; } .cat-plus { background:#6a5acd; }
|
||||||
|
.cat-ban { background:#c00; } .cat-unban { background:#090; }
|
||||||
|
.cat-maint { background:#555; } .cat-village { background:#0073aa; }
|
||||||
|
.cat-msg { background:#ff8800; } .cat-other { background:#888; }
|
||||||
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
#################################################################################
|
#################################################################################
|
||||||
## -= YOU MAY NOT REMOVE OR CHANGE THIS NOTICE =- ##
|
## -= YOU MAY NOT REMOVE OR CHANGE THIS NOTICE =- ##
|
||||||
## --------------------------------------------------------------------------- ##
|
## --------------------------------------------------------------------------- ##
|
||||||
## Filename admin_log.tpl ##
|
## Filename admin_log.tpl ##
|
||||||
## Developed by: Dzoki ##
|
## Developed by: Dzoki ##
|
||||||
## License: TravianX Project ##
|
## Refactored by: aggenkeech (2025) ##
|
||||||
## Copyright: TravianX (c) 2010-2011. All rights reserved. ##
|
## Remake by: Shadow (2026) ##
|
||||||
|
## License: TravianZ Project ##
|
||||||
|
## Copyright: TravianZ (c) 2010-2026. All rights reserved. ##
|
||||||
## ##
|
## ##
|
||||||
#################################################################################
|
#################################################################################
|
||||||
|
|
||||||
if($_SESSION['access'] < ADMIN) die("Access Denied: You are not Admin!"); ?>
|
if($_SESSION['access'] < ADMIN) die("Access Denied: You are not Admin!");
|
||||||
|
|
||||||
|
// 1. Log-uri normale
|
||||||
|
$adminLogs = $database->getAdminLog();
|
||||||
|
$unified = [];
|
||||||
|
|
||||||
|
foreach($adminLogs as $l) {
|
||||||
|
$unified[] = [
|
||||||
|
'id' => $l['id'],
|
||||||
|
'time' => $l['time'],
|
||||||
|
'user' => $l['user'],
|
||||||
|
'type' => 'admin',
|
||||||
|
'text' => $l['log']
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
// 2. Ban-uri și Unban-uri din banlist
|
||||||
|
$banQ = mysqli_query($GLOBALS["link"], "
|
||||||
|
SELECT id, uid, name, reason, time, end, admin, active
|
||||||
|
FROM ".TB_PREFIX."banlist
|
||||||
|
ORDER BY time DESC
|
||||||
|
LIMIT 300
|
||||||
|
");
|
||||||
|
while($b = mysqli_fetch_assoc($banQ)) {
|
||||||
|
// BAN
|
||||||
|
$unified[] = [
|
||||||
|
'id' => 1000000 + $b['id'], // offset ca să nu se amestece ID-urile
|
||||||
|
'time' => $b['time'],
|
||||||
|
'user' => $b['admin'] ?: 1,
|
||||||
|
'type' => 'ban',
|
||||||
|
'text' => "Banned user <a href='admin.php?p=player&uid={$b['uid']}'>{$b['name']}</a> (Reason: {$b['reason']})",
|
||||||
|
'active' => $b['active']
|
||||||
|
];
|
||||||
|
// UNBAN - dacă e inactiv, folosim end ca timp de unban
|
||||||
|
if($b['active'] == 0 && $b['end'] > $b['time']) {
|
||||||
|
$unified[] = [
|
||||||
|
'id' => 2000000 + $b['id'],
|
||||||
|
'time' => $b['end'],
|
||||||
|
'user' => $b['admin'] ?: 1,
|
||||||
|
'type' => 'unban',
|
||||||
|
'text' => "Unbanned user <a href='admin.php?p=player&uid={$b['uid']}'>{$b['name']}</a>",
|
||||||
|
'active' => 0
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 3. Sortează tot după timp DESC
|
||||||
|
usort($unified, function($a,$b){ return $b['time'] <=> $a['time']; });
|
||||||
|
$unified = array_slice($unified, 0, 300);
|
||||||
|
|
||||||
|
function logCategory($entry) {
|
||||||
|
if($entry['type']=='ban') return ['BAN','cat-ban','🔨'];
|
||||||
|
if($entry['type']=='unban') return ['UNBAN','cat-unban','🔓'];
|
||||||
|
$t = strtolower(strip_tags($entry['text']));
|
||||||
|
if (strpos($t,'mass ban')!==false) return ['BAN','cat-ban','🔨'];
|
||||||
|
if (strpos($t,'mass unban')!==false) return ['UNBAN','cat-unban','🔓'];
|
||||||
|
if (strpos($t,'gold')!==false) return ['GOLD','cat-gold','💰'];
|
||||||
|
if (strpos($t,'plus')!==false && strpos($t,'bonus')===false) return ['PLUS','cat-plus','⭐'];
|
||||||
|
if (strpos($t,'bonus')!==false) return ['BONUS','cat-plus','📈'];
|
||||||
|
if (strpos($t,'reset')!==false) return ['RESET','cat-maint','⚙️'];
|
||||||
|
if (strpos($t,'village')!==false || strpos($t,'buildings')!==false || strpos($t,'renamed')!==false) return ['VILLAGE','cat-village','🏘️'];
|
||||||
|
if (strpos($t,'message')!==false) return ['MESSAGE','cat-msg','✉️'];
|
||||||
|
return ['OTHER','cat-other','📝'];
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
<h2>Admin Log Unificat - ultimele 300 acțiuni</h2>
|
||||||
|
|
||||||
|
<table class="logTable">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th width="50">ID</th>
|
||||||
|
<th width="120">Admin</th>
|
||||||
|
<th width="100">Categorie</th>
|
||||||
|
<th>Detalii</th>
|
||||||
|
<th width="140">Data</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
<?php
|
<?php
|
||||||
|
foreach($unified as $e) {
|
||||||
|
$admid = (int)$e['user'];
|
||||||
|
$username = $database->getUserField($admid, "username", 0);
|
||||||
|
$adminLink = $username ? '<a href="admin.php?p=player&uid='.$admid.'">'.htmlspecialchars($username).'</a>' : '<b>SYSTEM</b>';
|
||||||
|
if($username == 'Multihunter') $adminLink = '<b style="color:#c00">CONTROL PANEL</b>';
|
||||||
|
|
||||||
$no = count($database->getAdminLog());
|
list($cat,$class,$icon) = logCategory($e);
|
||||||
$log = $database->getAdminLog();
|
$date = date("d.m.Y H:i:s", $e['time'] + 3600*2);
|
||||||
for($i=0;$i<$no;$i++) {
|
$details = $e['text'];
|
||||||
$admid = $log[$i]['user']?>
|
?>
|
||||||
------------------------------------<br>
|
<tr>
|
||||||
<b>Log ID:</b> <?php echo $log[$i]['id']; ?><br />
|
<td>#<?php echo $e['id'] % 1000000; ?></td>
|
||||||
<b>Admin:</b> <?php $user = $database->getUserField($admid,"username",0);
|
<td><?php echo $adminLink; ?></td>
|
||||||
if($user == 'Multihunter') {
|
<td><span class="logCat <?php echo $class; ?>"><?php echo $icon.' '.$cat; ?></span></td>
|
||||||
echo '<b>CONTROL PANEL</b>';
|
<td><?php echo $details; ?></td>
|
||||||
} else { echo '<a href="admin.php?p=player&uid='.$admid.'">'.$user.'</a>'; }
|
<td><?php echo $date; ?></td>
|
||||||
?><br />
|
</tr>
|
||||||
<b>Log:</b> <?php echo $log[$i]['log']; ?><br />
|
<?php } ?>
|
||||||
<b>Date:</b> <?php echo date("d.m.Y H:i:s",$log[$i]['time']+3600*2); ?><br />
|
</tbody>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
<?php if($total > $limit) { ?>
|
||||||
|
<p style="margin-top:10px;color:#777">Afișate doar ultimele <?php echo $limit; ?>. Pentru istoric complet, exportă din phpMyAdmin tabelul <code>s1_admin_log</code>.</p>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
@@ -3,29 +3,64 @@
|
|||||||
## -= YOU MAY NOT REMOVE OR CHANGE THIS NOTICE =- ##
|
## -= YOU MAY NOT REMOVE OR CHANGE THIS NOTICE =- ##
|
||||||
## --------------------------------------------------------------------------- ##
|
## --------------------------------------------------------------------------- ##
|
||||||
## Filename addABTroops.php ##
|
## Filename addABTroops.php ##
|
||||||
|
## Type BACKEND ##
|
||||||
## Developed by: ronix ##
|
## Developed by: ronix ##
|
||||||
## License: TravianZ Project ##
|
## License: TravianZ Project ##
|
||||||
## Copyright: TravianZ (c) 2010-2014. All rights reserved. ##
|
## Copyright: TravianZ (c) 2010-2014. All rights reserved. ##
|
||||||
## ##
|
## ##
|
||||||
#################################################################################
|
#################################################################################
|
||||||
if(!isset($_SESSION)) session_start();
|
|
||||||
if($_SESSION['access'] < 9) die("Access Denied: You are not Admin!");
|
|
||||||
include_once("../../Database.php");
|
|
||||||
|
|
||||||
$id = (int) $_POST['id'];
|
if (!isset($_SESSION)) {
|
||||||
$village = $database->getVillage($id);
|
session_start();
|
||||||
$user = $database->getUserArray($village['owner'],1);
|
}
|
||||||
$atech="";
|
if (empty($_SESSION['access']) || $_SESSION['access'] < 9) {
|
||||||
$btech="";
|
die("Access Denied: You are not Admin!");
|
||||||
for($i=1; $i<9; $i++) {
|
|
||||||
$atech.="a".$i."=".$database->escape($_POST['a'.$i]).", ";
|
|
||||||
$btech.="b".$i."=".$database->escape($_POST['b'.$i]).(($i > 7) ? "" : ", ");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$q = "UPDATE ".TB_PREFIX."abdata SET ".$atech.$btech." WHERE vref = $id";
|
include_once __DIR__ . "/../../Database.php";
|
||||||
|
|
||||||
|
/* ---------------------------------------------------------------------------
|
||||||
|
* Input
|
||||||
|
* --------------------------------------------------------------------------- */
|
||||||
|
$id = (int)($_POST['id'] ?? 0);
|
||||||
|
if ($id <= 0) {
|
||||||
|
header("Location: ../../../Admin/admin.php");
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
$village = $database->getVillage($id);
|
||||||
|
|
||||||
|
/* ---------------------------------------------------------------------------
|
||||||
|
* Update a1-a8 / b1-b8
|
||||||
|
* --------------------------------------------------------------------------- */
|
||||||
|
$fields = [];
|
||||||
|
for ($i = 1; $i <= 8; $i++) {
|
||||||
|
$a = (int)($_POST['a' . $i] ?? 0);
|
||||||
|
$b = (int)($_POST['b' . $i] ?? 0);
|
||||||
|
$fields[] = "a$i = $a";
|
||||||
|
$fields[] = "b$i = $b";
|
||||||
|
}
|
||||||
|
|
||||||
|
$q = "UPDATE " . TB_PREFIX . "abdata SET " . implode(", ", $fields) . " WHERE vref = $id";
|
||||||
$database->query($q);
|
$database->query($q);
|
||||||
$database->query("Insert into ".TB_PREFIX."admin_log values (0,".(int) $_SESSION['id'].",'Changed troop upgrade levels in village <a href=\'admin.php?p=village&did=$id\'>$id</a> ',".time().")");
|
|
||||||
|
/* ---------------------------------------------------------------------------
|
||||||
|
* Log admin - adaptat pentru structura ta:
|
||||||
|
* CREATE TABLE `s1_admin_log` (`id` int, `user` text, `log` text, `time` int)
|
||||||
|
* --------------------------------------------------------------------------- */
|
||||||
|
$adminId = (string)(int)$_SESSION['id'];
|
||||||
|
$time = time();
|
||||||
|
$logText = "Changed troop upgrade levels in village <a href='admin.php?p=village&did=$id'>$id</a>";
|
||||||
|
|
||||||
|
// escapăm corect pentru coloana TEXT
|
||||||
|
$adminIdEsc = $database->escape($adminId);
|
||||||
|
$logEsc = $database->escape($logText);
|
||||||
|
|
||||||
|
$database->query(
|
||||||
|
"INSERT INTO " . TB_PREFIX . "admin_log (`id`, `user`, `log`, `time`) " .
|
||||||
|
"VALUES (0, '$adminIdEsc', '$logEsc', $time)"
|
||||||
|
);
|
||||||
|
|
||||||
header("Location: ../../../Admin/admin.php?p=village&did=" . $id . "&ab");
|
header("Location: ../../../Admin/admin.php?p=village&did=" . $id . "&ab");
|
||||||
|
exit;
|
||||||
?>
|
?>
|
||||||
@@ -1,8 +1,10 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
#################################################################################
|
#################################################################################
|
||||||
## -= YOU MAY NOT REMOVE OR CHANGE THIS NOTICE =- ##
|
## -= YOU MAY NOT REMOVE OR CHANGE THIS NOTICE =- ##
|
||||||
## --------------------------------------------------------------------------- ##
|
## --------------------------------------------------------------------------- ##
|
||||||
## Filename addTroops.php ##
|
## Filename addTroops.php ##
|
||||||
|
## Type BACKEND ##
|
||||||
## Developed by: Dzoki & Advocatie ##
|
## Developed by: Dzoki & Advocatie ##
|
||||||
## License: TravianZ Project ##
|
## License: TravianZ Project ##
|
||||||
## Reworks by: ronix ##
|
## Reworks by: ronix ##
|
||||||
@@ -10,26 +12,63 @@
|
|||||||
## ##
|
## ##
|
||||||
#################################################################################
|
#################################################################################
|
||||||
|
|
||||||
if(!isset($_SESSION)) session_start();
|
if (!isset($_SESSION)) {
|
||||||
if($_SESSION['access'] < 9) die(ACCESS_DENIED_ADMIN);
|
session_start();
|
||||||
include_once("../../Database.php");
|
}
|
||||||
include_once("../../Technology.php");
|
if (empty($_SESSION['access']) || $_SESSION['access'] < 9) {
|
||||||
include_once("../../Data/unitdata.php");
|
die(defined('ACCESS_DENIED_ADMIN') ? ACCESS_DENIED_ADMIN : 'Access Denied: You are not Admin!');
|
||||||
|
|
||||||
$id = (int)$_POST['id'];
|
|
||||||
$village = $database->getVillage($id);
|
|
||||||
$user = $database->getUserArray($village['owner'],1);
|
|
||||||
$units = "";
|
|
||||||
$tribe = $user['tribe'];
|
|
||||||
$u = ($tribe - 1) * 10;
|
|
||||||
|
|
||||||
for($i = 1; $i < 11; $i++) {
|
|
||||||
$units.="u".($u + $i)."=".$database->escape($_POST['u'.($u + $i)].(($i < 10) ? ", " : ""));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$q = "UPDATE ".TB_PREFIX."units SET ".$units." WHERE vref = ".$id;
|
include_once __DIR__ . "/../../Database.php";
|
||||||
|
include_once __DIR__ . "/../../Technology.php";
|
||||||
|
include_once __DIR__ . "/../../Data/unitdata.php";
|
||||||
|
|
||||||
|
/* ---------------------------------------------------------------------------
|
||||||
|
* Input & validare
|
||||||
|
* --------------------------------------------------------------------------- */
|
||||||
|
$id = (int)($_POST['id'] ?? 0);
|
||||||
|
if ($id <= 0) {
|
||||||
|
header("Location: ../../../Admin/admin.php");
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
$village = $database->getVillage($id);
|
||||||
|
$user = $database->getUserArray($village['owner'], 1);
|
||||||
|
$tribe = (int)$user['tribe'];
|
||||||
|
$u = ($tribe - 1) * 10;
|
||||||
|
|
||||||
|
/* ---------------------------------------------------------------------------
|
||||||
|
* Construiește SET pentru u1-u10 / u11-u20 etc.
|
||||||
|
* - originalul concatena escape($_POST + ",") greșit
|
||||||
|
* - aici cast la int + implode
|
||||||
|
* --------------------------------------------------------------------------- */
|
||||||
|
$fields = [];
|
||||||
|
for ($i = 1; $i <= 10; $i++) {
|
||||||
|
$unitId = $u + $i;
|
||||||
|
$val = (int)($_POST['u' . $unitId] ?? 0);
|
||||||
|
$fields[] = "u$unitId = $val";
|
||||||
|
}
|
||||||
|
|
||||||
|
$q = "UPDATE " . TB_PREFIX . "units SET " . implode(", ", $fields) . " WHERE vref = $id";
|
||||||
$database->query($q);
|
$database->query($q);
|
||||||
$database->query("Insert into ".TB_PREFIX."admin_log values (0,".(int) $_SESSION['id'].",'Changed troop amounts in village <a href=\'admin.php?p=village&did=$id\'>$id</a> ',".time().")");
|
|
||||||
|
/* ---------------------------------------------------------------------------
|
||||||
|
* Log admin - adaptat pentru tabelul tău
|
||||||
|
* --------------------------------------------------------------------------- */
|
||||||
|
$adminId = (string)(int)$_SESSION['id'];
|
||||||
|
$time = time();
|
||||||
|
$logText = "Changed troop amounts in village <a href='admin.php?p=village&did=$id'>$id</a>";
|
||||||
|
|
||||||
|
$adminIdEsc = $database->escape($adminId);
|
||||||
|
$logEsc = $database->escape($logText);
|
||||||
|
|
||||||
|
$database->query(
|
||||||
|
"INSERT INTO " . TB_PREFIX . "admin_log (`id`, `user`, `log`, `time`) " .
|
||||||
|
"VALUES (0, '$adminIdEsc', '$logEsc', $time)"
|
||||||
|
);
|
||||||
|
|
||||||
$database->addStarvationData($id);
|
$database->addStarvationData($id);
|
||||||
|
|
||||||
header("Location: ../../../Admin/admin.php?p=village&did=" . $id . "&d");
|
header("Location: ../../../Admin/admin.php?p=village&did=" . $id . "&d");
|
||||||
|
exit;
|
||||||
?>
|
?>
|
||||||
@@ -1,5 +1,17 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
#################################################################################
|
||||||
|
## -= YOU MAY NOT REMOVE OR CHANGE THIS NOTICE =- ##
|
||||||
|
## --------------------------------------------------------------------------- ##
|
||||||
|
## Filename addUser.php ##
|
||||||
|
## Type BACKEND ##
|
||||||
|
## Developed by: Dzoki & Advocatie ##
|
||||||
|
## License: TravianZ Project ##
|
||||||
|
## Reworks by: ronix ##
|
||||||
|
## Copyright: TravianZ (c) 2010-2025. All rights reserved. ##
|
||||||
|
## ##
|
||||||
|
#################################################################################
|
||||||
|
|
||||||
use App\Entity\User;
|
use App\Entity\User;
|
||||||
|
|
||||||
// go max 5 levels up - we don't have folders that go deeper than that
|
// go max 5 levels up - we don't have folders that go deeper than that
|
||||||
|
|||||||
@@ -5,6 +5,7 @@
|
|||||||
## --------------------------------------------------------------------------- ##
|
## --------------------------------------------------------------------------- ##
|
||||||
## Project: TravianZ (Refactor incremental) ##
|
## Project: TravianZ (Refactor incremental) ##
|
||||||
## File: additional.tpl ##
|
## File: additional.tpl ##
|
||||||
|
## Type BACKEND ##
|
||||||
## Description: Implement Gold Log ##
|
## Description: Implement Gold Log ##
|
||||||
## Made by: Shadow ##
|
## Made by: Shadow ##
|
||||||
## License: TravianZ Project ##
|
## License: TravianZ Project ##
|
||||||
|
|||||||
@@ -8,33 +8,60 @@
|
|||||||
## Copyright: TravianZ (c) 2010-2025. All rights reserved. ##
|
## Copyright: TravianZ (c) 2010-2025. All rights reserved. ##
|
||||||
## ##
|
## ##
|
||||||
#################################################################################
|
#################################################################################
|
||||||
if (!isset($_SESSION)) session_start();
|
|
||||||
if($_SESSION['access'] < 9) die("Access Denied: You are not Admin!");
|
|
||||||
include_once("../../config.php");
|
|
||||||
|
|
||||||
// go max 5 levels up - we don't have folders that go deeper than that
|
if (!isset($_SESSION)) {
|
||||||
|
session_start();
|
||||||
|
}
|
||||||
|
if (empty($_SESSION['access']) || $_SESSION['access'] < 9) {
|
||||||
|
die("Access Denied: You are not Admin!");
|
||||||
|
}
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
// Autoloader path
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
$autoprefix = '';
|
$autoprefix = '';
|
||||||
for ($i = 0; $i < 5; $i++) {
|
for ($i = 0; $i < 5; $i++) {
|
||||||
$autoprefix = str_repeat('../', $i);
|
$autoprefix = str_repeat('../', $i);
|
||||||
if (file_exists($autoprefix . 'autoloader.php')) {
|
if (file_exists($autoprefix . 'autoloader.php')) {
|
||||||
// we have our path, let's leave
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
include_once($autoprefix . "GameEngine/config.php");
|
||||||
include_once($autoprefix . "GameEngine/Database.php");
|
include_once($autoprefix . "GameEngine/Database.php");
|
||||||
|
|
||||||
$delete = (int) $_POST['medalid'];
|
// ---------------------------------------------------------------------------
|
||||||
$aid =(int) $_POST['aid'];
|
// Input
|
||||||
$session = (int) $_POST['admid'];
|
// ---------------------------------------------------------------------------
|
||||||
|
$delete = (int)($_POST['medalid'] ?? 0); // id din allimedal
|
||||||
|
$aid = (int)($_POST['aid'] ?? 0); // id alianță
|
||||||
|
$session = (int)($_POST['admid'] ?? 0);
|
||||||
|
|
||||||
$sql = mysqli_query($GLOBALS["link"], "SELECT * FROM ".TB_PREFIX."users WHERE id = ".$session."");
|
if ($delete <= 0 || $aid <= 0) {
|
||||||
$access = mysqli_fetch_array($sql);
|
header("Location: ../../../Admin/admin.php?p=alliance&aid=$aid&e=bad");
|
||||||
$sessionaccess = $access['access'];
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
if($sessionaccess != 9) die("<h1><font color=\"red\">Access Denied: You are not Admin!</font></h1>");
|
// ---------------------------------------------------------------------------
|
||||||
|
// Verificare admin - păstrăm logica originală
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
$admin = $database->getUserArray($session, 1);
|
||||||
|
if (!$admin || (int)$admin['access'] !== 9) {
|
||||||
|
die('<h1><font color="red">Access Denied: You are not Admin!</font></h1>');
|
||||||
|
}
|
||||||
|
|
||||||
mysqli_query($GLOBALS["link"], "UPDATE ".TB_PREFIX."allimedal set del = 1 WHERE id = ".$delete."");
|
// ---------------------------------------------------------------------------
|
||||||
|
// Ștergere logică medalie alianță
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
$database->query("UPDATE ".TB_PREFIX."allimedal SET del = 1 WHERE id = $delete AND allyid = $aid");
|
||||||
|
|
||||||
header("Location: ../../../Admin/admin.php?p=alliance&aid=".$aid."");
|
// ---------------------------------------------------------------------------
|
||||||
|
// Log admin
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
$adminId = (int)$_SESSION['id'];
|
||||||
|
$log = $database->escape("Deleted ally medal #$delete (affected $affected) for ally $aid");
|
||||||
|
$database->query("INSERT INTO ".TB_PREFIX."admin_log (`id`,`user`,`log`,`time`) VALUES (0,'$adminId','$log',".time().")");
|
||||||
|
|
||||||
|
header("Location: ../../../Admin/admin.php?p=alliance&aid=" . $aid);
|
||||||
|
exit;
|
||||||
?>
|
?>
|
||||||
@@ -8,33 +8,66 @@
|
|||||||
## Copyright: TravianZ (c) 2010-2025. All rights reserved. ##
|
## Copyright: TravianZ (c) 2010-2025. All rights reserved. ##
|
||||||
## ##
|
## ##
|
||||||
#################################################################################
|
#################################################################################
|
||||||
if (!isset($_SESSION)) session_start();
|
|
||||||
if($_SESSION['access'] < 9) die("Access Denied: You are not Admin!");
|
|
||||||
include_once("../../config.php");
|
|
||||||
|
|
||||||
// go max 5 levels up - we don't have folders that go deeper than that
|
if (!isset($_SESSION)) {
|
||||||
|
session_start();
|
||||||
|
}
|
||||||
|
if (empty($_SESSION['access']) || $_SESSION['access'] < 9) {
|
||||||
|
die("Access Denied: You are not Admin!");
|
||||||
|
}
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
// Autoloader path
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
$autoprefix = '';
|
$autoprefix = '';
|
||||||
for ($i = 0; $i < 5; $i++) {
|
for ($i = 0; $i < 5; $i++) {
|
||||||
$autoprefix = str_repeat('../', $i);
|
$autoprefix = str_repeat('../', $i);
|
||||||
if (file_exists($autoprefix . 'autoloader.php')) {
|
if (file_exists($autoprefix . 'autoloader.php')) {
|
||||||
// we have our path, let's leave
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
include_once($autoprefix . "GameEngine/config.php");
|
||||||
include_once($autoprefix . "GameEngine/Database.php");
|
include_once($autoprefix . "GameEngine/Database.php");
|
||||||
|
|
||||||
$allyid =(int) $_POST['allyid'];
|
// ---------------------------------------------------------------------------
|
||||||
$aid = (int) $_POST['aid'];
|
// Input - folosim un singur ID pentru alianță
|
||||||
$session = (int) $_POST['admid'];
|
// ---------------------------------------------------------------------------
|
||||||
|
$aid = (int)($_POST['aid'] ?? $_POST['allyid'] ?? 0);
|
||||||
|
$session = (int)($_POST['admid'] ?? 0);
|
||||||
|
|
||||||
$sql = mysqli_query($GLOBALS["link"], "SELECT * FROM ".TB_PREFIX."users WHERE id = ".$session."");
|
if ($aid <= 0 || $session <= 0) {
|
||||||
$access = mysqli_fetch_array($sql);
|
header("Location: ../../../Admin/admin.php?p=alliance&aid=" . $aid . "&e=bad");
|
||||||
$sessionaccess = $access['access'];
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
if($sessionaccess != 9) die("<h1><font color=\"red\">Access Denied: You are not Admin!</font></h1>");
|
// ---------------------------------------------------------------------------
|
||||||
|
// Verificare admin
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
$admin = $database->getUserArray($session, 1);
|
||||||
|
if (!$admin || (int)$admin['access'] !== 9) {
|
||||||
|
die('<h1><font color="red">Access Denied: You are not Admin!</font></h1>');
|
||||||
|
}
|
||||||
|
|
||||||
mysqli_query($GLOBALS["link"], "UPDATE ".TB_PREFIX."allimedal set del = 1 WHERE allyid = ".$aid."");
|
// ---------------------------------------------------------------------------
|
||||||
|
// Ștergere logică - toate medaliile alianței
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
$database->query("UPDATE " . TB_PREFIX . "allimedal SET del = 1 WHERE allyid = $aid AND del = 0");
|
||||||
|
$affected = mysqli_affected_rows($database->dblink);
|
||||||
|
|
||||||
header("Location: ../../../Admin/admin.php?p=alliance&aid=".$aid."");
|
// ---------------------------------------------------------------------------
|
||||||
|
// Log admin
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
$adminId = (int)$_SESSION['id'];
|
||||||
|
$time = time();
|
||||||
|
$logText = "Deleted all medals ($affected) for alliance <a href='admin.php?p=alliance&aid=$aid'>$aid</a>";
|
||||||
|
$logEsc = $database->escape($logText);
|
||||||
|
|
||||||
|
$database->query(
|
||||||
|
"INSERT INTO " . TB_PREFIX . "admin_log (`id`, `user`, `log`, `time`) " .
|
||||||
|
"VALUES (0, '$adminId', '$logEsc', $time)"
|
||||||
|
);
|
||||||
|
|
||||||
|
header("Location: ../../../Admin/admin.php?p=alliance&aid=" . $aid . "&deleted=$affected");
|
||||||
|
exit;
|
||||||
?>
|
?>
|
||||||
@@ -8,32 +8,66 @@
|
|||||||
## Copyright: TravianZ (c) 2010-2025. All rights reserved. ##
|
## Copyright: TravianZ (c) 2010-2025. All rights reserved. ##
|
||||||
## ##
|
## ##
|
||||||
#################################################################################
|
#################################################################################
|
||||||
if (!isset($_SESSION)) session_start();
|
|
||||||
if($_SESSION['access'] < 9) die("Access Denied: You are not Admin!");
|
|
||||||
include_once("../../config.php");
|
|
||||||
|
|
||||||
// go max 5 levels up - we don't have folders that go deeper than that
|
if (!isset($_SESSION)) {
|
||||||
|
session_start();
|
||||||
|
}
|
||||||
|
if (empty($_SESSION['access']) || $_SESSION['access'] < 9) {
|
||||||
|
die("Access Denied: You are not Admin!");
|
||||||
|
}
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
// Autoloader path
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
$autoprefix = '';
|
$autoprefix = '';
|
||||||
for ($i = 0; $i < 5; $i++) {
|
for ($i = 0; $i < 5; $i++) {
|
||||||
$autoprefix = str_repeat('../', $i);
|
$autoprefix = str_repeat('../', $i);
|
||||||
if (file_exists($autoprefix . 'autoloader.php')) {
|
if (file_exists($autoprefix . 'autoloader.php')) {
|
||||||
// we have our path, let's leave
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
include_once($autoprefix . "GameEngine/config.php");
|
||||||
include_once($autoprefix . "GameEngine/Database.php");
|
include_once($autoprefix . "GameEngine/Database.php");
|
||||||
|
|
||||||
$deleteweek = (int) $_POST['deleteweek'];
|
// ---------------------------------------------------------------------------
|
||||||
$session = (int) $_POST['admid'];
|
// Input
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
$deleteweek = (int)($_POST['deleteweek'] ?? 0);
|
||||||
|
$session = (int)($_POST['admid'] ?? 0);
|
||||||
|
|
||||||
$sql = mysqli_query($GLOBALS["link"], "SELECT * FROM ".TB_PREFIX."users WHERE id = ".$session."");
|
if ($deleteweek <= 0 || $session <= 0) {
|
||||||
$access = mysqli_fetch_array($sql);
|
header("Location: ../../../Admin/admin.php?p=delallymedal&e=bad");
|
||||||
$sessionaccess = $access['access'];
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
if($sessionaccess != 9) die("<h1><font color=\"red\">Access Denied: You are not Admin!</font></h1>");
|
// ---------------------------------------------------------------------------
|
||||||
|
// Verificare admin
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
$admin = $database->getUserArray($session, 1);
|
||||||
|
if (!$admin || (int)$admin['access'] !== 9) {
|
||||||
|
die('<h1><font color="red">Access Denied: You are not Admin!</font></h1>');
|
||||||
|
}
|
||||||
|
|
||||||
mysqli_query($GLOBALS["link"], "UPDATE ".TB_PREFIX."allimedal set del = 1 WHERE week = ".$deleteweek."");
|
// ---------------------------------------------------------------------------
|
||||||
|
// Ștergere logică pe săptămână
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
$database->query("UPDATE " . TB_PREFIX . "allimedal SET del = 1 WHERE week = $deleteweek AND del = 0");
|
||||||
|
$affected = mysqli_affected_rows($database->dblink);
|
||||||
|
|
||||||
header("Location: ../../../Admin/admin.php?p=delallymedal");
|
// ---------------------------------------------------------------------------
|
||||||
|
// Log admin
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
$adminId = (int)$_SESSION['id'];
|
||||||
|
$time = time();
|
||||||
|
$logText = "Deleted all alliance medals for week $deleteweek ($affected rows)";
|
||||||
|
$logEsc = $database->escape($logText);
|
||||||
|
|
||||||
|
$database->query(
|
||||||
|
"INSERT INTO " . TB_PREFIX . "admin_log (`id`, `user`, `log`, `time`) " .
|
||||||
|
"VALUES (0, '$adminId', '$logEsc', $time)"
|
||||||
|
);
|
||||||
|
|
||||||
|
header("Location: ../../../Admin/admin.php?p=delallymedal&week=$deleteweek&deleted=$affected");
|
||||||
|
exit;
|
||||||
?>
|
?>
|
||||||
@@ -8,32 +8,66 @@
|
|||||||
## Copyright: TravianZ (c) 2010-2025. All rights reserved. ##
|
## Copyright: TravianZ (c) 2010-2025. All rights reserved. ##
|
||||||
## ##
|
## ##
|
||||||
##################################################################################
|
##################################################################################
|
||||||
if (!isset($_SESSION)) session_start();
|
|
||||||
if($_SESSION['access'] < 9) die("Access Denied: You are not Admin!");
|
|
||||||
include_once("../../config.php");
|
|
||||||
|
|
||||||
// go max 5 levels up - we don't have folders that go deeper than that
|
if (!isset($_SESSION)) {
|
||||||
|
session_start();
|
||||||
|
}
|
||||||
|
if (empty($_SESSION['access']) || $_SESSION['access'] < 9) {
|
||||||
|
die("Access Denied: You are not Admin!");
|
||||||
|
}
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
// Autoloader path
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
$autoprefix = '';
|
$autoprefix = '';
|
||||||
for ($i = 0; $i < 5; $i++) {
|
for ($i = 0; $i < 5; $i++) {
|
||||||
$autoprefix = str_repeat('../', $i);
|
$autoprefix = str_repeat('../', $i);
|
||||||
if (file_exists($autoprefix . 'autoloader.php')) {
|
if (file_exists($autoprefix . 'autoloader.php')) {
|
||||||
// we have our path, let's leave
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
include_once($autoprefix . "GameEngine/config.php");
|
||||||
include_once($autoprefix . "GameEngine/Database.php");
|
include_once($autoprefix . "GameEngine/Database.php");
|
||||||
|
|
||||||
$deleteweek = (int) $_POST['medalweek'];
|
// ---------------------------------------------------------------------------
|
||||||
$session = (int) $_POST['admid'];
|
// Input
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
$deleteweek = (int)($_POST['medalweek'] ?? 0);
|
||||||
|
$session = (int)($_POST['admid'] ?? 0);
|
||||||
|
|
||||||
$sql = mysqli_query($GLOBALS["link"], "SELECT * FROM ".TB_PREFIX."users WHERE id = ".$session."");
|
if ($deleteweek <= 0 || $session <= 0) {
|
||||||
$access = mysqli_fetch_array($sql);
|
header("Location: ../../../Admin/admin.php?p=delmedal&e=bad");
|
||||||
$sessionaccess = $access['access'];
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
if($sessionaccess != 9) die("<h1><font color=\"red\">Access Denied: You are not Admin!</font></h1>");
|
// ---------------------------------------------------------------------------
|
||||||
|
// Verificare admin
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
$admin = $database->getUserArray($session, 1);
|
||||||
|
if (!$admin || (int)$admin['access'] !== 9) {
|
||||||
|
die('<h1><font color="red">Access Denied: You are not Admin!</font></h1>');
|
||||||
|
}
|
||||||
|
|
||||||
mysqli_query($GLOBALS["link"], "UPDATE ".TB_PREFIX."medal set del = 1 WHERE week = ".$deleteweek."");
|
// ---------------------------------------------------------------------------
|
||||||
|
// Ștergere logică - medalii jucători pe săptămână
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
$database->query("UPDATE " . TB_PREFIX . "medal SET del = 1 WHERE week = $deleteweek AND del = 0");
|
||||||
|
$affected = mysqli_affected_rows($database->dblink);
|
||||||
|
|
||||||
header("Location: ../../../Admin/admin.php?p=delmedal");
|
// ---------------------------------------------------------------------------
|
||||||
|
// Log admin
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
$adminId = (int)$_SESSION['id'];
|
||||||
|
$time = time();
|
||||||
|
$logText = "Deleted player medals for week $deleteweek ($affected rows)";
|
||||||
|
$logEsc = $database->escape($logText);
|
||||||
|
|
||||||
|
$database->query(
|
||||||
|
"INSERT INTO " . TB_PREFIX . "admin_log (`id`, `user`, `log`, `time`) " .
|
||||||
|
"VALUES (0, '$adminId', '$logEsc', $time)"
|
||||||
|
);
|
||||||
|
|
||||||
|
header("Location: ../../../Admin/admin.php?p=delmedal&week=$deleteweek&deleted=$affected");
|
||||||
|
exit;
|
||||||
?>
|
?>
|
||||||
@@ -3,6 +3,7 @@
|
|||||||
## -= YOU MAY NOT REMOVE OR CHANGE THIS NOTICE =- ##
|
## -= YOU MAY NOT REMOVE OR CHANGE THIS NOTICE =- ##
|
||||||
## --------------------------------------------------------------------------- ##
|
## --------------------------------------------------------------------------- ##
|
||||||
## Filename editBuildings.php ##
|
## Filename editBuildings.php ##
|
||||||
|
## Type BACKEND ##
|
||||||
## Developed by: aggenkeech ##
|
## Developed by: aggenkeech ##
|
||||||
## Fix by: ronix ##
|
## Fix by: ronix ##
|
||||||
## License: TravianZ Project ##
|
## License: TravianZ Project ##
|
||||||
@@ -10,113 +11,77 @@
|
|||||||
## ##
|
## ##
|
||||||
#################################################################################
|
#################################################################################
|
||||||
|
|
||||||
if(!isset($_SESSION)) session_start();
|
if (!isset($_SESSION)) {
|
||||||
if($_SESSION['access'] < 9) die("<h1><font color=\"red\">Access Denied: You are not Admin!</font></h1>");
|
session_start();
|
||||||
|
}
|
||||||
|
if (empty($_SESSION['access']) || $_SESSION['access'] < 9) {
|
||||||
|
die('<h1><font color="red">Access Denied: You are not Admin!</font></h1>');
|
||||||
|
}
|
||||||
|
|
||||||
include_once("../../config.php");
|
include_once("../../config.php");
|
||||||
|
|
||||||
// go max 5 levels up - we don't have folders that go deeper than that
|
// ---------------------------------------------------------------------------
|
||||||
|
// Autoloader path
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
$autoprefix = '';
|
$autoprefix = '';
|
||||||
for ($i = 0; $i < 5; $i++) {
|
for ($i = 0; $i < 5; $i++) {
|
||||||
$autoprefix = str_repeat('../', $i);
|
$autoprefix = str_repeat('../', $i);
|
||||||
if (file_exists($autoprefix . 'autoloader.php')) {
|
if (file_exists($autoprefix . 'autoloader.php')) {
|
||||||
// we have our path, let's leave
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
include_once($autoprefix . "GameEngine/Database.php");
|
include_once($autoprefix . "GameEngine/Database.php");
|
||||||
|
include_once($autoprefix . "GameEngine/Automation.php");
|
||||||
|
|
||||||
foreach ($_POST as $key => $value) {
|
// ---------------------------------------------------------------------------
|
||||||
$_POST[$key] = $database->escape($value);
|
// Input
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
$id = (int)($_POST['id'] ?? 0);
|
||||||
|
if ($id <= 0) {
|
||||||
|
header("Location: ../../../Admin/admin.php?p=admin");
|
||||||
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
$id = (int) $_POST['id'];
|
// ---------------------------------------------------------------------------
|
||||||
|
// Construim SET-ul dinamic pentru f1-f40 și f99
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
$sets = [];
|
||||||
|
for ($i = 1; $i <= 40; $i++) {
|
||||||
|
$level = (int)($_POST["id{$i}level"] ?? 0);
|
||||||
|
$gid = (int)($_POST["id{$i}gid"] ?? 0);
|
||||||
|
// limităm la valori rezonabile Travian
|
||||||
|
$level = max(0, min(20, $level));
|
||||||
|
$gid = max(0, min(40, $gid));
|
||||||
|
$sets[] = "f{$i} = $level";
|
||||||
|
$sets[] = "f{$i}t = $gid";
|
||||||
|
}
|
||||||
|
|
||||||
mysqli_query($GLOBALS["link"], "UPDATE ".TB_PREFIX."fdata SET
|
// câmpurile speciale f99 (capcană / zid?)
|
||||||
f1 = '".$_POST['id1level']."',
|
$level99 = (int)($_POST['id99level'] ?? 0);
|
||||||
f1t = '".$_POST['id1gid']."',
|
$gid99 = (int)($_POST['id99gid'] ?? 0);
|
||||||
f2 = '".$_POST['id2level']."',
|
$sets[] = "f99 = " . max(0, min(20, $level99));
|
||||||
f2t = '".$_POST['id2gid']."',
|
$sets[] = "f99t = " . max(0, min(40, $gid99));
|
||||||
f3 = '".$_POST['id3level']."',
|
|
||||||
f3t = '".$_POST['id3gid']."',
|
|
||||||
f4 = '".$_POST['id4level']."',
|
|
||||||
f4t = '".$_POST['id4gid']."',
|
|
||||||
f5 = '".$_POST['id5level']."',
|
|
||||||
f5t = '".$_POST['id5gid']."',
|
|
||||||
f6 = '".$_POST['id6level']."',
|
|
||||||
f6t = '".$_POST['id6gid']."',
|
|
||||||
f7 = '".$_POST['id7level']."',
|
|
||||||
f7t = '".$_POST['id7gid']."',
|
|
||||||
f8 = '".$_POST['id8level']."',
|
|
||||||
f8t = '".$_POST['id8gid']."',
|
|
||||||
f9 = '".$_POST['id9level']."',
|
|
||||||
f9t = '".$_POST['id9gid']."',
|
|
||||||
f10 = '".$_POST['id10level']."',
|
|
||||||
f10t = '".$_POST['id10gid']."',
|
|
||||||
f11 = '".$_POST['id11level']."',
|
|
||||||
f11t = '".$_POST['id11gid']."',
|
|
||||||
f12 = '".$_POST['id12level']."',
|
|
||||||
f12t = '".$_POST['id12gid']."',
|
|
||||||
f13 = '".$_POST['id13level']."',
|
|
||||||
f13t = '".$_POST['id13gid']."',
|
|
||||||
f14 = '".$_POST['id14level']."',
|
|
||||||
f14t = '".$_POST['id14gid']."',
|
|
||||||
f15 = '".$_POST['id15level']."',
|
|
||||||
f15t = '".$_POST['id15gid']."',
|
|
||||||
f16 = '".$_POST['id16level']."',
|
|
||||||
f16t = '".$_POST['id16gid']."',
|
|
||||||
f17 = '".$_POST['id17level']."',
|
|
||||||
f17t = '".$_POST['id17gid']."',
|
|
||||||
f18 = '".$_POST['id18level']."',
|
|
||||||
f18t = '".$_POST['id18gid']."',
|
|
||||||
f19 = '".$_POST['id19level']."',
|
|
||||||
f19t = '".$_POST['id19gid']."',
|
|
||||||
f20 = '".$_POST['id20level']."',
|
|
||||||
f20t = '".$_POST['id20gid']."',
|
|
||||||
f21 = '".$_POST['id21level']."',
|
|
||||||
f21t = '".$_POST['id21gid']."',
|
|
||||||
f22 = '".$_POST['id22level']."',
|
|
||||||
f22t = '".$_POST['id22gid']."',
|
|
||||||
f23 = '".$_POST['id23level']."',
|
|
||||||
f23t = '".$_POST['id23gid']."',
|
|
||||||
f24 = '".$_POST['id24level']."',
|
|
||||||
f24t = '".$_POST['id24gid']."',
|
|
||||||
f25 = '".$_POST['id25level']."',
|
|
||||||
f25t = '".$_POST['id25gid']."',
|
|
||||||
f26 = '".$_POST['id26level']."',
|
|
||||||
f26t = '".$_POST['id26gid']."',
|
|
||||||
f27 = '".$_POST['id27level']."',
|
|
||||||
f27t = '".$_POST['id27gid']."',
|
|
||||||
f28 = '".$_POST['id28level']."',
|
|
||||||
f28t = '".$_POST['id28gid']."',
|
|
||||||
f29 = '".$_POST['id29level']."',
|
|
||||||
f29t = '".$_POST['id29gid']."',
|
|
||||||
f30 = '".$_POST['id30level']."',
|
|
||||||
f30t = '".$_POST['id30gid']."',
|
|
||||||
f31 = '".$_POST['id31level']."',
|
|
||||||
f31t = '".$_POST['id31gid']."',
|
|
||||||
f32 = '".$_POST['id32level']."',
|
|
||||||
f32t = '".$_POST['id32gid']."',
|
|
||||||
f33 = '".$_POST['id33level']."',
|
|
||||||
f33t = '".$_POST['id33gid']."',
|
|
||||||
f34 = '".$_POST['id34level']."',
|
|
||||||
f34t = '".$_POST['id34gid']."',
|
|
||||||
f35 = '".$_POST['id35level']."',
|
|
||||||
f35t = '".$_POST['id35gid']."',
|
|
||||||
f36 = '".$_POST['id36level']."',
|
|
||||||
f36t = '".$_POST['id36gid']."',
|
|
||||||
f37 = '".$_POST['id37level']."',
|
|
||||||
f37t = '".$_POST['id37gid']."',
|
|
||||||
f38 = '".$_POST['id38level']."',
|
|
||||||
f38t = '".$_POST['id38gid']."',
|
|
||||||
f39 = '".$_POST['id39level']."',
|
|
||||||
f39t = '".$_POST['id39gid']."',
|
|
||||||
f40 = '".$_POST['id40level']."',
|
|
||||||
f40t = '".$_POST['id40gid']."',
|
|
||||||
f99 = '".$_POST['id99level']."',
|
|
||||||
f99t = '".$_POST['id99gid']."'
|
|
||||||
WHERE vref = $id") or die(mysqli_error($database->dblink));
|
|
||||||
|
|
||||||
header("Location: ../../../Admin/admin.php?p=village&did=".$id."");
|
$setSql = implode(', ', $sets);
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
// Update
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
$database->query("UPDATE " . TB_PREFIX . "fdata SET $setSql WHERE vref = $id");
|
||||||
|
|
||||||
|
// recalculăm populația după editare
|
||||||
|
$automation = new Automation();
|
||||||
|
$automation->recountPop($id);
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
// Log admin
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
$adminId = (int)$_SESSION['id'];
|
||||||
|
$time = time();
|
||||||
|
$log = $database->escape("Edited buildings for village <a href='admin.php?p=village&did=$id'>$id</a>");
|
||||||
|
$database->query("INSERT INTO " . TB_PREFIX . "admin_log (`id`,`user`,`log`,`time`) VALUES (0,'$adminId','$log',$time)");
|
||||||
|
|
||||||
|
header("Location: ../../../Admin/admin.php?p=village&did=" . $id);
|
||||||
|
exit;
|
||||||
?>
|
?>
|
||||||
@@ -2,7 +2,8 @@
|
|||||||
#################################################################################
|
#################################################################################
|
||||||
## -= YOU MAY NOT REMOVE OR CHANGE THIS NOTICE =- ##
|
## -= YOU MAY NOT REMOVE OR CHANGE THIS NOTICE =- ##
|
||||||
## --------------------------------------------------------------------------- ##
|
## --------------------------------------------------------------------------- ##
|
||||||
## Filename addTroops.php ##
|
## Filename editHero.php ##
|
||||||
|
## Type BACKEND ##
|
||||||
## Developed by: Dzoki & Advocatie ##
|
## Developed by: Dzoki & Advocatie ##
|
||||||
## License: TravianZ Project ##
|
## License: TravianZ Project ##
|
||||||
## Reworks by: ronix ##
|
## Reworks by: ronix ##
|
||||||
@@ -10,34 +11,88 @@
|
|||||||
## ##
|
## ##
|
||||||
#################################################################################
|
#################################################################################
|
||||||
|
|
||||||
if(!isset($_SESSION)) session_start();
|
if (!isset($_SESSION)) {
|
||||||
if($_SESSION['access'] < 9) die("Access Denied: You are not Admin!");
|
session_start();
|
||||||
include_once("../../Database.php");
|
}
|
||||||
$status="&ce=1";
|
if (empty($_SESSION['access']) || $_SESSION['access'] < 9) {
|
||||||
|
die("Access Denied: You are not Admin!");
|
||||||
foreach ($_POST as $key => $value) {
|
|
||||||
$_POST[$key] = $database->escape($value);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(isset($_POST['id']) && isset($_POST['hid'])) {
|
// ---------------------------------------------------------------------------
|
||||||
$_POST['hname'] = trim(stripslashes($_POST['hname']));
|
// Autoloader path
|
||||||
if ($_POST['hname']=="") {
|
// ---------------------------------------------------------------------------
|
||||||
header("Location: ../../../Admin/admin.php?p=editHero&uid=".$_POST['id']."&e=1");
|
$autoprefix = '';
|
||||||
|
for ($i = 0; $i < 5; $i++) {
|
||||||
|
$autoprefix = str_repeat('../', $i);
|
||||||
|
if (file_exists($autoprefix . 'autoloader.php')) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
include_once($autoprefix . "GameEngine/config.php");
|
||||||
|
include_once($autoprefix . "GameEngine/Database.php");
|
||||||
|
include_once($autoprefix . "GameEngine/Data/hero_full.php");
|
||||||
|
|
||||||
|
$status = "&ce=1";
|
||||||
|
|
||||||
|
if (isset($_POST['id'], $_POST['hid'])) {
|
||||||
|
$id = (int)$_POST['id'];
|
||||||
|
$hid = (int)$_POST['hid'];
|
||||||
|
$hname = trim($_POST['hname'] ?? '');
|
||||||
|
|
||||||
|
if ($hname === '') {
|
||||||
|
header("Location: ../../../Admin/admin.php?p=editHero&uid=$id&e=1");
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
include_once("../../Data/hero_full.php");
|
// Input curat - cast individual, NU escape global
|
||||||
|
$hunit = (int)($_POST['hunit'] ?? 0);
|
||||||
|
$hlvl = max(0, min(100, (int)($_POST['hlvl'] ?? 0)));
|
||||||
|
$exp = (int)($_POST['exp'] ?? 0);
|
||||||
|
$hhealth = (float)($_POST['hhealth'] ?? 100);
|
||||||
|
$hatk = (int)($_POST['hatk'] ?? 0);
|
||||||
|
$hdef = (int)($_POST['hdef'] ?? 0);
|
||||||
|
$hob = (int)($_POST['hob'] ?? 0);
|
||||||
|
$hdb = (int)($_POST['hdb'] ?? 0);
|
||||||
|
$hrege = (int)($_POST['hrege'] ?? 0);
|
||||||
|
|
||||||
$id = (int) $_POST['id'];
|
$experience = isset($hero_levels[$hlvl]) ? (int)$hero_levels[$hlvl] : 0;
|
||||||
$hid = (int) $_POST['hid'];
|
$hnameEsc = $database->escape($hname);
|
||||||
|
|
||||||
|
$q = "UPDATE " . TB_PREFIX . "hero SET
|
||||||
|
unit = $hunit,
|
||||||
|
name = '$hnameEsc',
|
||||||
|
level = $hlvl,
|
||||||
|
points = $exp,
|
||||||
|
experience = $experience,
|
||||||
|
health = '$hhealth',
|
||||||
|
attack = $hatk,
|
||||||
|
defence = $hdef,
|
||||||
|
attackbonus = $hob,
|
||||||
|
defencebonus = $hdb,
|
||||||
|
regeneration = $hrege
|
||||||
|
WHERE heroid = $hid AND uid = $id";
|
||||||
|
|
||||||
$q = "UPDATE ".TB_PREFIX."hero SET unit=".(int) $_POST['hunit'].", name='".$_POST['hname']."', level=".(int) $_POST['hlvl'].", points=".(int) $_POST['exp'].", experience=".(int) $hero_levels[$_POST['hlvl']].", health='".$_POST['hhealth']."',
|
|
||||||
attack=".(int) $_POST['hatk'].", defence=".(int) $_POST['hdef'].", attackbonus=".(int) $_POST['hob'].", defencebonus=".(int) $_POST['hdb'].", regeneration=".(int) $_POST['hrege']." WHERE heroid = ".$hid." AND uid = ".$id;
|
|
||||||
$return = $database->query($q);
|
$return = $database->query($q);
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
// Log admin - adaptat pentru tabelul tău
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
if ($return) {
|
if ($return) {
|
||||||
$database->query("Insert into ".TB_PREFIX."admin_log values (0,".(int) $_SESSION['id'].",'Changed hero info',".time().")");
|
$adminId = (int)$_SESSION['id'];
|
||||||
|
$time = time();
|
||||||
|
$logText = "Changed hero info for user <a href='admin.php?p=player&uid=$id'>$id</a> (hero $hid)";
|
||||||
|
$logEsc = $database->escape($logText);
|
||||||
|
|
||||||
|
$database->query(
|
||||||
|
"INSERT INTO " . TB_PREFIX . "admin_log (`id`, `user`, `log`, `time`) " .
|
||||||
|
"VALUES (0, '$adminId', '$logEsc', $time)"
|
||||||
|
);
|
||||||
$status = "&cs=1";
|
$status = "&cs=1";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
header("Location: ../../../Admin/admin.php?p=player&uid=".$id.$status);
|
|
||||||
|
header("Location: ../../../Admin/admin.php?p=player&uid=" . (int)$id . $status);
|
||||||
|
exit;
|
||||||
?>
|
?>
|
||||||
@@ -3,40 +3,74 @@
|
|||||||
## -= YOU MAY NOT REMOVE OR CHANGE THIS NOTICE =- ##
|
## -= YOU MAY NOT REMOVE OR CHANGE THIS NOTICE =- ##
|
||||||
## --------------------------------------------------------------------------- ##
|
## --------------------------------------------------------------------------- ##
|
||||||
## Filename editOverall.php ##
|
## Filename editOverall.php ##
|
||||||
|
## Type BACKEND ##
|
||||||
## Developed by: aggenkeech ##
|
## Developed by: aggenkeech ##
|
||||||
## License: TravianZ Project ##
|
## License: TravianZ Project ##
|
||||||
## Copyright: TravianZ (c) 2010-2025. All rights reserved. ##
|
## Copyright: TravianZ (c) 2010-2025. All rights reserved. ##
|
||||||
## ##
|
## ##
|
||||||
#################################################################################
|
#################################################################################
|
||||||
if (!isset($_SESSION)) session_start();
|
|
||||||
if($_SESSION['access'] < 9) die("Access Denied: You are not Admin!");
|
if (!isset($_SESSION)) {
|
||||||
|
session_start();
|
||||||
|
}
|
||||||
|
if (empty($_SESSION['access']) || $_SESSION['access'] < 9) {
|
||||||
|
die("Access Denied: You are not Admin!");
|
||||||
|
}
|
||||||
|
|
||||||
include_once("../../config.php");
|
include_once("../../config.php");
|
||||||
|
|
||||||
// go max 5 levels up - we don't have folders that go deeper than that
|
// ---------------------------------------------------------------------------
|
||||||
|
// Autoloader path
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
$autoprefix = '';
|
$autoprefix = '';
|
||||||
for ($i = 0; $i < 5; $i++) {
|
for ($i = 0; $i < 5; $i++) {
|
||||||
$autoprefix = str_repeat('../', $i);
|
$autoprefix = str_repeat('../', $i);
|
||||||
if (file_exists($autoprefix . 'autoloader.php')) {
|
if (file_exists($autoprefix . 'autoloader.php')) {
|
||||||
// we have our path, let's leave
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
include_once($autoprefix . "GameEngine/Database.php");
|
include_once($autoprefix . "GameEngine/Database.php");
|
||||||
|
|
||||||
$session = (int) $_POST['admid'];
|
// ---------------------------------------------------------------------------
|
||||||
$id = (int) $_POST['id'];
|
// Input
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
$session = (int)($_POST['admid'] ?? 0);
|
||||||
|
$id = (int)($_POST['id'] ?? 0);
|
||||||
|
$off = (int)($_POST['off'] ?? 0);
|
||||||
|
$def = (int)($_POST['def'] ?? 0);
|
||||||
|
|
||||||
$sql = mysqli_query($GLOBALS["link"], "SELECT * FROM ".TB_PREFIX."users WHERE id = ".$session."");
|
if ($id <= 0 || $session <= 0) {
|
||||||
$access = mysqli_fetch_array($sql);
|
header("Location: ../../../Admin/admin.php?p=player&uid=$id&e=bad");
|
||||||
$sessionaccess = $access['access'];
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
if($sessionaccess != 9) die("<h1><font color=\"red\">Access Denied: You are not Admin!</font></h1>");
|
// ---------------------------------------------------------------------------
|
||||||
|
// Verificare admin
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
$admin = $database->getUserArray($session, 1);
|
||||||
|
if (!$admin || (int)$admin['access'] !== 9) {
|
||||||
|
die('<h1><font color="red">Access Denied: You are not Admin!</font></h1>');
|
||||||
|
}
|
||||||
|
|
||||||
mysqli_query($GLOBALS["link"], "UPDATE ".TB_PREFIX."users SET
|
// ---------------------------------------------------------------------------
|
||||||
apall = '".(int) $_POST['off']."',
|
// Update
|
||||||
dpall = '".(int) $_POST['def']."'
|
// ---------------------------------------------------------------------------
|
||||||
WHERE id = $id") or die(mysqli_error($database->dblink));
|
$database->query("UPDATE " . TB_PREFIX . "users SET apall = $off, dpall = $def WHERE id = $id");
|
||||||
|
|
||||||
header("Location: ../../../Admin/admin.php?p=player&uid=".$id."");
|
// ---------------------------------------------------------------------------
|
||||||
|
// Log admin
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
$adminId = (int)$_SESSION['id'];
|
||||||
|
$time = time();
|
||||||
|
$logText = "Changed overall stats for user <a href='admin.php?p=player&uid=$id'>$id</a> (off=$off, def=$def)";
|
||||||
|
$logEsc = $database->escape($logText);
|
||||||
|
|
||||||
|
$database->query(
|
||||||
|
"INSERT INTO " . TB_PREFIX . "admin_log (`id`, `user`, `log`, `time`) " .
|
||||||
|
"VALUES (0, '$adminId', '$logEsc', $time)"
|
||||||
|
);
|
||||||
|
|
||||||
|
header("Location: ../../../Admin/admin.php?p=player&uid=" . $id);
|
||||||
|
exit;
|
||||||
?>
|
?>
|
||||||
@@ -3,40 +3,79 @@
|
|||||||
## -= YOU MAY NOT REMOVE OR CHANGE THIS NOTICE =- ##
|
## -= YOU MAY NOT REMOVE OR CHANGE THIS NOTICE =- ##
|
||||||
## --------------------------------------------------------------------------- ##
|
## --------------------------------------------------------------------------- ##
|
||||||
## Filename editPassword.php ##
|
## Filename editPassword.php ##
|
||||||
|
## Type BACKEND ##
|
||||||
## Developed by: aggenkeech ##
|
## Developed by: aggenkeech ##
|
||||||
## License: TravianZ Project ##
|
## License: TravianZ Project ##
|
||||||
## Copyright: TravianZ (c) 2010-2025. All rights reserved. ##
|
## Copyright: TravianZ (c) 2010-2025. All rights reserved. ##
|
||||||
## ##
|
## ##
|
||||||
#################################################################################
|
#################################################################################
|
||||||
if (!isset($_SESSION)) session_start();
|
|
||||||
if($_SESSION['access'] < 9) die("Access Denied: You are not Admin!");
|
if (!isset($_SESSION)) {
|
||||||
|
session_start();
|
||||||
|
}
|
||||||
|
if (empty($_SESSION['access']) || $_SESSION['access'] < 9) {
|
||||||
|
die("Access Denied: You are not Admin!");
|
||||||
|
}
|
||||||
|
|
||||||
include_once("../../config.php");
|
include_once("../../config.php");
|
||||||
|
|
||||||
// go max 5 levels up - we don't have folders that go deeper than that
|
// ---------------------------------------------------------------------------
|
||||||
|
// Autoloader path
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
$autoprefix = '';
|
$autoprefix = '';
|
||||||
for ($i = 0; $i < 5; $i++) {
|
for ($i = 0; $i < 5; $i++) {
|
||||||
$autoprefix = str_repeat('../', $i);
|
$autoprefix = str_repeat('../', $i);
|
||||||
if (file_exists($autoprefix . 'autoloader.php')) {
|
if (file_exists($autoprefix . 'autoloader.php')) {
|
||||||
// we have our path, let's leave
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
include_once($autoprefix . "GameEngine/Database.php");
|
include_once($autoprefix . "GameEngine/Database.php");
|
||||||
|
|
||||||
$session = (int) $_POST['admid'];
|
// ---------------------------------------------------------------------------
|
||||||
$id = (int) $_POST['uid'];
|
// Input
|
||||||
$pass = password_hash($_POST['newpw'], PASSWORD_BCRYPT, ['cost' => 12]);
|
// ---------------------------------------------------------------------------
|
||||||
|
$session = (int)($_POST['admid'] ?? 0);
|
||||||
|
$id = (int)($_POST['uid'] ?? 0);
|
||||||
|
$newpw = trim($_POST['newpw'] ?? '');
|
||||||
|
|
||||||
$sql = mysqli_query($GLOBALS["link"], "SELECT * FROM ".TB_PREFIX."users WHERE id = ".$session."");
|
if ($id <= 0 || $session <= 0 || $newpw === '') {
|
||||||
$access = mysqli_fetch_array($sql);
|
header("Location: ../../../Admin/admin.php?p=player&uid=$id&e=pw");
|
||||||
$sessionaccess = $access['access'];
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
if($sessionaccess != 9) die("<h1><font color=\"red\">Access Denied: You are not Admin!</font></h1>");
|
// ---------------------------------------------------------------------------
|
||||||
|
// Verificare admin
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
$admin = $database->getUserArray($session, 1);
|
||||||
|
if (!$admin || (int)$admin['access'] !== 9) {
|
||||||
|
die('<h1><font color="red">Access Denied: You are not Admin!</font></h1>');
|
||||||
|
}
|
||||||
|
|
||||||
mysqli_query($GLOBALS["link"], "UPDATE ".TB_PREFIX."users SET
|
// ---------------------------------------------------------------------------
|
||||||
password = '".$pass."'
|
// Hash parolă
|
||||||
WHERE id = $id") or die(mysqli_error($database->dblink));
|
// ---------------------------------------------------------------------------
|
||||||
|
$pass = password_hash($newpw, PASSWORD_BCRYPT, ['cost' => 12]);
|
||||||
|
$passEsc = $database->escape($pass);
|
||||||
|
|
||||||
header("Location: ../../../Admin/admin.php?p=player&uid=".$id."");
|
// ---------------------------------------------------------------------------
|
||||||
|
// Update
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
$database->query("UPDATE " . TB_PREFIX . "users SET password = '$passEsc' WHERE id = $id");
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
// Log admin
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
$adminId = (int)$_SESSION['id'];
|
||||||
|
$time = time();
|
||||||
|
$logText = "Changed password for user <a href='admin.php?p=player&uid=$id'>$id</a>";
|
||||||
|
$logEsc = $database->escape($logText);
|
||||||
|
|
||||||
|
$database->query(
|
||||||
|
"INSERT INTO " . TB_PREFIX . "admin_log (`id`, `user`, `log`, `time`) " .
|
||||||
|
"VALUES (0, '$adminId', '$logEsc', $time)"
|
||||||
|
);
|
||||||
|
|
||||||
|
header("Location: ../../../Admin/admin.php?p=player&uid=" . $id . "&pw=1");
|
||||||
|
exit;
|
||||||
?>
|
?>
|
||||||
@@ -3,45 +3,82 @@
|
|||||||
## -= YOU MAY NOT REMOVE OR CHANGE THIS NOTICE =- ##
|
## -= YOU MAY NOT REMOVE OR CHANGE THIS NOTICE =- ##
|
||||||
## --------------------------------------------------------------------------- ##
|
## --------------------------------------------------------------------------- ##
|
||||||
## Filename editPlus.php ##
|
## Filename editPlus.php ##
|
||||||
|
## Type BACKEND ##
|
||||||
## Developed by: aggenkeech ##
|
## Developed by: aggenkeech ##
|
||||||
## License: TravianZ Project ##
|
## License: TravianZ Project ##
|
||||||
## Copyright: TravianZ (c) 2010-2025. All rights reserved. ##
|
## Copyright: TravianZ (c) 2010-2025. All rights reserved. ##
|
||||||
## ##
|
## ##
|
||||||
#################################################################################
|
#################################################################################
|
||||||
if (!isset($_SESSION)) session_start();
|
|
||||||
if($_SESSION['access'] < 9) die("Access Denied: You are not Admin!");
|
if (!isset($_SESSION)) {
|
||||||
|
session_start();
|
||||||
|
}
|
||||||
|
if (empty($_SESSION['access']) || $_SESSION['access'] < 9) {
|
||||||
|
die("Access Denied: You are not Admin!");
|
||||||
|
}
|
||||||
|
|
||||||
include_once("../../config.php");
|
include_once("../../config.php");
|
||||||
|
|
||||||
// go max 5 levels up - we don't have folders that go deeper than that
|
// ---------------------------------------------------------------------------
|
||||||
|
// Autoloader path
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
$autoprefix = '';
|
$autoprefix = '';
|
||||||
for ($i = 0; $i < 5; $i++) {
|
for ($i = 0; $i < 5; $i++) {
|
||||||
$autoprefix = str_repeat('../', $i);
|
$autoprefix = str_repeat('../', $i);
|
||||||
if (file_exists($autoprefix . 'autoloader.php')) {
|
if (file_exists($autoprefix . 'autoloader.php')) {
|
||||||
// we have our path, let's leave
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
include_once($autoprefix . "GameEngine/Database.php");
|
include_once($autoprefix . "GameEngine/Database.php");
|
||||||
|
|
||||||
$id = (int) $_POST['id'];
|
// ---------------------------------------------------------------------------
|
||||||
|
// Input
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
$id = (int)($_POST['id'] ?? 0);
|
||||||
|
if ($id <= 0) {
|
||||||
|
header("Location: ../../../Admin/admin.php?p=search");
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
$bonusDuration = [];
|
|
||||||
$time = time();
|
$time = time();
|
||||||
$bonusDuration['plus'] = (int) $_POST['plus'] * 86400; //Plus
|
$bonusDuration = [
|
||||||
$bonusDuration['b1'] = (int) $_POST['wood'] * 86400; //+25% Wood
|
'plus' => (int)($_POST['plus'] ?? 0) * 86400,
|
||||||
$bonusDuration['b2'] = (int) $_POST['clay'] * 86400; //+25% Clay
|
'b1' => (int)($_POST['wood'] ?? 0) * 86400,
|
||||||
$bonusDuration['b3'] = (int) $_POST['iron'] * 86400; //+25% Iron
|
'b2' => (int)($_POST['clay'] ?? 0) * 86400,
|
||||||
$bonusDuration['b4'] = (int) $_POST['crop'] * 86400; //+25% Crop
|
'b3' => (int)($_POST['iron'] ?? 0) * 86400,
|
||||||
|
'b4' => (int)($_POST['crop'] ?? 0) * 86400,
|
||||||
|
];
|
||||||
|
|
||||||
$user = $database->getUserArray($id, 1);
|
$user = $database->getUserArray($id, 1);
|
||||||
|
if (!$user) {
|
||||||
|
header("Location: ../../../Admin/admin.php?p=player&uid=$id&e=notfound");
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
foreach($bonusDuration as $index => $bonus){
|
foreach ($bonusDuration as $key => $add) {
|
||||||
$bonusDuration[$index] = $bonusDuration[$index] + ($user[$index] < $time ? $time : $user[$index]);
|
$current = (int)($user[$key] ?? 0);
|
||||||
if($bonusDuration[$index] < $time) $bonusDuration[$index] = 0;
|
$base = $current < $time ? $time : $current;
|
||||||
|
$bonusDuration[$key] = $add > 0 ? $base + $add : $current;
|
||||||
|
if ($bonusDuration[$key] < $time) {
|
||||||
|
$bonusDuration[$key] = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$database->updateUserField($id, array_keys($bonusDuration), array_values($bonusDuration), 1);
|
$database->updateUserField($id, array_keys($bonusDuration), array_values($bonusDuration), 1);
|
||||||
|
|
||||||
header("Location: ../../../Admin/admin.php?p=player&uid=".$id."");
|
// ---------------------------------------------------------------------------
|
||||||
|
// Log admin
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
$adminId = (int)$_SESSION['id'];
|
||||||
|
$logText = "Updated Plus/bonuses for user <a href='admin.php?p=player&uid=$id'>$id</a> (plus={$_POST['plus']}d, wood={$_POST['wood']}d, clay={$_POST['clay']}d, iron={$_POST['iron']}d, crop={$_POST['crop']}d)";
|
||||||
|
$logEsc = $database->escape($logText);
|
||||||
|
|
||||||
|
$database->query(
|
||||||
|
"INSERT INTO " . TB_PREFIX . "admin_log (`id`, `user`, `log`, `time`) " .
|
||||||
|
"VALUES (0, '$adminId', '$logEsc', $time)"
|
||||||
|
);
|
||||||
|
|
||||||
|
header("Location: ../../../Admin/admin.php?p=player&uid=" . $id);
|
||||||
|
exit;
|
||||||
?>
|
?>
|
||||||
@@ -2,43 +2,76 @@
|
|||||||
#################################################################################
|
#################################################################################
|
||||||
## -= YOU MAY NOT REMOVE OR CHANGE THIS NOTICE =- ##
|
## -= YOU MAY NOT REMOVE OR CHANGE THIS NOTICE =- ##
|
||||||
## --------------------------------------------------------------------------- ##
|
## --------------------------------------------------------------------------- ##
|
||||||
## Filename editProtection ##
|
## Filename editProtection.php ##
|
||||||
|
## Type BACKEND ##
|
||||||
## Developed by: aggenkeech ##
|
## Developed by: aggenkeech ##
|
||||||
## License: TravianZ Project ##
|
## License: TravianZ Project ##
|
||||||
## Copyright: TravianZ (c) 2010-2025. All rights reserved. ##
|
## Copyright: TravianZ (c) 2010-2025. All rights reserved. ##
|
||||||
## ##
|
## ##
|
||||||
#################################################################################
|
#################################################################################
|
||||||
if (!isset($_SESSION)) session_start();
|
|
||||||
if($_SESSION['access'] < 9) die("Access Denied: You are not Admin!");
|
if (!isset($_SESSION)) {
|
||||||
|
session_start();
|
||||||
|
}
|
||||||
|
if (empty($_SESSION['access']) || $_SESSION['access'] < 9) {
|
||||||
|
die("Access Denied: You are not Admin!");
|
||||||
|
}
|
||||||
|
|
||||||
include_once("../../config.php");
|
include_once("../../config.php");
|
||||||
|
|
||||||
// go max 5 levels up - we don't have folders that go deeper than that
|
// ---------------------------------------------------------------------------
|
||||||
|
// Autoloader path
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
$autoprefix = '';
|
$autoprefix = '';
|
||||||
for ($i = 0; $i < 5; $i++) {
|
for ($i = 0; $i < 5; $i++) {
|
||||||
$autoprefix = str_repeat('../', $i);
|
$autoprefix = str_repeat('../', $i);
|
||||||
if (file_exists($autoprefix . 'autoloader.php')) {
|
if (file_exists($autoprefix . 'autoloader.php')) {
|
||||||
// we have our path, let's leave
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
include_once($autoprefix . "GameEngine/Database.php");
|
include_once($autoprefix . "GameEngine/Database.php");
|
||||||
|
|
||||||
$session = (int) $_POST['admid'];
|
// ---------------------------------------------------------------------------
|
||||||
$id = (int) $_POST['id'];
|
// Input
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
$session = (int)($_POST['admid'] ?? 0);
|
||||||
|
$id = (int)($_POST['id'] ?? 0);
|
||||||
|
$days = (int)($_POST['protect'] ?? 0);
|
||||||
|
|
||||||
$sql = mysqli_query($GLOBALS["link"], "SELECT * FROM ".TB_PREFIX."users WHERE id = ".$session."");
|
if ($id <= 0 || $session <= 0) {
|
||||||
$access = mysqli_fetch_array($sql);
|
header("Location: ../../../Admin/admin.php?p=player&uid=$id&e=bad");
|
||||||
$sessionaccess = $access['access'];
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
if($sessionaccess != 9) die("<h1><font color=\"red\">Access Denied: You are not Admin!</font></h1>");
|
// ---------------------------------------------------------------------------
|
||||||
|
// Verificare admin
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
$admin = $database->getUserArray($session, 1);
|
||||||
|
if (!$admin || (int)$admin['access'] !== 9) {
|
||||||
|
die('<h1><font color="red">Access Denied: You are not Admin!</font></h1>');
|
||||||
|
}
|
||||||
|
|
||||||
$dur = (int) $_POST['protect'] * 86400;
|
// ---------------------------------------------------------------------------
|
||||||
$protection = (time() + $dur);
|
// Calcul protecție
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
$time = time();
|
||||||
|
$protection = $days > 0 ? $time + ($days * 86400) : 0;
|
||||||
|
|
||||||
mysqli_query($GLOBALS["link"], "UPDATE ".TB_PREFIX."users SET
|
$database->query("UPDATE " . TB_PREFIX . "users SET protect = $protection WHERE id = $id");
|
||||||
protect = '".$protection."'
|
|
||||||
WHERE id = $id") or die(mysqli_error($database->dblink));
|
|
||||||
|
|
||||||
header("Location: ../../../Admin/admin.php?p=player&uid=".$id."");
|
// ---------------------------------------------------------------------------
|
||||||
|
// Log admin
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
$adminId = (int)$_SESSION['id'];
|
||||||
|
$logText = "Set protection for user <a href='admin.php?p=player&uid=$id'>$id</a> to $days days";
|
||||||
|
$logEsc = $database->escape($logText);
|
||||||
|
|
||||||
|
$database->query(
|
||||||
|
"INSERT INTO " . TB_PREFIX . "admin_log (`id`, `user`, `log`, `time`) " .
|
||||||
|
"VALUES (0, '$adminId', '$logEsc', $time)"
|
||||||
|
);
|
||||||
|
|
||||||
|
header("Location: ../../../Admin/admin.php?p=player&uid=" . $id);
|
||||||
|
exit;
|
||||||
?>
|
?>
|
||||||
@@ -3,44 +3,91 @@
|
|||||||
## -= YOU MAY NOT REMOVE OR CHANGE THIS NOTICE =- ##
|
## -= YOU MAY NOT REMOVE OR CHANGE THIS NOTICE =- ##
|
||||||
## --------------------------------------------------------------------------- ##
|
## --------------------------------------------------------------------------- ##
|
||||||
## Filename editResources.php ##
|
## Filename editResources.php ##
|
||||||
|
## Type BACKEND ##
|
||||||
## Developed by: aggenkeech ##
|
## Developed by: aggenkeech ##
|
||||||
## License: TravianZ Project ##
|
## License: TravianZ Project ##
|
||||||
## Copyright: TravianZ (c) 2010-2025. All rights reserved. ##
|
## Copyright: TravianZ (c) 2010-2025. All rights reserved. ##
|
||||||
## ##
|
## ##
|
||||||
#################################################################################
|
#################################################################################
|
||||||
if (!isset($_SESSION)) session_start();
|
|
||||||
if($_SESSION['access'] < 9) die("Access Denied: You are not Admin!");
|
if (!isset($_SESSION)) {
|
||||||
|
session_start();
|
||||||
|
}
|
||||||
|
if (empty($_SESSION['access']) || $_SESSION['access'] < 9) {
|
||||||
|
die("Access Denied: You are not Admin!");
|
||||||
|
}
|
||||||
|
|
||||||
include_once("../../config.php");
|
include_once("../../config.php");
|
||||||
|
|
||||||
// go max 5 levels up - we don't have folders that go deeper than that
|
// ---------------------------------------------------------------------------
|
||||||
|
// Autoloader path
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
$autoprefix = '';
|
$autoprefix = '';
|
||||||
for ($i = 0; $i < 5; $i++) {
|
for ($i = 0; $i < 5; $i++) {
|
||||||
$autoprefix = str_repeat('../', $i);
|
$autoprefix = str_repeat('../', $i);
|
||||||
if (file_exists($autoprefix . 'autoloader.php')) {
|
if (file_exists($autoprefix . 'autoloader.php')) {
|
||||||
// we have our path, let's leave
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
include_once($autoprefix . "GameEngine/Database.php");
|
include_once($autoprefix . "GameEngine/Database.php");
|
||||||
|
|
||||||
$session = (int) $_POST['admid'];
|
// ---------------------------------------------------------------------------
|
||||||
$id = (int) $_POST['did'];
|
// Input
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
$session = (int)($_POST['admid'] ?? 0);
|
||||||
|
$id = (int)($_POST['did'] ?? 0);
|
||||||
|
|
||||||
$sql = mysqli_query($GLOBALS["link"], "SELECT * FROM ".TB_PREFIX."users WHERE id = ".$session."");
|
if ($id <= 0 || $session <= 0) {
|
||||||
$access = mysqli_fetch_array($sql);
|
header("Location: ../../../Admin/admin.php?p=admin&e=bad");
|
||||||
$sessionaccess = $access['access'];
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
if($sessionaccess != 9) die("<h1><font color=\"red\">Access Denied: You are not Admin!</font></h1>");
|
// ---------------------------------------------------------------------------
|
||||||
|
// Verificare admin
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
$admin = $database->getUserArray($session, 1);
|
||||||
|
if (!$admin || (int)$admin['access'] !== 9) {
|
||||||
|
die('<h1><font color="red">Access Denied: You are not Admin!</font></h1>');
|
||||||
|
}
|
||||||
|
|
||||||
mysqli_query($GLOBALS["link"], "UPDATE ".TB_PREFIX."vdata SET
|
// ---------------------------------------------------------------------------
|
||||||
wood = '".(int) $_POST['wood']."',
|
// Valori
|
||||||
clay = '".(int) $_POST['clay']."',
|
// ---------------------------------------------------------------------------
|
||||||
iron = '".(int) $_POST['iron']."',
|
$wood = max(0, (int)($_POST['wood'] ?? 0));
|
||||||
crop = '".(int) $_POST['crop']."',
|
$clay = max(0, (int)($_POST['clay'] ?? 0));
|
||||||
maxstore = '".(int) $_POST['maxstore']."',
|
$iron = max(0, (int)($_POST['iron'] ?? 0));
|
||||||
maxcrop = '".(int) $_POST['maxcrop']."'
|
$crop = max(0, (int)($_POST['crop'] ?? 0));
|
||||||
WHERE wref = '".$id."'") or die(mysqli_error($database->dblink));
|
$maxstore = max(0, (int)($_POST['maxstore'] ?? 0));
|
||||||
|
$maxcrop = max(0, (int)($_POST['maxcrop'] ?? 0));
|
||||||
|
|
||||||
header("Location: ../../../Admin/admin.php?p=village&did=".$id."");
|
// ---------------------------------------------------------------------------
|
||||||
|
// Update
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
$database->query(
|
||||||
|
"UPDATE " . TB_PREFIX . "vdata SET
|
||||||
|
wood = $wood,
|
||||||
|
clay = $clay,
|
||||||
|
iron = $iron,
|
||||||
|
crop = $crop,
|
||||||
|
maxstore = $maxstore,
|
||||||
|
maxcrop = $maxcrop
|
||||||
|
WHERE wref = $id"
|
||||||
|
);
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
// Log admin
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
$adminId = (int)$_SESSION['id'];
|
||||||
|
$time = time();
|
||||||
|
$logText = "Edited resources for village <a href='admin.php?p=village&did=$id'>$id</a> (w:$wood c:$clay i:$iron cr:$crop)";
|
||||||
|
$logEsc = $database->escape($logText);
|
||||||
|
|
||||||
|
$database->query(
|
||||||
|
"INSERT INTO " . TB_PREFIX . "admin_log (`id`, `user`, `log`, `time`) " .
|
||||||
|
"VALUES (0, '$adminId', '$logEsc', $time)"
|
||||||
|
);
|
||||||
|
|
||||||
|
header("Location: ../../../Admin/admin.php?p=village&did=" . $id);
|
||||||
|
exit;
|
||||||
?>
|
?>
|
||||||
@@ -3,40 +3,74 @@
|
|||||||
## -= YOU MAY NOT REMOVE OR CHANGE THIS NOTICE =- ##
|
## -= YOU MAY NOT REMOVE OR CHANGE THIS NOTICE =- ##
|
||||||
## --------------------------------------------------------------------------- ##
|
## --------------------------------------------------------------------------- ##
|
||||||
## Filename editSitter.php ##
|
## Filename editSitter.php ##
|
||||||
|
## Type BACKEND ##
|
||||||
## Developed by: aggenkeech ##
|
## Developed by: aggenkeech ##
|
||||||
## License: TravianZ Project ##
|
## License: TravianZ Project ##
|
||||||
## Copyright: TravianZ (c) 2010-2025. All rights reserved. ##
|
## Copyright: TravianZ (c) 2010-2025. All rights reserved. ##
|
||||||
## ##
|
## ##
|
||||||
#################################################################################
|
#################################################################################
|
||||||
if (!isset($_SESSION)) session_start();
|
|
||||||
if($_SESSION['access'] < 9) die("Access Denied: You are not Admin!");
|
if (!isset($_SESSION)) {
|
||||||
|
session_start();
|
||||||
|
}
|
||||||
|
if (empty($_SESSION['access']) || $_SESSION['access'] < 9) {
|
||||||
|
die("Access Denied: You are not Admin!");
|
||||||
|
}
|
||||||
|
|
||||||
include_once("../../config.php");
|
include_once("../../config.php");
|
||||||
|
|
||||||
// go max 5 levels up - we don't have folders that go deeper than that
|
// ---------------------------------------------------------------------------
|
||||||
|
// Autoloader path
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
$autoprefix = '';
|
$autoprefix = '';
|
||||||
for ($i = 0; $i < 5; $i++) {
|
for ($i = 0; $i < 5; $i++) {
|
||||||
$autoprefix = str_repeat('../', $i);
|
$autoprefix = str_repeat('../', $i);
|
||||||
if (file_exists($autoprefix . 'autoloader.php')) {
|
if (file_exists($autoprefix . 'autoloader.php')) {
|
||||||
// we have our path, let's leave
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
include_once($autoprefix . "GameEngine/Database.php");
|
include_once($autoprefix . "GameEngine/Database.php");
|
||||||
|
|
||||||
$session = (int) $_POST['admid'];
|
// ---------------------------------------------------------------------------
|
||||||
$id = (int) $_POST['id'];
|
// Input
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
$session = (int)($_POST['admid'] ?? 0);
|
||||||
|
$id = (int)($_POST['id'] ?? 0);
|
||||||
|
$sit1 = (int)($_POST['sitter1'] ?? 0);
|
||||||
|
$sit2 = (int)($_POST['sitter2'] ?? 0);
|
||||||
|
|
||||||
$sql = mysqli_query($GLOBALS["link"], "SELECT * FROM ".TB_PREFIX."users WHERE id = ".$session."");
|
if ($id <= 0 || $session <= 0) {
|
||||||
$access = mysqli_fetch_array($sql);
|
header("Location: ../../../Admin/admin.php?p=player&uid=$id&e=bad");
|
||||||
$sessionaccess = $access['access'];
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
if($sessionaccess != 9) die("<h1><font color=\"red\">Access Denied: You are not Admin!</font></h1>");
|
// ---------------------------------------------------------------------------
|
||||||
|
// Verificare admin
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
$admin = $database->getUserArray($session, 1);
|
||||||
|
if (!$admin || (int)$admin['access'] !== 9) {
|
||||||
|
die('<h1><font color="red">Access Denied: You are not Admin!</font></h1>');
|
||||||
|
}
|
||||||
|
|
||||||
mysqli_query($GLOBALS["link"], "UPDATE ".TB_PREFIX."users SET
|
// ---------------------------------------------------------------------------
|
||||||
sit1 = '".$_POST['sitter1']."',
|
// Update
|
||||||
sit2 = '".$_POST['sitter2']."'
|
// ---------------------------------------------------------------------------
|
||||||
WHERE id = $id") or die(mysqli_error($database->dblink));
|
$database->query("UPDATE " . TB_PREFIX . "users SET sit1 = $sit1, sit2 = $sit2 WHERE id = $id");
|
||||||
|
|
||||||
header("Location: ../../../Admin/admin.php?p=player&uid=".$id."");
|
// ---------------------------------------------------------------------------
|
||||||
|
// Log admin
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
$adminId = (int)$_SESSION['id'];
|
||||||
|
$time = time();
|
||||||
|
$logText = "Changed sitters for user <a href='admin.php?p=player&uid=$id'>$id</a> (sit1=$sit1, sit2=$sit2)";
|
||||||
|
$logEsc = $database->escape($logText);
|
||||||
|
|
||||||
|
$database->query(
|
||||||
|
"INSERT INTO " . TB_PREFIX . "admin_log (`id`, `user`, `log`, `time`) " .
|
||||||
|
"VALUES (0, '$adminId', '$logEsc', $time)"
|
||||||
|
);
|
||||||
|
|
||||||
|
header("Location: ../../../Admin/admin.php?p=player&uid=" . $id);
|
||||||
|
exit;
|
||||||
?>
|
?>
|
||||||
@@ -3,48 +3,91 @@
|
|||||||
## -= YOU MAY NOT REMOVE OR CHANGE THIS NOTICE =- ##
|
## -= YOU MAY NOT REMOVE OR CHANGE THIS NOTICE =- ##
|
||||||
## --------------------------------------------------------------------------- ##
|
## --------------------------------------------------------------------------- ##
|
||||||
## Filename editUser.php ##
|
## Filename editUser.php ##
|
||||||
|
## Type BACKEND ##
|
||||||
## Developed by: aggenkeech ##
|
## Developed by: aggenkeech ##
|
||||||
## License: TravianZ Project ##
|
## License: TravianZ Project ##
|
||||||
## Copyright: TravianZ (c) 2010-2025. All rights reserved. ##
|
## Copyright: TravianZ (c) 2010-2025. All rights reserved. ##
|
||||||
## ##
|
## ##
|
||||||
#################################################################################
|
#################################################################################
|
||||||
if (!isset($_SESSION)) session_start();
|
|
||||||
if($_SESSION['access'] < 9) die("Access Denied: You are not Admin!");
|
if (!isset($_SESSION)) {
|
||||||
|
session_start();
|
||||||
|
}
|
||||||
|
if (empty($_SESSION['access']) || $_SESSION['access'] < 9) {
|
||||||
|
die("Access Denied: You are not Admin!");
|
||||||
|
}
|
||||||
|
|
||||||
include_once("../../config.php");
|
include_once("../../config.php");
|
||||||
|
|
||||||
// go max 5 levels up - we don't have folders that go deeper than that
|
// ---------------------------------------------------------------------------
|
||||||
|
// Autoloader path
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
$autoprefix = '';
|
$autoprefix = '';
|
||||||
for ($i = 0; $i < 5; $i++) {
|
for ($i = 0; $i < 5; $i++) {
|
||||||
$autoprefix = str_repeat('../', $i);
|
$autoprefix = str_repeat('../', $i);
|
||||||
if (file_exists($autoprefix . 'autoloader.php')) {
|
if (file_exists($autoprefix . 'autoloader.php')) {
|
||||||
// we have our path, let's leave
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
include_once($autoprefix . "GameEngine/Database.php");
|
include_once($autoprefix . "GameEngine/Database.php");
|
||||||
|
|
||||||
foreach ($_POST as $key => $value) {
|
// ---------------------------------------------------------------------------
|
||||||
$_POST[$key] = $database->escape($value);
|
// Input
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
$session = (int)($_POST['admid'] ?? 0);
|
||||||
|
$id = (int)($_POST['id'] ?? 0);
|
||||||
|
|
||||||
|
if ($id <= 0 || $session <= 0) {
|
||||||
|
header("Location: ../../../Admin/admin.php?p=player&uid=$id&e=bad");
|
||||||
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
$session = (int) $_POST['admid'];
|
// ---------------------------------------------------------------------------
|
||||||
$id = (int) $_POST['id'];
|
// Verificare admin
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
$admin = $database->getUserArray($session, 1);
|
||||||
|
if (!$admin || (int)$admin['access'] !== 9) {
|
||||||
|
die('<h1><font color="red">Access Denied: You are not Admin!</font></h1>');
|
||||||
|
}
|
||||||
|
|
||||||
$sql = mysqli_query($GLOBALS["link"], "SELECT * FROM ".TB_PREFIX."users WHERE id = ".$session."");
|
// ---------------------------------------------------------------------------
|
||||||
$access = mysqli_fetch_array($sql);
|
// Câmpuri
|
||||||
$sessionaccess = $access['access'];
|
// ---------------------------------------------------------------------------
|
||||||
|
$email = $database->escape(trim($_POST['email'] ?? ''));
|
||||||
|
$tribe = max(1, min(5, (int)($_POST['tribe'] ?? 1)));
|
||||||
|
$location = $database->escape(trim($_POST['location'] ?? ''));
|
||||||
|
$desc1 = $database->escape($_POST['desc1'] ?? '');
|
||||||
|
$desc2 = $database->escape($_POST['desc2'] ?? '');
|
||||||
|
$quest = $database->escape($_POST['quest'] ?? '');
|
||||||
|
|
||||||
if($sessionaccess != 9) die("<h1><font color=\"red\">Access Denied: You are not Admin!</font></h1>");
|
// ---------------------------------------------------------------------------
|
||||||
|
// Update
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
$database->query(
|
||||||
|
"UPDATE " . TB_PREFIX . "users SET
|
||||||
|
email = '$email',
|
||||||
|
tribe = $tribe,
|
||||||
|
location = '$location',
|
||||||
|
desc1 = '$desc1',
|
||||||
|
desc2 = '$desc2',
|
||||||
|
quest = '$quest'
|
||||||
|
WHERE id = $id"
|
||||||
|
);
|
||||||
|
|
||||||
mysqli_query($GLOBALS["link"], "UPDATE ".TB_PREFIX."users SET
|
// ---------------------------------------------------------------------------
|
||||||
email = '".$_POST['email']."',
|
// Log admin
|
||||||
tribe = ".(int) $_POST['tribe'].",
|
// ---------------------------------------------------------------------------
|
||||||
location = '".$_POST['location']."',
|
$adminId = (int)$_SESSION['id'];
|
||||||
desc1 = '".$_POST['desc1']."',
|
$time = time();
|
||||||
desc2 = '".$_POST['desc2']."',
|
$logText = "Edited profile for user <a href='admin.php?p=player&uid=$id'>$id</a>";
|
||||||
quest = '".$_POST['quest']."'
|
$logEsc = $database->escape($logText);
|
||||||
WHERE id = $id") or die(mysqli_error($database->dblink));
|
|
||||||
|
|
||||||
header("Location: ../../../Admin/admin.php?p=player&uid=".$id."");
|
$database->query(
|
||||||
|
"INSERT INTO " . TB_PREFIX . "admin_log (`id`, `user`, `log`, `time`) " .
|
||||||
|
"VALUES (0, '$adminId', '$logEsc', $time)"
|
||||||
|
);
|
||||||
|
|
||||||
|
header("Location: ../../../Admin/admin.php?p=player&uid=" . $id);
|
||||||
|
exit;
|
||||||
?>
|
?>
|
||||||
@@ -3,41 +3,90 @@
|
|||||||
## -= YOU MAY NOT REMOVE OR CHANGE THIS NOTICE =- ##
|
## -= YOU MAY NOT REMOVE OR CHANGE THIS NOTICE =- ##
|
||||||
## --------------------------------------------------------------------------- ##
|
## --------------------------------------------------------------------------- ##
|
||||||
## Filename editUsername.php ##
|
## Filename editUsername.php ##
|
||||||
|
## Type BACKEND ##
|
||||||
## Developed by: aggenkeech ##
|
## Developed by: aggenkeech ##
|
||||||
## License: TravianZ Project ##
|
## License: TravianZ Project ##
|
||||||
## Copyright: TravianZ (c) 2010-2025. All rights reserved. ##
|
## Copyright: TravianZ (c) 2010-2025. All rights reserved. ##
|
||||||
## ##
|
## ##
|
||||||
#################################################################################
|
#################################################################################
|
||||||
if (!isset($_SESSION)) session_start();
|
|
||||||
if($_SESSION['access'] < 9) die("Access Denied: You are not Admin!");
|
if (!isset($_SESSION)) {
|
||||||
|
session_start();
|
||||||
|
}
|
||||||
|
if (empty($_SESSION['access']) || $_SESSION['access'] < 9) {
|
||||||
|
die("Access Denied: You are not Admin!");
|
||||||
|
}
|
||||||
|
|
||||||
include_once("../../config.php");
|
include_once("../../config.php");
|
||||||
|
|
||||||
// go max 5 levels up - we don't have folders that go deeper than that
|
// ---------------------------------------------------------------------------
|
||||||
|
// Autoloader path
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
$autoprefix = '';
|
$autoprefix = '';
|
||||||
for ($i = 0; $i < 5; $i++) {
|
for ($i = 0; $i < 5; $i++) {
|
||||||
$autoprefix = str_repeat('../', $i);
|
$autoprefix = str_repeat('../', $i);
|
||||||
if (file_exists($autoprefix . 'autoloader.php')) {
|
if (file_exists($autoprefix . 'autoloader.php')) {
|
||||||
// we have our path, let's leave
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
include_once($autoprefix . "GameEngine/Database.php");
|
include_once($autoprefix . "GameEngine/Database.php");
|
||||||
|
|
||||||
foreach ($_POST as $key => $value) {
|
// ---------------------------------------------------------------------------
|
||||||
$_POST[$key] = $database->escape($value);
|
// Input
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
$uid = (int)($_POST['uid'] ?? 0);
|
||||||
|
$session = (int)($_POST['admid'] ?? 0);
|
||||||
|
$username = trim($_POST['username'] ?? '');
|
||||||
|
|
||||||
|
if ($uid <= 0 || $session <= 0 || $username === '') {
|
||||||
|
header("Location: ../../../Admin/admin.php?p=player&uid=$uid&e=user");
|
||||||
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
$uid = (int) $_POST['uid'];
|
// ---------------------------------------------------------------------------
|
||||||
$session = (int) $_POST['admid'];
|
// Verificare admin
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
$admin = $database->getUserArray($session, 1);
|
||||||
|
if (!$admin || (int)$admin['access'] !== 9) {
|
||||||
|
die('<h1><font color="red">Access Denied: You are not Admin!</font></h1>');
|
||||||
|
}
|
||||||
|
|
||||||
$sql = mysqli_query($GLOBALS["link"], "SELECT * FROM ".TB_PREFIX."users WHERE id = ".$session."");
|
// ---------------------------------------------------------------------------
|
||||||
$access = mysqli_fetch_array($sql);
|
// Validare username
|
||||||
$sessionaccess = $access['access'];
|
// ---------------------------------------------------------------------------
|
||||||
|
if (strlen($username) < 3 || strlen($username) > 20 || !preg_match('/^[a-zA-Z0-9_]+$/', $username)) {
|
||||||
|
header("Location: ../../../Admin/admin.php?p=player&uid=$uid&e=invalid");
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
if($sessionaccess != 9) die("<h1><font color=\"red\">Access Denied: You are not Admin!</font></h1>");
|
// verificare duplicat
|
||||||
|
$check = $database->query("SELECT id FROM " . TB_PREFIX . "users WHERE username = '" . $database->escape($username) . "' AND id != $uid LIMIT 1");
|
||||||
|
if (mysqli_num_rows($check) > 0) {
|
||||||
|
header("Location: ../../../Admin/admin.php?p=player&uid=$uid&e=taken");
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
mysqli_query($GLOBALS["link"], "UPDATE ".TB_PREFIX."users SET username = '".$_POST['username']."' WHERE id = ".$uid."");
|
$usernameEsc = $database->escape($username);
|
||||||
|
|
||||||
header("Location: ../../../Admin/admin.php?p=player&uid=".$uid."");
|
// ---------------------------------------------------------------------------
|
||||||
|
// Update
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
$database->query("UPDATE " . TB_PREFIX . "users SET username = '$usernameEsc' WHERE id = $uid");
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
// Log admin
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
$adminId = (int)$_SESSION['id'];
|
||||||
|
$time = time();
|
||||||
|
$logText = "Changed username for user $uid to '$usernameEsc'";
|
||||||
|
$logEsc = $database->escape($logText);
|
||||||
|
|
||||||
|
$database->query(
|
||||||
|
"INSERT INTO " . TB_PREFIX . "admin_log (`id`, `user`, `log`, `time`) " .
|
||||||
|
"VALUES (0, '$adminId', '$logEsc', $time)"
|
||||||
|
);
|
||||||
|
|
||||||
|
header("Location: ../../../Admin/admin.php?p=player&uid=" . $uid . "&name=1");
|
||||||
|
exit;
|
||||||
?>
|
?>
|
||||||
@@ -3,39 +3,93 @@
|
|||||||
## -= YOU MAY NOT REMOVE OR CHANGE THIS NOTICE =- ##
|
## -= YOU MAY NOT REMOVE OR CHANGE THIS NOTICE =- ##
|
||||||
## --------------------------------------------------------------------------- ##
|
## --------------------------------------------------------------------------- ##
|
||||||
## Filename editVillageOwner.php ##
|
## Filename editVillageOwner.php ##
|
||||||
|
## Type BACKEND ##
|
||||||
## Developed by: aggenkeech ##
|
## Developed by: aggenkeech ##
|
||||||
## License: TravianZ Project ##
|
## License: TravianZ Project ##
|
||||||
## Copyright: TravianZ (c) 2010-2025. All rights reserved. ##
|
## Copyright: TravianZ (c) 2010-2025. All rights reserved. ##
|
||||||
## ##
|
## ##
|
||||||
#################################################################################
|
#################################################################################
|
||||||
if (!isset($_SESSION)) session_start();
|
|
||||||
if($_SESSION['access'] < 9) die("Access Denied: You are not Admin!");
|
if (!isset($_SESSION)) {
|
||||||
|
session_start();
|
||||||
|
}
|
||||||
|
if (empty($_SESSION['access']) || $_SESSION['access'] < 9) {
|
||||||
|
die("Access Denied: You are not Admin!");
|
||||||
|
}
|
||||||
|
|
||||||
include_once("../../config.php");
|
include_once("../../config.php");
|
||||||
|
|
||||||
// go max 5 levels up - we don't have folders that go deeper than that
|
// ---------------------------------------------------------------------------
|
||||||
|
// Autoloader path
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
$autoprefix = '';
|
$autoprefix = '';
|
||||||
for ($i = 0; $i < 5; $i++) {
|
for ($i = 0; $i < 5; $i++) {
|
||||||
$autoprefix = str_repeat('../', $i);
|
$autoprefix = str_repeat('../', $i);
|
||||||
if (file_exists($autoprefix . 'autoloader.php')) {
|
if (file_exists($autoprefix . 'autoloader.php')) {
|
||||||
// we have our path, let's leave
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
include_once($autoprefix . "GameEngine/Database.php");
|
include_once($autoprefix . "GameEngine/Database.php");
|
||||||
|
|
||||||
$session = (int) $_POST['admid'];
|
// ---------------------------------------------------------------------------
|
||||||
$id = (int) $_POST['did'];
|
// Input
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
$session = (int)($_POST['admid'] ?? 0);
|
||||||
|
$did = (int)($_POST['did'] ?? 0);
|
||||||
|
$newowner = (int)($_POST['newowner'] ?? 0);
|
||||||
|
|
||||||
$sql = mysqli_query($GLOBALS["link"], "SELECT * FROM ".TB_PREFIX."users WHERE id = ".$session."");
|
if ($did <= 0 || $session <= 0 || $newowner <= 0) {
|
||||||
$access = mysqli_fetch_array($sql);
|
header("Location: ../../../Admin/admin.php?p=admin&e=owner");
|
||||||
$sessionaccess = $access['access'];
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
if($sessionaccess != 9) die("<h1><font color=\"red\">Access Denied: You are not Admin!</font></h1>");
|
// ---------------------------------------------------------------------------
|
||||||
|
// Verificare admin
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
$admin = $database->getUserArray($session, 1);
|
||||||
|
if (!$admin || (int)$admin['access'] !== 9) {
|
||||||
|
die('<h1><font color="red">Access Denied: You are not Admin!</font></h1>');
|
||||||
|
}
|
||||||
|
|
||||||
mysqli_query($GLOBALS["link"], "UPDATE ".TB_PREFIX."vdata SET
|
// ---------------------------------------------------------------------------
|
||||||
owner = '".$_POST['newowner']."'
|
// Verifică sat și noul owner
|
||||||
WHERE wref = $id") or die(mysqli_error($database->dblink));
|
// ---------------------------------------------------------------------------
|
||||||
|
$village = $database->getVillage($did);
|
||||||
|
if (!$village) {
|
||||||
|
header("Location: ../../../Admin/admin.php?p=admin&e=novillage");
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
header("Location: ../../../Admin/admin.php?p=player&uid=".$_POST['newowner']."");
|
$newUser = $database->getUserArray($newowner, 1);
|
||||||
|
if (!$newUser) {
|
||||||
|
header("Location: ../../../Admin/admin.php?p=village&did=$did&e=nouser");
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
$oldOwner = (int)$village['owner'];
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
// Update
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
$database->query("UPDATE " . TB_PREFIX . "vdata SET owner = $newowner WHERE wref = $did");
|
||||||
|
|
||||||
|
// actualizează și owner în oaze ocupate de sat (opțional dar recomandat)
|
||||||
|
$database->query("UPDATE " . TB_PREFIX . "odata SET owner = $newowner WHERE conqured = $did");
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
// Log admin
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
$adminId = (int)$_SESSION['id'];
|
||||||
|
$time = time();
|
||||||
|
$logText = "Changed owner for village <a href='admin.php?p=village&did=$did'>$did</a> from $oldOwner to <a href='admin.php?p=player&uid=$newowner'>$newowner</a>";
|
||||||
|
$logEsc = $database->escape($logText);
|
||||||
|
|
||||||
|
$database->query(
|
||||||
|
"INSERT INTO " . TB_PREFIX . "admin_log (`id`, `user`, `log`, `time`) " .
|
||||||
|
"VALUES (0, '$adminId', '$logEsc', $time)"
|
||||||
|
);
|
||||||
|
|
||||||
|
header("Location: ../../../Admin/admin.php?p=player&uid=" . $newowner);
|
||||||
|
exit;
|
||||||
?>
|
?>
|
||||||
@@ -3,41 +3,79 @@
|
|||||||
## -= YOU MAY NOT REMOVE OR CHANGE THIS NOTICE =- ##
|
## -= YOU MAY NOT REMOVE OR CHANGE THIS NOTICE =- ##
|
||||||
## --------------------------------------------------------------------------- ##
|
## --------------------------------------------------------------------------- ##
|
||||||
## Filename editWeek.php ##
|
## Filename editWeek.php ##
|
||||||
|
## Type BACKEND ##
|
||||||
## Developed by: aggenkeech ##
|
## Developed by: aggenkeech ##
|
||||||
## License: TravianZ Project ##
|
## License: TravianZ Project ##
|
||||||
## Copyright: TravianZ (c) 2010-2025. All rights reserved. ##
|
## Copyright: TravianZ (c) 2010-2025. All rights reserved. ##
|
||||||
## ##
|
## ##
|
||||||
#################################################################################
|
#################################################################################
|
||||||
if (!isset($_SESSION)) session_start();
|
|
||||||
if($_SESSION['access'] < 9) die("Access Denied: You are not Admin!");
|
if (!isset($_SESSION)) {
|
||||||
|
session_start();
|
||||||
|
}
|
||||||
|
if (empty($_SESSION['access']) || $_SESSION['access'] < 9) {
|
||||||
|
die("Access Denied: You are not Admin!");
|
||||||
|
}
|
||||||
|
|
||||||
include_once("../../config.php");
|
include_once("../../config.php");
|
||||||
|
|
||||||
// go max 5 levels up - we don't have folders that go deeper than that
|
// ---------------------------------------------------------------------------
|
||||||
|
// Autoloader path
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
$autoprefix = '';
|
$autoprefix = '';
|
||||||
for ($i = 0; $i < 5; $i++) {
|
for ($i = 0; $i < 5; $i++) {
|
||||||
$autoprefix = str_repeat('../', $i);
|
$autoprefix = str_repeat('../', $i);
|
||||||
if (file_exists($autoprefix . 'autoloader.php')) {
|
if (file_exists($autoprefix . 'autoloader.php')) {
|
||||||
// we have our path, let's leave
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
include_once($autoprefix . "GameEngine/Database.php");
|
include_once($autoprefix . "GameEngine/Database.php");
|
||||||
|
|
||||||
$session = (int) $_POST['admid'];
|
// ---------------------------------------------------------------------------
|
||||||
$id = (int) $_POST['id'];
|
// Input
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
$session = (int)($_POST['admid'] ?? 0);
|
||||||
|
$id = (int)($_POST['id'] ?? 0);
|
||||||
|
|
||||||
$sql = mysqli_query($GLOBALS["link"], "SELECT * FROM ".TB_PREFIX."users WHERE id = ".$session."");
|
if ($id <= 0 || $session <= 0) {
|
||||||
$access = mysqli_fetch_array($sql);
|
header("Location: ../../../Admin/admin.php?p=player&uid=$id&e=bad");
|
||||||
$sessionaccess = $access['access'];
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
if($sessionaccess != 9) die("<h1><font color=\"red\">Access Denied: You are not Admin!</font></h1>");
|
// ---------------------------------------------------------------------------
|
||||||
|
// Verificare admin
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
$admin = $database->getUserArray($session, 1);
|
||||||
|
if (!$admin || (int)$admin['access'] !== 9) {
|
||||||
|
die('<h1><font color="red">Access Denied: You are not Admin!</font></h1>');
|
||||||
|
}
|
||||||
|
|
||||||
mysqli_query($GLOBALS["link"], "UPDATE ".TB_PREFIX."users SET
|
// ---------------------------------------------------------------------------
|
||||||
ap = '".(int) $_POST['off']."',
|
// Valori
|
||||||
dp = '".(int) $_POST['def']."',
|
// ---------------------------------------------------------------------------
|
||||||
RR = '".(int) $_POST['res']."'
|
$ap = (int)($_POST['off'] ?? 0);
|
||||||
WHERE id = $id") or die(mysqli_error($database->dblink));
|
$dp = (int)($_POST['def'] ?? 0);
|
||||||
|
$rr = (int)($_POST['res'] ?? 0);
|
||||||
|
|
||||||
header("Location: ../../../Admin/admin.php?p=player&uid=".$id."");
|
// ---------------------------------------------------------------------------
|
||||||
|
// Update
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
$database->query("UPDATE " . TB_PREFIX . "users SET ap = $ap, dp = $dp, RR = $rr WHERE id = $id");
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
// Log admin
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
$adminId = (int)$_SESSION['id'];
|
||||||
|
$time = time();
|
||||||
|
$logText = "Changed weekly stats for user <a href='admin.php?p=player&uid=$id'>$id</a> (ap=$ap, dp=$dp, RR=$rr)";
|
||||||
|
$logEsc = $database->escape($logText);
|
||||||
|
|
||||||
|
$database->query(
|
||||||
|
"INSERT INTO " . TB_PREFIX . "admin_log (`id`, `user`, `log`, `time`) " .
|
||||||
|
"VALUES (0, '$adminId', '$logEsc', $time)"
|
||||||
|
);
|
||||||
|
|
||||||
|
header("Location: ../../../Admin/admin.php?p=player&uid=" . $id);
|
||||||
|
exit;
|
||||||
?>
|
?>
|
||||||
@@ -1,52 +1,72 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
#################################################################################
|
#################################################################################
|
||||||
## -= YOU MAY NOT REMOVE OR CHANGE THIS NOTICE =- ##
|
## -= YOU MAY NOT REMOVE OR CHANGE THIS NOTICE =- ##
|
||||||
## --------------------------------------------------------------------------- ##
|
## --------------------------------------------------------------------------- ##
|
||||||
## Filename givePlus.php ##
|
## Filename givePlus.php ##
|
||||||
|
## Type BACKEND ##
|
||||||
## Developed by: aggenkeech ##
|
## Developed by: aggenkeech ##
|
||||||
## License: TravianZ Project ##
|
## License: TravianZ Project ##
|
||||||
## Copyright: TravianZ (c) 2010-2025. All rights reserved. ##
|
## Copyright: TravianZ (c) 2010-2025. All rights reserved. ##
|
||||||
## ##
|
## ##
|
||||||
#################################################################################
|
#################################################################################
|
||||||
if (!isset($_SESSION)) session_start();
|
|
||||||
if($_SESSION['access'] < 9) die("Access Denied: You are not Admin!");
|
|
||||||
include_once("../../config.php");
|
|
||||||
|
|
||||||
function mysqli_result($res, $row, $field=0) {
|
if (!isset($_SESSION)) {
|
||||||
$res->data_seek($row);
|
session_start();
|
||||||
$datarow = $res->fetch_array();
|
}
|
||||||
return $datarow[$field];
|
if (empty($_SESSION['access']) || $_SESSION['access'] < 9) {
|
||||||
|
die("Access Denied: You are not Admin!");
|
||||||
}
|
}
|
||||||
|
|
||||||
// go max 5 levels up - we don't have folders that go deeper than that
|
include_once("../../config.php");
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
// Autoloader path
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
$autoprefix = '';
|
$autoprefix = '';
|
||||||
for ($i = 0; $i < 5; $i++) {
|
for ($i = 0; $i < 5; $i++) {
|
||||||
$autoprefix = str_repeat('../', $i);
|
$autoprefix = str_repeat('../', $i);
|
||||||
if (file_exists($autoprefix . 'autoloader.php')) {
|
if (file_exists($autoprefix . 'autoloader.php')) {
|
||||||
// we have our path, let's leave
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
include_once($autoprefix . "GameEngine/Database.php");
|
include_once($autoprefix . "GameEngine/Database.php");
|
||||||
|
|
||||||
$sql = "SELECT id FROM ".TB_PREFIX."users ORDER BY ID DESC LIMIT 1";
|
// ---------------------------------------------------------------------------
|
||||||
$loops = mysqli_result(mysqli_query($GLOBALS["link"], $sql), 0);
|
// Input
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
$plusdur = $_POST['plus'] * 86400;
|
$days = (int)($_POST['plus'] ?? 0);
|
||||||
|
if ($days <= 0) {
|
||||||
for($i = 0; $i < $loops + 1; $i++)
|
header("Location: ../../../Admin/admin.php?p=givePlus&e=0");
|
||||||
{
|
exit;
|
||||||
$query = "SELECT * FROM ".TB_PREFIX."users WHERE id = ".$i."";
|
|
||||||
$result = mysqli_query($GLOBALS["link"], $query);
|
|
||||||
while($row = mysqli_fetch_assoc($result))
|
|
||||||
{
|
|
||||||
if($row['plus'] < time()) { $plusbefore = time(); $addplus = $plusbefore + $plusdur; } elseif($row['plus'] > time()) { $plusbefore = $row['plus']; $addplus = $plusbefore + $plusdur; }
|
|
||||||
mysqli_query($GLOBALS["link"], "UPDATE ".TB_PREFIX."users SET
|
|
||||||
plus = '".$addplus."'
|
|
||||||
WHERE id = '".$row['id']."'");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
header("Location: ../../../Admin/admin.php?p=givePlus&g");
|
$plusdur = $days * 86400;
|
||||||
|
$time = time();
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
// Update în masă – fără loop
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
// Dacă plus < now, pornește de acum, altfel adaugă la timpul existent
|
||||||
|
$database->query(
|
||||||
|
"UPDATE " . TB_PREFIX . "users
|
||||||
|
SET plus = IF(plus < $time, $time + $plusdur, plus + $plusdur)
|
||||||
|
WHERE id > 3"
|
||||||
|
);
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
// Log admin
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
$adminId = (int)$_SESSION['id'];
|
||||||
|
$logText = "Gave $days days Plus to all players";
|
||||||
|
$logEsc = $database->escape($logText);
|
||||||
|
|
||||||
|
$database->query(
|
||||||
|
"INSERT INTO " . TB_PREFIX . "admin_log (`id`, `user`, `log`, `time`) " .
|
||||||
|
"VALUES (0, '$adminId', '$logEsc', $time)"
|
||||||
|
);
|
||||||
|
|
||||||
|
header("Location: ../../../Admin/admin.php?p=givePlus&g=1");
|
||||||
|
exit;
|
||||||
?>
|
?>
|
||||||
@@ -3,67 +3,84 @@
|
|||||||
## -= YOU MAY NOT REMOVE OR CHANGE THIS NOTICE =- ##
|
## -= YOU MAY NOT REMOVE OR CHANGE THIS NOTICE =- ##
|
||||||
## --------------------------------------------------------------------------- ##
|
## --------------------------------------------------------------------------- ##
|
||||||
## Filename givePlusRes.php ##
|
## Filename givePlusRes.php ##
|
||||||
|
## Type BACKEND ##
|
||||||
## Developed by: aggenkeech ##
|
## Developed by: aggenkeech ##
|
||||||
## License: TravianZ Project ##
|
## License: TravianZ Project ##
|
||||||
## Copyright: TravianZ (c) 2010-2025. All rights reserved. ##
|
## Copyright: TravianZ (c) 2010-2025. All rights reserved. ##
|
||||||
## ##
|
## ##
|
||||||
#################################################################################
|
#################################################################################
|
||||||
if (!isset($_SESSION)) session_start();
|
|
||||||
if($_SESSION['access'] < 9) die("Access Denied: You are not Admin!");
|
|
||||||
include_once("../../config.php");
|
|
||||||
|
|
||||||
function mysqli_result($res, $row, $field=0) {
|
if (!isset($_SESSION)) {
|
||||||
$res->data_seek($row);
|
session_start();
|
||||||
$datarow = $res->fetch_array();
|
}
|
||||||
return $datarow[$field];
|
if (empty($_SESSION['access']) || $_SESSION['access'] < 9) {
|
||||||
|
die("Access Denied: You are not Admin!");
|
||||||
}
|
}
|
||||||
|
|
||||||
// go max 5 levels up - we don't have folders that go deeper than that
|
include_once("../../config.php");
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
// Autoloader path
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
$autoprefix = '';
|
$autoprefix = '';
|
||||||
for ($i = 0; $i < 5; $i++) {
|
for ($i = 0; $i < 5; $i++) {
|
||||||
$autoprefix = str_repeat('../', $i);
|
$autoprefix = str_repeat('../', $i);
|
||||||
if (file_exists($autoprefix . 'autoloader.php')) {
|
if (file_exists($autoprefix . 'autoloader.php')) {
|
||||||
// we have our path, let's leave
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
include_once($autoprefix . "GameEngine/Database.php");
|
include_once($autoprefix . "GameEngine/Database.php");
|
||||||
|
|
||||||
$session = (int) $_POST['admid'];
|
// ---------------------------------------------------------------------------
|
||||||
|
// Input
|
||||||
$sql = mysqli_query($GLOBALS["link"], "SELECT * FROM ".TB_PREFIX."users WHERE id = ".$session."");
|
// ---------------------------------------------------------------------------
|
||||||
$access = mysqli_fetch_array($sql);
|
$session = (int)($_POST['admid'] ?? 0);
|
||||||
$sessionaccess = $access['access'];
|
$admin = $database->getUserArray($session, 1);
|
||||||
|
if (!$admin || (int)$admin['access'] !== 9) {
|
||||||
if($sessionaccess != 9) die("<h1><font color=\"red\">Access Denied: You are not Admin!</font></h1>");
|
die('<h1><font color="red">Access Denied: You are not Admin!</font></h1>');
|
||||||
|
|
||||||
$sql = "SELECT id FROM ".TB_PREFIX."users ORDER BY ID DESC LIMIT 1";
|
|
||||||
$loops = mysqli_result(mysqli_query($GLOBALS["link"], $sql), 0);
|
|
||||||
|
|
||||||
$wood = (int) $_POST['wood'] * 86400;
|
|
||||||
$clay = (int) $_POST['clay'] * 86400;
|
|
||||||
$iron = (int) $_POST['iron'] * 86400;
|
|
||||||
$crop = (int) $_POST['crop'] * 86400;
|
|
||||||
|
|
||||||
for($i = 0; $i < $loops + 1; $i++)
|
|
||||||
{
|
|
||||||
$query = "SELECT * FROM ".TB_PREFIX."users WHERE id = ".$i."";
|
|
||||||
$result = mysqli_query($GLOBALS["link"], $query);
|
|
||||||
while($row = mysqli_fetch_assoc($result))
|
|
||||||
{
|
|
||||||
if($row['b1'] < time()) { $b1before = time(); $addb1 = $b1before + $wood; } elseif($row['b1'] > time()) { $b1before = $row['b1']; $addb1 = $b1before + $wood; }
|
|
||||||
if($row['b2'] < time()) { $b2before = time(); $addb2 = $b1before + $clay; } elseif($row['b2'] > time()) { $b2before = $row['b2']; $addb2 = $b1before + $clay; }
|
|
||||||
if($row['b3'] < time()) { $b3before = time(); $addb3 = $b1before + $iron; } elseif($row['b3'] > time()) { $b3before = $row['b3']; $addb3 = $b1before + $iron; }
|
|
||||||
if($row['b4'] < time()) { $b4before = time(); $addb4 = $b1before + $crop; } elseif($row['b4'] > time()) { $b4before = $row['b4']; $addb4 = $b1before + $crop; }
|
|
||||||
mysqli_query($GLOBALS["link"], "UPDATE ".TB_PREFIX."users SET
|
|
||||||
b1 = '".$addb1."',
|
|
||||||
b2 = '".$addb2."',
|
|
||||||
b3 = '".$addb3."',
|
|
||||||
b4 = '".$addb4."'
|
|
||||||
WHERE id = '".$row['id']."'");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
header("Location: ../../../Admin/admin.php?p=givePlusRes&g");
|
$wood = (int)($_POST['wood'] ?? 0) * 86400;
|
||||||
|
$clay = (int)($_POST['clay'] ?? 0) * 86400;
|
||||||
|
$iron = (int)($_POST['iron'] ?? 0) * 86400;
|
||||||
|
$crop = (int)($_POST['crop'] ?? 0) * 86400;
|
||||||
|
|
||||||
|
if ($wood + $clay + $iron + $crop == 0) {
|
||||||
|
header("Location: ../../../Admin/admin.php?p=givePlusRes&e=0");
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
$time = time();
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
// Update în masă
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
if ($wood > 0) {
|
||||||
|
$database->query("UPDATE " . TB_PREFIX . "users SET b1 = IF(b1 < $time, $time + $wood, b1 + $wood) WHERE id > 3");
|
||||||
|
}
|
||||||
|
if ($clay > 0) {
|
||||||
|
$database->query("UPDATE " . TB_PREFIX . "users SET b2 = IF(b2 < $time, $time + $clay, b2 + $clay) WHERE id > 3");
|
||||||
|
}
|
||||||
|
if ($iron > 0) {
|
||||||
|
$database->query("UPDATE " . TB_PREFIX . "users SET b3 = IF(b3 < $time, $time + $iron, b3 + $iron) WHERE id > 3");
|
||||||
|
}
|
||||||
|
if ($crop > 0) {
|
||||||
|
$database->query("UPDATE " . TB_PREFIX . "users SET b4 = IF(b4 < $time, $time + $crop, b4 + $crop) WHERE id > 3");
|
||||||
|
}
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
// Log admin
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
$adminId = (int)$_SESSION['id'];
|
||||||
|
$logText = "Gave res bonuses to all: wood=" . ($_POST['wood'] ?? 0) . "d, clay=" . ($_POST['clay'] ?? 0) . "d, iron=" . ($_POST['iron'] ?? 0) . "d, crop=" . ($_POST['crop'] ?? 0) . "d";
|
||||||
|
$logEsc = $database->escape($logText);
|
||||||
|
|
||||||
|
$database->query(
|
||||||
|
"INSERT INTO " . TB_PREFIX . "admin_log (`id`, `user`, `log`, `time`) " .
|
||||||
|
"VALUES (0, '$adminId', '$logEsc', $time)"
|
||||||
|
);
|
||||||
|
|
||||||
|
header("Location: ../../../Admin/admin.php?p=givePlusRes&g=1");
|
||||||
|
exit;
|
||||||
?>
|
?>
|
||||||
@@ -3,39 +3,72 @@
|
|||||||
## -= YOU MAY NOT REMOVE OR CHANGE THIS NOTICE =- ##
|
## -= YOU MAY NOT REMOVE OR CHANGE THIS NOTICE =- ##
|
||||||
## --------------------------------------------------------------------------- ##
|
## --------------------------------------------------------------------------- ##
|
||||||
## Filename giveResBonus.php ##
|
## Filename giveResBonus.php ##
|
||||||
|
## Type BACKEND ##
|
||||||
## Developed by: aggenkeech ##
|
## Developed by: aggenkeech ##
|
||||||
## License: TravianZ Project ##
|
## License: TravianZ Project ##
|
||||||
## Copyright: TravianZ (c) 2010-2025. All rights reserved. ##
|
## Copyright: TravianZ (c) 2010-2025. All rights reserved. ##
|
||||||
## ##
|
## ##
|
||||||
#################################################################################
|
#################################################################################
|
||||||
if (!isset($_SESSION)) session_start();
|
|
||||||
if($_SESSION['access'] < 9) die("Access Denied: You are not Admin!");
|
if (!isset($_SESSION)) {
|
||||||
|
session_start();
|
||||||
|
}
|
||||||
|
if (empty($_SESSION['access']) || $_SESSION['access'] < 9) {
|
||||||
|
die("Access Denied: You are not Admin!");
|
||||||
|
}
|
||||||
|
|
||||||
include_once("../../config.php");
|
include_once("../../config.php");
|
||||||
|
|
||||||
error_reporting(E_ALL);
|
// ---------------------------------------------------------------------------
|
||||||
|
// Autoloader path
|
||||||
// go max 5 levels up - we don't have folders that go deeper than that
|
// ---------------------------------------------------------------------------
|
||||||
$autoprefix = '';
|
$autoprefix = '';
|
||||||
for ($i = 0; $i < 5; $i++) {
|
for ($i = 0; $i < 5; $i++) {
|
||||||
$autoprefix = str_repeat('../', $i);
|
$autoprefix = str_repeat('../', $i);
|
||||||
if (file_exists($autoprefix . 'autoloader.php')) {
|
if (file_exists($autoprefix . 'autoloader.php')) {
|
||||||
// we have our path, let's leave
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
include_once($autoprefix . "GameEngine/Database.php");
|
include_once($autoprefix . "GameEngine/Database.php");
|
||||||
|
|
||||||
$session = (int) $_POST['admid'];
|
// ---------------------------------------------------------------------------
|
||||||
|
// Verificare admin
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
$session = (int)($_POST['admid'] ?? 0);
|
||||||
|
$admin = $database->getUserArray($session, 1);
|
||||||
|
if (!$admin || (int)$admin['access'] !== 9) {
|
||||||
|
die('<h1><font color="red">Access Denied: You are not Admin!</font></h1>');
|
||||||
|
}
|
||||||
|
|
||||||
$sql = mysqli_query($GLOBALS["link"], "SELECT * FROM ".TB_PREFIX."users WHERE id = ".$session."");
|
// ---------------------------------------------------------------------------
|
||||||
$access = mysqli_fetch_array($sql);
|
// Input
|
||||||
$sessionaccess = $access['access'];
|
// ---------------------------------------------------------------------------
|
||||||
|
$gold = (int)($_POST['gold'] ?? 0);
|
||||||
|
if ($gold <= 0) {
|
||||||
|
header("Location: ../../../Admin/admin.php?p=maintenenceResetPlusBonus&e=0");
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
if($sessionaccess != 9) die("<h1><font color=\"red\">Access Denied: You are not Admin!</font></h1>");
|
$time = time();
|
||||||
|
|
||||||
$q = "UPDATE ".TB_PREFIX."users SET gold = gold + ".(int) $_POST['gold']." WHERE id != '0'";
|
// ---------------------------------------------------------------------------
|
||||||
mysqli_query($GLOBALS["link"], $q) or die(mysqli_error($database->dblink));
|
// Update
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
$database->query("UPDATE " . TB_PREFIX . "users SET gold = gold + $gold WHERE id > 3");
|
||||||
|
|
||||||
header("Location: ../../../Admin/admin.php?p=maintenenceResetPlusBonus&g");
|
// ---------------------------------------------------------------------------
|
||||||
|
// Log admin
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
$adminId = (int)$_SESSION['id'];
|
||||||
|
$logText = "Gave $gold gold to all players";
|
||||||
|
$logEsc = $database->escape($logText);
|
||||||
|
|
||||||
|
$database->query(
|
||||||
|
"INSERT INTO " . TB_PREFIX . "admin_log (`id`, `user`, `log`, `time`) " .
|
||||||
|
"VALUES (0, '$adminId', '$logEsc', $time)"
|
||||||
|
);
|
||||||
|
|
||||||
|
header("Location: ../../../Admin/admin.php?p=maintenenceResetPlusBonus&g=1");
|
||||||
|
exit;
|
||||||
?>
|
?>
|
||||||
@@ -3,6 +3,7 @@
|
|||||||
## -= YOU MAY NOT REMOVE OR CHANGE THIS NOTICE =- ##
|
## -= YOU MAY NOT REMOVE OR CHANGE THIS NOTICE =- ##
|
||||||
## --------------------------------------------------------------------------- ##
|
## --------------------------------------------------------------------------- ##
|
||||||
## Filename gold.php ##
|
## Filename gold.php ##
|
||||||
|
## Type BACKEND ##
|
||||||
## Developed by: aggenkeech ##
|
## Developed by: aggenkeech ##
|
||||||
## Refactored by: Shadow ##
|
## Refactored by: Shadow ##
|
||||||
## License: TravianZ Project ##
|
## License: TravianZ Project ##
|
||||||
|
|||||||
@@ -1,9 +1,17 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
#################################################################################
|
#################################################################################
|
||||||
|
## -= YOU MAY NOT REMOVE OR CHANGE THIS NOTICE =- ##
|
||||||
|
## --------------------------------------------------------------------------- ##
|
||||||
## Filename gold_1.php ##
|
## Filename gold_1.php ##
|
||||||
|
## Type BACKEND ##
|
||||||
## Developed by: aggenkeech ##
|
## Developed by: aggenkeech ##
|
||||||
## Refactored by: Shadow ##
|
## Refactored by: Shadow ##
|
||||||
|
## License: TravianZ Project ##
|
||||||
|
## Copyright: TravianZ (c) 2010-2025. All rights reserved. ##
|
||||||
|
## ##
|
||||||
#################################################################################
|
#################################################################################
|
||||||
|
|
||||||
if (!isset($_SESSION)) session_start();
|
if (!isset($_SESSION)) session_start();
|
||||||
if($_SESSION['access'] < 9) die("Access Denied: You are not Admin!");
|
if($_SESSION['access'] < 9) die("Access Denied: You are not Admin!");
|
||||||
|
|
||||||
|
|||||||
@@ -3,69 +3,89 @@
|
|||||||
## -= YOU MAY NOT REMOVE OR CHANGE THIS NOTICE =- ##
|
## -= YOU MAY NOT REMOVE OR CHANGE THIS NOTICE =- ##
|
||||||
## --------------------------------------------------------------------------- ##
|
## --------------------------------------------------------------------------- ##
|
||||||
## Filename mainteneceBan.php ##
|
## Filename mainteneceBan.php ##
|
||||||
|
## Type BACKEND ##
|
||||||
## Developed by: aggenkeech ##
|
## Developed by: aggenkeech ##
|
||||||
## License: TravianZ Project ##
|
## License: TravianZ Project ##
|
||||||
## Copyright: TravianZ (c) 2010-2025. All rights reserved. ##
|
## Copyright: TravianZ (c) 2010-2025. All rights reserved. ##
|
||||||
## ##
|
## ##
|
||||||
#################################################################################
|
#################################################################################
|
||||||
if (!isset($_SESSION)) session_start();
|
|
||||||
if($_SESSION['access'] < 9) die("Access Denied: You are not Admin!");
|
if (!isset($_SESSION)) {
|
||||||
|
session_start();
|
||||||
|
}
|
||||||
|
if (empty($_SESSION['access']) || $_SESSION['access'] < 9) {
|
||||||
|
die("Access Denied: You are not Admin!");
|
||||||
|
}
|
||||||
|
|
||||||
include_once("../../config.php");
|
include_once("../../config.php");
|
||||||
|
|
||||||
// go max 5 levels up - we don't have folders that go deeper than that
|
// ---------------------------------------------------------------------------
|
||||||
|
// Autoloader path
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
$autoprefix = '';
|
$autoprefix = '';
|
||||||
for ($i = 0; $i < 5; $i++) {
|
for ($i = 0; $i < 5; $i++) {
|
||||||
$autoprefix = str_repeat('../', $i);
|
$autoprefix = str_repeat('../', $i);
|
||||||
if (file_exists($autoprefix . 'autoloader.php')) {
|
if (file_exists($autoprefix . 'autoloader.php')) {
|
||||||
// we have our path, let's leave
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
include_once($autoprefix . "GameEngine/Database.php");
|
include_once($autoprefix . "GameEngine/Database.php");
|
||||||
|
|
||||||
foreach ($_POST as $key => $value) {
|
// ---------------------------------------------------------------------------
|
||||||
$_POST[$key] = $database->escape($value);
|
// Verificare admin
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
$session = (int)($_POST['admid'] ?? 0);
|
||||||
|
$admin = $database->getUserArray($session, 1);
|
||||||
|
if (!$admin || (int)$admin['access'] !== 9) {
|
||||||
|
die('<h1><font color="red">Access Denied: You are not Admin!</font></h1>');
|
||||||
}
|
}
|
||||||
|
|
||||||
$session = (int) $_POST['admid'];
|
// ---------------------------------------------------------------------------
|
||||||
|
// Input
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
$duration = (int)($_POST['duration'] ?? 0) * 3600;
|
||||||
|
$start = trim($_POST['start'] ?? '');
|
||||||
|
$reason = trim($_POST['reason'] ?? 'Maintenance ban');
|
||||||
|
$access = 2; // jucători normali
|
||||||
|
|
||||||
$sql = mysqli_query($GLOBALS["link"], "SELECT * FROM ".TB_PREFIX."users WHERE id = ".$session."");
|
$startts = $start ? strtotime($start) : time();
|
||||||
$access = mysqli_fetch_array($sql);
|
if ($startts === false) $startts = time();
|
||||||
$sessionaccess = $access['access'];
|
|
||||||
|
|
||||||
if($sessionaccess != 9) die("<h1><font color=\"red\">Access Denied: You are not Admin!</font></h1>");
|
|
||||||
|
|
||||||
$users = mysqli_num_rows(mysqli_query($GLOBALS["link"], "SELECT * FROM ".TB_PREFIX."users"));
|
|
||||||
|
|
||||||
$duration = (int) $_POST['duration'] * 3600;
|
|
||||||
$start = $_POST['start'];
|
|
||||||
$startts = strtotime($start);
|
|
||||||
$endts = $startts + $duration;
|
$endts = $startts + $duration;
|
||||||
$reason = $_POST['reason'];
|
if ($duration <= 0) $endts = $startts + 86400; // default 1 zi
|
||||||
$admin = $session;
|
|
||||||
$active = '1';
|
|
||||||
$access = '2';
|
|
||||||
|
|
||||||
function mysqli_result($res, $row, $field=0) {
|
$reasonEsc = $database->escape($reason);
|
||||||
$res->data_seek($row);
|
$adminId = (int)$session;
|
||||||
$datarow = $res->fetch_array();
|
|
||||||
return $datarow[$field];
|
|
||||||
}
|
|
||||||
|
|
||||||
$sql = "SELECT id FROM ".TB_PREFIX."users ORDER BY ID DESC LIMIT 1";
|
// ---------------------------------------------------------------------------
|
||||||
$loops = mysqli_result(mysqli_query($GLOBALS["link"], $sql), 0);
|
// Ban în masă – un singur query
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
$database->query(
|
||||||
|
"INSERT INTO " . TB_PREFIX . "banlist (uid, name, reason, time, end, admin, active)
|
||||||
|
SELECT id, username, '$reasonEsc', $startts, $endts, $adminId, 1
|
||||||
|
FROM " . TB_PREFIX . "users
|
||||||
|
WHERE access = $access AND id > 3
|
||||||
|
ON DUPLICATE KEY UPDATE
|
||||||
|
reason = VALUES(reason),
|
||||||
|
time = VALUES(time),
|
||||||
|
end = VALUES(end),
|
||||||
|
admin = VALUES(admin),
|
||||||
|
active = 1"
|
||||||
|
);
|
||||||
|
|
||||||
for($i = 0; $i < $loops + 1; $i++)
|
// ---------------------------------------------------------------------------
|
||||||
{
|
// Log admin
|
||||||
$query = "SELECT * FROM ".TB_PREFIX."users WHERE id = ".$i." AND access = ".$access."";
|
// ---------------------------------------------------------------------------
|
||||||
$result = mysqli_query($GLOBALS["link"], $query);
|
$time = time();
|
||||||
while($row = mysqli_fetch_assoc($result))
|
$logText = "Mass ban for access=$access, duration=" . ($duration/3600) . "h, reason='$reasonEsc'";
|
||||||
{
|
$logEsc = $database->escape($logText);
|
||||||
mysqli_query($GLOBALS["link"], "INSERT INTO ".TB_PREFIX."banlist VALUES('', ".(int) $row['id'].", '".$row['username']."', '".$reason."', ".(int) $startts.", ".(int) $endts.", ".(int) $admin.", ".(int) $active.")");
|
|
||||||
##mysqli_query($GLOBALS["link"], "INSERT INTO ".TB_PREFIX."banlist (`uid`, `name`, `reason`, `time`, `end`, `admin`, `active`) VALUES (".$row['id'].", '".$row['username']."' , '$reason', '$startts', '$endts', '$admin', '1')");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
header("Location: ../../../Admin/admin.php?p=ban");
|
$database->query(
|
||||||
|
"INSERT INTO " . TB_PREFIX . "admin_log (`id`, `user`, `log`, `time`) " .
|
||||||
|
"VALUES (0, '$adminId', '$logEsc', $time)"
|
||||||
|
);
|
||||||
|
|
||||||
|
header("Location: ../../../Admin/admin.php?p=ban&m=1");
|
||||||
|
exit;
|
||||||
?>
|
?>
|
||||||
@@ -8,31 +8,56 @@
|
|||||||
## Copyright: TravianZ (c) 2010-2025. All rights reserved. ##
|
## Copyright: TravianZ (c) 2010-2025. All rights reserved. ##
|
||||||
## ##
|
## ##
|
||||||
#################################################################################
|
#################################################################################
|
||||||
if (!isset($_SESSION)) session_start();
|
|
||||||
if($_SESSION['access'] < 9) die("Access Denied: You are not Admin!");
|
if (!isset($_SESSION)) {
|
||||||
|
session_start();
|
||||||
|
}
|
||||||
|
if (empty($_SESSION['access']) || $_SESSION['access'] < 9) {
|
||||||
|
die("Access Denied: You are not Admin!");
|
||||||
|
}
|
||||||
|
|
||||||
include_once("../../config.php");
|
include_once("../../config.php");
|
||||||
|
|
||||||
// go max 5 levels up - we don't have folders that go deeper than that
|
// ---------------------------------------------------------------------------
|
||||||
|
// Autoloader path
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
$autoprefix = '';
|
$autoprefix = '';
|
||||||
for ($i = 0; $i < 5; $i++) {
|
for ($i = 0; $i < 5; $i++) {
|
||||||
$autoprefix = str_repeat('../', $i);
|
$autoprefix = str_repeat('../', $i);
|
||||||
if (file_exists($autoprefix . 'autoloader.php')) {
|
if (file_exists($autoprefix . 'autoloader.php')) {
|
||||||
// we have our path, let's leave
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
include_once($autoprefix . "GameEngine/Database.php");
|
include_once($autoprefix . "GameEngine/Database.php");
|
||||||
|
|
||||||
$session = (int) $_POST['admid'];
|
// ---------------------------------------------------------------------------
|
||||||
|
// Verificare admin
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
$session = (int)($_POST['admid'] ?? 0);
|
||||||
|
$admin = $database->getUserArray($session, 1);
|
||||||
|
if (!$admin || (int)$admin['access'] !== 9) {
|
||||||
|
die('<h1><font color="red">Access Denied: You are not Admin!</font></h1>');
|
||||||
|
}
|
||||||
|
|
||||||
$sql = mysqli_query($GLOBALS["link"], "SELECT * FROM ".TB_PREFIX."users WHERE id = ".$session."");
|
// ---------------------------------------------------------------------------
|
||||||
$access = mysqli_fetch_array($sql);
|
// Truncate banlist
|
||||||
$sessionaccess = $access['access'];
|
// ---------------------------------------------------------------------------
|
||||||
|
$database->query("TRUNCATE TABLE " . TB_PREFIX . "banlist");
|
||||||
|
|
||||||
if($sessionaccess != 9) die("<h1><font color=\"red\">Access Denied: You are not Admin!</font></h1>");
|
// ---------------------------------------------------------------------------
|
||||||
|
// Log admin
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
$adminId = (int)$_SESSION['id'];
|
||||||
|
$time = time();
|
||||||
|
$logText = "Cleared banlist (TRUNCATE)";
|
||||||
|
$logEsc = $database->escape($logText);
|
||||||
|
|
||||||
mysqli_query($GLOBALS["link"], "TRUNCATE ".TB_PREFIX."banlist");
|
$database->query(
|
||||||
|
"INSERT INTO " . TB_PREFIX . "admin_log (`id`, `user`, `log`, `time`) " .
|
||||||
|
"VALUES (0, '$adminId', '$logEsc', $time)"
|
||||||
|
);
|
||||||
|
|
||||||
header("Location: ../../../Admin/admin.php?p=ban");
|
header("Location: ../../../Admin/admin.php?p=ban&c=1");
|
||||||
|
exit;
|
||||||
?>
|
?>
|
||||||
@@ -3,36 +3,62 @@
|
|||||||
## -= YOU MAY NOT REMOVE OR CHANGE THIS NOTICE =- ##
|
## -= YOU MAY NOT REMOVE OR CHANGE THIS NOTICE =- ##
|
||||||
## --------------------------------------------------------------------------- ##
|
## --------------------------------------------------------------------------- ##
|
||||||
## Filename mainteneceResetGold.php ##
|
## Filename mainteneceResetGold.php ##
|
||||||
|
## Type BACKEND ##
|
||||||
## Developed by: aggenkeech ##
|
## Developed by: aggenkeech ##
|
||||||
## License: TravianZ Project ##
|
## License: TravianZ Project ##
|
||||||
## Copyright: TravianZ (c) 2010-2025. All rights reserved. ##
|
## Copyright: TravianZ (c) 2010-2025. All rights reserved. ##
|
||||||
## ##
|
## ##
|
||||||
#################################################################################
|
#################################################################################
|
||||||
if (!isset($_SESSION)) session_start();
|
|
||||||
if($_SESSION['access'] < 9) die("Access Denied: You are not Admin!");
|
if (!isset($_SESSION)) {
|
||||||
|
session_start();
|
||||||
|
}
|
||||||
|
if (empty($_SESSION['access']) || $_SESSION['access'] < 9) {
|
||||||
|
die("Access Denied: You are not Admin!");
|
||||||
|
}
|
||||||
|
|
||||||
include_once("../../config.php");
|
include_once("../../config.php");
|
||||||
|
|
||||||
// go max 5 levels up - we don't have folders that go deeper than that
|
// ---------------------------------------------------------------------------
|
||||||
|
// Autoloader path
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
$autoprefix = '';
|
$autoprefix = '';
|
||||||
for ($i = 0; $i < 5; $i++) {
|
for ($i = 0; $i < 5; $i++) {
|
||||||
$autoprefix = str_repeat('../', $i);
|
$autoprefix = str_repeat('../', $i);
|
||||||
if (file_exists($autoprefix . 'autoloader.php')) {
|
if (file_exists($autoprefix . 'autoloader.php')) {
|
||||||
// we have our path, let's leave
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
include_once($autoprefix . "GameEngine/Database.php");
|
include_once($autoprefix . "GameEngine/Database.php");
|
||||||
|
|
||||||
$session = (int) $_POST['admid'];
|
// ---------------------------------------------------------------------------
|
||||||
|
// Verificare admin
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
$session = (int)($_POST['admid'] ?? 0);
|
||||||
|
$admin = $database->getUserArray($session, 1);
|
||||||
|
if (!$admin || (int)$admin['access'] !== 9) {
|
||||||
|
die('<h1><font color="red">Access Denied: You are not Admin!</font></h1>');
|
||||||
|
}
|
||||||
|
|
||||||
$sql = mysqli_query($GLOBALS["link"], "SELECT * FROM ".TB_PREFIX."users WHERE id = ".$session."");
|
// ---------------------------------------------------------------------------
|
||||||
$access = mysqli_fetch_array($sql);
|
// Reset gold
|
||||||
$sessionaccess = $access['access'];
|
// ---------------------------------------------------------------------------
|
||||||
|
$database->query("UPDATE " . TB_PREFIX . "users SET gold = 0 WHERE id > 0");
|
||||||
|
|
||||||
if($sessionaccess != 9) die("<h1><font color=\"red\">Access Denied: You are not Admin!</font></h1>");
|
// ---------------------------------------------------------------------------
|
||||||
|
// Log admin
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
$adminId = (int)$_SESSION['id'];
|
||||||
|
$time = time();
|
||||||
|
$logText = "Reset gold to 0 for all users";
|
||||||
|
$logEsc = $database->escape($logText);
|
||||||
|
|
||||||
mysqli_query($GLOBALS["link"], "UPDATE ".TB_PREFIX."users SET gold = '0' WHERE id !=0");
|
$database->query(
|
||||||
|
"INSERT INTO " . TB_PREFIX . "admin_log (`id`, `user`, `log`, `time`) " .
|
||||||
|
"VALUES (0, '$adminId', '$logEsc', $time)"
|
||||||
|
);
|
||||||
|
|
||||||
header("Location: ../../../Admin/admin.php?p=maintenenceResetGold&g");
|
header("Location: ../../../Admin/admin.php?p=maintenenceResetGold&g=1");
|
||||||
|
exit;
|
||||||
?>
|
?>
|
||||||
@@ -3,36 +3,62 @@
|
|||||||
## -= YOU MAY NOT REMOVE OR CHANGE THIS NOTICE =- ##
|
## -= YOU MAY NOT REMOVE OR CHANGE THIS NOTICE =- ##
|
||||||
## --------------------------------------------------------------------------- ##
|
## --------------------------------------------------------------------------- ##
|
||||||
## Filename mainteneceResetPlus.php ##
|
## Filename mainteneceResetPlus.php ##
|
||||||
|
## Type BACKEND ##
|
||||||
## Developed by: aggenkeech ##
|
## Developed by: aggenkeech ##
|
||||||
## License: TravianZ Project ##
|
## License: TravianZ Project ##
|
||||||
## Copyright: TravianZ (c) 2010-2025. All rights reserved. ##
|
## Copyright: TravianZ (c) 2010-2025. All rights reserved. ##
|
||||||
## ##
|
## ##
|
||||||
#################################################################################
|
#################################################################################
|
||||||
if (!isset($_SESSION)) session_start();
|
|
||||||
if($_SESSION['access'] < 9) die("Access Denied: You are not Admin!");
|
if (!isset($_SESSION)) {
|
||||||
|
session_start();
|
||||||
|
}
|
||||||
|
if (empty($_SESSION['access']) || $_SESSION['access'] < 9) {
|
||||||
|
die("Access Denied: You are not Admin!");
|
||||||
|
}
|
||||||
|
|
||||||
include_once("../../config.php");
|
include_once("../../config.php");
|
||||||
|
|
||||||
// go max 5 levels up - we don't have folders that go deeper than that
|
// ---------------------------------------------------------------------------
|
||||||
|
// Autoloader path
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
$autoprefix = '';
|
$autoprefix = '';
|
||||||
for ($i = 0; $i < 5; $i++) {
|
for ($i = 0; $i < 5; $i++) {
|
||||||
$autoprefix = str_repeat('../', $i);
|
$autoprefix = str_repeat('../', $i);
|
||||||
if (file_exists($autoprefix . 'autoloader.php')) {
|
if (file_exists($autoprefix . 'autoloader.php')) {
|
||||||
// we have our path, let's leave
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
include_once($autoprefix . "GameEngine/Database.php");
|
include_once($autoprefix . "GameEngine/Database.php");
|
||||||
|
|
||||||
$session = (int) $_POST['admid'];
|
// ---------------------------------------------------------------------------
|
||||||
|
// Verificare admin
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
$session = (int)($_POST['admid'] ?? 0);
|
||||||
|
$admin = $database->getUserArray($session, 1);
|
||||||
|
if (!$admin || (int)$admin['access'] !== 9) {
|
||||||
|
die('<h1><font color="red">Access Denied: You are not Admin!</font></h1>');
|
||||||
|
}
|
||||||
|
|
||||||
$sql = mysqli_query($GLOBALS["link"], "SELECT * FROM ".TB_PREFIX."users WHERE id = ".$session."");
|
// ---------------------------------------------------------------------------
|
||||||
$access = mysqli_fetch_array($sql);
|
// Reset Plus
|
||||||
$sessionaccess = $access['access'];
|
// ---------------------------------------------------------------------------
|
||||||
|
$database->query("UPDATE " . TB_PREFIX . "users SET plus = 0 WHERE id > 0");
|
||||||
|
|
||||||
if($sessionaccess != 9) die("<h1><font color=\"red\">Access Denied: You are not Admin!</font></h1>");
|
// ---------------------------------------------------------------------------
|
||||||
|
// Log admin
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
$adminId = (int)$_SESSION['id'];
|
||||||
|
$time = time();
|
||||||
|
$logText = "Reset Plus to 0 for all users";
|
||||||
|
$logEsc = $database->escape($logText);
|
||||||
|
|
||||||
mysqli_query($GLOBALS["link"], "UPDATE ".TB_PREFIX."users SET plus = '0' WHERE id !=0");
|
$database->query(
|
||||||
|
"INSERT INTO " . TB_PREFIX . "admin_log (`id`, `user`, `log`, `time`) " .
|
||||||
|
"VALUES (0, '$adminId', '$logEsc', $time)"
|
||||||
|
);
|
||||||
|
|
||||||
header("Location: ../../../Admin/admin.php?p=maintenenceResetPlus&g");
|
header("Location: ../../../Admin/admin.php?p=maintenenceResetPlus&g=1");
|
||||||
|
exit;
|
||||||
?>
|
?>
|
||||||
@@ -3,36 +3,62 @@
|
|||||||
## -= YOU MAY NOT REMOVE OR CHANGE THIS NOTICE =- ##
|
## -= YOU MAY NOT REMOVE OR CHANGE THIS NOTICE =- ##
|
||||||
## --------------------------------------------------------------------------- ##
|
## --------------------------------------------------------------------------- ##
|
||||||
## Filename mainteneceResetPlusBonus.php ##
|
## Filename mainteneceResetPlusBonus.php ##
|
||||||
|
## Type BACKEND ##
|
||||||
## Developed by: aggenkeech ##
|
## Developed by: aggenkeech ##
|
||||||
## License: TravianZ Project ##
|
## License: TravianZ Project ##
|
||||||
## Copyright: TravianZ (c) 2010-2025. All rights reserved. ##
|
## Copyright: TravianZ (c) 2010-2025. All rights reserved. ##
|
||||||
## ##
|
## ##
|
||||||
#################################################################################
|
#################################################################################
|
||||||
if (!isset($_SESSION)) session_start();
|
|
||||||
if($_SESSION['access'] < 9) die("Access Denied: You are not Admin!");
|
if (!isset($_SESSION)) {
|
||||||
|
session_start();
|
||||||
|
}
|
||||||
|
if (empty($_SESSION['access']) || $_SESSION['access'] < 9) {
|
||||||
|
die("Access Denied: You are not Admin!");
|
||||||
|
}
|
||||||
|
|
||||||
include_once("../../config.php");
|
include_once("../../config.php");
|
||||||
|
|
||||||
// go max 5 levels up - we don't have folders that go deeper than that
|
// ---------------------------------------------------------------------------
|
||||||
|
// Autoloader path
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
$autoprefix = '';
|
$autoprefix = '';
|
||||||
for ($i = 0; $i < 5; $i++) {
|
for ($i = 0; $i < 5; $i++) {
|
||||||
$autoprefix = str_repeat('../', $i);
|
$autoprefix = str_repeat('../', $i);
|
||||||
if (file_exists($autoprefix . 'autoloader.php')) {
|
if (file_exists($autoprefix . 'autoloader.php')) {
|
||||||
// we have our path, let's leave
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
include_once($autoprefix . "GameEngine/Database.php");
|
include_once($autoprefix . "GameEngine/Database.php");
|
||||||
|
|
||||||
$session = (int) $_POST['admid'];
|
// ---------------------------------------------------------------------------
|
||||||
|
// Verificare admin
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
$session = (int)($_POST['admid'] ?? 0);
|
||||||
|
$admin = $database->getUserArray($session, 1);
|
||||||
|
if (!$admin || (int)$admin['access'] !== 9) {
|
||||||
|
die('<h1><font color="red">Access Denied: You are not Admin!</font></h1>');
|
||||||
|
}
|
||||||
|
|
||||||
$sql = mysqli_query($GLOBALS["link"], "SELECT * FROM ".TB_PREFIX."users WHERE id = ".$session."");
|
// ---------------------------------------------------------------------------
|
||||||
$access = mysqli_fetch_array($sql);
|
// Reset bonusuri
|
||||||
$sessionaccess = $access['access'];
|
// ---------------------------------------------------------------------------
|
||||||
|
$database->query("UPDATE " . TB_PREFIX . "users SET b1 = 0, b2 = 0, b3 = 0, b4 = 0 WHERE id > 0");
|
||||||
|
|
||||||
if($sessionaccess != 9) die("<h1><font color=\"red\">Access Denied: You are not Admin!</font></h1>");
|
// ---------------------------------------------------------------------------
|
||||||
|
// Log admin
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
$adminId = (int)$_SESSION['id'];
|
||||||
|
$time = time();
|
||||||
|
$logText = "Reset resource bonuses (b1-b4) to 0 for all users";
|
||||||
|
$logEsc = $database->escape($logText);
|
||||||
|
|
||||||
mysqli_query($GLOBALS["link"], "UPDATE ".TB_PREFIX."users SET b1 = '0', b2 = '0', b3='0', b4='0' WHERE id !=0");
|
$database->query(
|
||||||
|
"INSERT INTO " . TB_PREFIX . "admin_log (`id`, `user`, `log`, `time`) " .
|
||||||
|
"VALUES (0, '$adminId', '$logEsc', $time)"
|
||||||
|
);
|
||||||
|
|
||||||
header("Location: ../../../Admin/admin.php?p=maintenenceResetPlusBonus&g");
|
header("Location: ../../../Admin/admin.php?p=maintenenceResetPlusBonus&g=1");
|
||||||
|
exit;
|
||||||
?>
|
?>
|
||||||
@@ -3,60 +3,77 @@
|
|||||||
## -= YOU MAY NOT REMOVE OR CHANGE THIS NOTICE =- ##
|
## -= YOU MAY NOT REMOVE OR CHANGE THIS NOTICE =- ##
|
||||||
## --------------------------------------------------------------------------- ##
|
## --------------------------------------------------------------------------- ##
|
||||||
## Filename mainteneceUnban.php ##
|
## Filename mainteneceUnban.php ##
|
||||||
|
## Type BACKEND ##
|
||||||
## Developed by: aggenkeech ##
|
## Developed by: aggenkeech ##
|
||||||
## License: TravianZ Project ##
|
## License: TravianZ Project ##
|
||||||
## Copyright: TravianZ (c) 2010-2025. All rights reserved. ##
|
## Copyright: TravianZ (c) 2010-2025. All rights reserved. ##
|
||||||
## ##
|
## ##
|
||||||
#################################################################################
|
#################################################################################
|
||||||
if (!isset($_SESSION)) session_start();
|
|
||||||
if($_SESSION['access'] < 9) die("Access Denied: You are not Admin!");
|
if (!isset($_SESSION)) {
|
||||||
|
session_start();
|
||||||
|
}
|
||||||
|
if (empty($_SESSION['access']) || $_SESSION['access'] < 9) {
|
||||||
|
die("Access Denied: You are not Admin!");
|
||||||
|
}
|
||||||
|
|
||||||
include_once("../../config.php");
|
include_once("../../config.php");
|
||||||
|
|
||||||
// go max 5 levels up - we don't have folders that go deeper than that
|
// ---------------------------------------------------------------------------
|
||||||
|
// Autoloader path
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
$autoprefix = '';
|
$autoprefix = '';
|
||||||
for ($i = 0; $i < 5; $i++) {
|
for ($i = 0; $i < 5; $i++) {
|
||||||
$autoprefix = str_repeat('../', $i);
|
$autoprefix = str_repeat('../', $i);
|
||||||
if (file_exists($autoprefix . 'autoloader.php')) {
|
if (file_exists($autoprefix . 'autoloader.php')) {
|
||||||
// we have our path, let's leave
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
include_once($autoprefix . "GameEngine/Database.php");
|
include_once($autoprefix . "GameEngine/Database.php");
|
||||||
|
|
||||||
foreach ($_POST as $key => $value) {
|
// ---------------------------------------------------------------------------
|
||||||
$_POST[$key] = $database->escape($value);
|
// Verificare admin
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
$session = (int)($_POST['admid'] ?? 0);
|
||||||
|
$admin = $database->getUserArray($session, 1);
|
||||||
|
if (!$admin || (int)$admin['access'] !== 9) {
|
||||||
|
die('<h1><font color="red">Access Denied: You are not Admin!</font></h1>');
|
||||||
}
|
}
|
||||||
|
|
||||||
$session = (int) $_POST['admid'];
|
// ---------------------------------------------------------------------------
|
||||||
|
// Input
|
||||||
$sql = mysqli_query($GLOBALS["link"], "SELECT * FROM ".TB_PREFIX."users WHERE id = ".$session."");
|
// ---------------------------------------------------------------------------
|
||||||
$access = mysqli_fetch_array($sql);
|
$reason = trim($_POST['unbanreason'] ?? '');
|
||||||
$sessionaccess = $access['access'];
|
if ($reason === '') {
|
||||||
|
header("Location: ../../../Admin/admin.php?p=ban&e=noreason");
|
||||||
if($sessionaccess != 9) die("<h1><font color=\"red\">Access Denied: You are not Admin!</font></h1>");
|
exit;
|
||||||
|
|
||||||
$users = mysqli_fetch_array(mysqli_query($GLOBALS["link"], "SELECT Count(*) as Total FROM ".TB_PREFIX."users"), MYSQLI_ASSOC);
|
|
||||||
$users = $users['Total'];
|
|
||||||
|
|
||||||
$reason = $_POST['unbanreason'];
|
|
||||||
$admin = $session;
|
|
||||||
$active = '0';
|
|
||||||
$access = '2';
|
|
||||||
$actualend = time();
|
|
||||||
|
|
||||||
$sql = "SELECT id FROM ".TB_PREFIX."users ORDER BY ID DESC LIMIT 1";
|
|
||||||
$loops = mysqli_result(mysqli_query($GLOBALS["link"], $sql), 0);
|
|
||||||
|
|
||||||
for($i = 0; $i < $loops + 1; $i++)
|
|
||||||
{
|
|
||||||
$query = "SELECT * FROM ".TB_PREFIX."users WHERE id = ".$i." AND access = ".$access."";
|
|
||||||
$result = mysqli_query($GLOBALS["link"], $query);
|
|
||||||
while($row = mysqli_fetch_assoc($result))
|
|
||||||
{
|
|
||||||
mysqli_query($GLOBALS["link"], "UPDATE ".TB_PREFIX."banlist SET active = '".$active."', end = '".$actualend."' WHERE reason = '".$reason."'");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
header("Location: ../../../Admin/admin.php?p=ban");
|
$reasonEsc = $database->escape($reason);
|
||||||
|
$time = time();
|
||||||
|
$adminId = (int)$session;
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
// Unban
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
$database->query(
|
||||||
|
"UPDATE " . TB_PREFIX . "banlist
|
||||||
|
SET active = 0, end = $time
|
||||||
|
WHERE reason = '$reasonEsc' AND active = 1"
|
||||||
|
);
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
// Log admin
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
$logText = "Mass unban for reason='$reasonEsc'";
|
||||||
|
$logEsc = $database->escape($logText);
|
||||||
|
|
||||||
|
$database->query(
|
||||||
|
"INSERT INTO " . TB_PREFIX . "admin_log (`id`, `user`, `log`, `time`) " .
|
||||||
|
"VALUES (0, '$adminId', '$logEsc', $time)"
|
||||||
|
);
|
||||||
|
|
||||||
|
header("Location: ../../../Admin/admin.php?p=ban&u=1");
|
||||||
|
exit;
|
||||||
?>
|
?>
|
||||||
@@ -2,123 +2,81 @@
|
|||||||
#################################################################################
|
#################################################################################
|
||||||
## -= YOU MAY NOT REMOVE OR CHANGE THIS NOTICE =- ##
|
## -= YOU MAY NOT REMOVE OR CHANGE THIS NOTICE =- ##
|
||||||
## --------------------------------------------------------------------------- ##
|
## --------------------------------------------------------------------------- ##
|
||||||
## Filename editBuildings.php ##
|
## Filename recalcWH.php (salvează clădirile (f1-f40) ##
|
||||||
|
## Type BACKEND ##
|
||||||
## Developed by: aggenkeech ##
|
## Developed by: aggenkeech ##
|
||||||
## License: TravianZ Project ##
|
## License: TravianZ Project ##
|
||||||
## Copyright: TravianZ (c) 2010-2025. All rights reserved. ##
|
## Copyright: TravianZ (c) 2010-2025. All rights reserved. ##
|
||||||
## ##
|
## ##
|
||||||
#################################################################################
|
#################################################################################
|
||||||
if (!isset($_SESSION)) session_start();
|
|
||||||
if($_SESSION['access'] < 9) die("Access Denied: You are not Admin!");
|
|
||||||
include_once("../../config.php");
|
|
||||||
|
|
||||||
foreach ($_POST as $key => $value) {
|
if (!isset($_SESSION)) {
|
||||||
$_POST[$key] = $database->escape($value);
|
session_start();
|
||||||
|
}
|
||||||
|
if (empty($_SESSION['access']) || $_SESSION['access'] < 9) {
|
||||||
|
die("Access Denied: You are not Admin!");
|
||||||
}
|
}
|
||||||
|
|
||||||
// go max 5 levels up - we don't have folders that go deeper than that
|
include_once("../../config.php");
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
// Autoloader path
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
$autoprefix = '';
|
$autoprefix = '';
|
||||||
for ($i = 0; $i < 5; $i++) {
|
for ($i = 0; $i < 5; $i++) {
|
||||||
$autoprefix = str_repeat('../', $i);
|
$autoprefix = str_repeat('../', $i);
|
||||||
if (file_exists($autoprefix . 'autoloader.php')) {
|
if (file_exists($autoprefix . 'autoloader.php')) {
|
||||||
// we have our path, let's leave
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
include_once($autoprefix . "GameEngine/Database.php");
|
include_once($autoprefix . "GameEngine/Database.php");
|
||||||
|
|
||||||
$session = (int) $_POST['admid'];
|
// ---------------------------------------------------------------------------
|
||||||
$id = (int) $_POST['id'];
|
// Verificare admin
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
$session = (int)($_POST['admid'] ?? 0);
|
||||||
|
$id = (int)($_POST['id'] ?? 0);
|
||||||
|
|
||||||
$sql = mysqli_query($GLOBALS["link"], "SELECT * FROM ".TB_PREFIX."users WHERE id = ".$session."");
|
$admin = $database->getUserArray($session, 1);
|
||||||
$access = mysqli_fetch_array($sql);
|
if (!$admin || (int)$admin['access'] !== 9) {
|
||||||
$sessionaccess = $access['access'];
|
die('<h1><font color="red">Access Denied: You are not Admin!</font></h1>');
|
||||||
|
}
|
||||||
|
|
||||||
if($sessionaccess != 9) die("<h1><font color=\"red\">Access Denied: You are not Admin!</font></h1>");
|
if ($id <= 0) {
|
||||||
|
header("Location: ../../../Admin/admin.php?p=villages");
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
mysqli_query($GLOBALS["link"], "UPDATE ".TB_PREFIX."fdata SET
|
// ---------------------------------------------------------------------------
|
||||||
f1 = '".$_POST['id1level']."',
|
// Construiește SET dinamic f1-f40
|
||||||
f1t = '".$_POST['id1gid']."',
|
// ---------------------------------------------------------------------------
|
||||||
f2 = '".$_POST['id2level']."',
|
$sets = [];
|
||||||
f2t = '".$_POST['id2gid']."',
|
for ($i = 1; $i <= 40; $i++) {
|
||||||
f3 = '".$_POST['id3level']."',
|
$lvl = (int)($_POST["id{$i}level"] ?? 0);
|
||||||
f3t = '".$_POST['id3gid']."',
|
$gid = (int)($_POST["id{$i}gid"] ?? 0);
|
||||||
f4 = '".$_POST['id4level']."',
|
$sets[] = "f$i = $lvl, f{$i}t = $gid";
|
||||||
f4t = '".$_POST['id4gid']."',
|
}
|
||||||
f5 = '".$_POST['id5level']."',
|
$setSql = implode(", ", $sets);
|
||||||
f5t = '".$_POST['id5gid']."',
|
|
||||||
f6 = '".$_POST['id6level']."',
|
|
||||||
f6t = '".$_POST['id6gid']."',
|
|
||||||
f7 = '".$_POST['id7level']."',
|
|
||||||
f7t = '".$_POST['id7gid']."',
|
|
||||||
f8 = '".$_POST['id8level']."',
|
|
||||||
f8t = '".$_POST['id8gid']."',
|
|
||||||
f9 = '".$_POST['id9level']."',
|
|
||||||
f9t = '".$_POST['id9gid']."',
|
|
||||||
f10 = '".$_POST['id10level']."',
|
|
||||||
f10t = '".$_POST['id10gid']."',
|
|
||||||
f11 = '".$_POST['id11level']."',
|
|
||||||
f11t = '".$_POST['id11gid']."',
|
|
||||||
f12 = '".$_POST['id12level']."',
|
|
||||||
f12t = '".$_POST['id12gid']."',
|
|
||||||
f13 = '".$_POST['id13level']."',
|
|
||||||
f13t = '".$_POST['id13gid']."',
|
|
||||||
f14 = '".$_POST['id14level']."',
|
|
||||||
f14t = '".$_POST['id14gid']."',
|
|
||||||
f15 = '".$_POST['id15level']."',
|
|
||||||
f15t = '".$_POST['id15gid']."',
|
|
||||||
f16 = '".$_POST['id16level']."',
|
|
||||||
f16t = '".$_POST['id16gid']."',
|
|
||||||
f17 = '".$_POST['id17level']."',
|
|
||||||
f17t = '".$_POST['id17gid']."',
|
|
||||||
f18 = '".$_POST['id18level']."',
|
|
||||||
f18t = '".$_POST['id18gid']."',
|
|
||||||
f19 = '".$_POST['id19level']."',
|
|
||||||
f19t = '".$_POST['id19gid']."',
|
|
||||||
f20 = '".$_POST['id20level']."',
|
|
||||||
f20t = '".$_POST['id20gid']."',
|
|
||||||
f21 = '".$_POST['id21level']."',
|
|
||||||
f21t = '".$_POST['id21gid']."',
|
|
||||||
f22 = '".$_POST['id22level']."',
|
|
||||||
f22t = '".$_POST['id22gid']."',
|
|
||||||
f23 = '".$_POST['id23level']."',
|
|
||||||
f23t = '".$_POST['id23gid']."',
|
|
||||||
f24 = '".$_POST['id24level']."',
|
|
||||||
f24t = '".$_POST['id24gid']."',
|
|
||||||
f25 = '".$_POST['id25level']."',
|
|
||||||
f25t = '".$_POST['id25gid']."',
|
|
||||||
f26 = '".$_POST['id26level']."',
|
|
||||||
f26t = '".$_POST['id26gid']."',
|
|
||||||
f27 = '".$_POST['id27level']."',
|
|
||||||
f27t = '".$_POST['id27gid']."',
|
|
||||||
f28 = '".$_POST['id28level']."',
|
|
||||||
f28t = '".$_POST['id28gid']."',
|
|
||||||
f29 = '".$_POST['id29level']."',
|
|
||||||
f29t = '".$_POST['id29gid']."',
|
|
||||||
f30 = '".$_POST['id30level']."',
|
|
||||||
f30t = '".$_POST['id30gid']."',
|
|
||||||
f31 = '".$_POST['id31level']."',
|
|
||||||
f31t = '".$_POST['id31gid']."',
|
|
||||||
f32 = '".$_POST['id32level']."',
|
|
||||||
f32t = '".$_POST['id32gid']."',
|
|
||||||
f33 = '".$_POST['id33level']."',
|
|
||||||
f33t = '".$_POST['id33gid']."',
|
|
||||||
f34 = '".$_POST['id34level']."',
|
|
||||||
f34t = '".$_POST['id34gid']."',
|
|
||||||
f35 = '".$_POST['id35level']."',
|
|
||||||
f35t = '".$_POST['id35gid']."',
|
|
||||||
f36 = '".$_POST['id36level']."',
|
|
||||||
f36t = '".$_POST['id36gid']."',
|
|
||||||
f37 = '".$_POST['id37level']."',
|
|
||||||
f37t = '".$_POST['id37gid']."',
|
|
||||||
f38 = '".$_POST['id38level']."',
|
|
||||||
f38t = '".$_POST['id38gid']."',
|
|
||||||
f39 = '".$_POST['id39level']."',
|
|
||||||
f39t = '".$_POST['id39gid']."',
|
|
||||||
f40 = '".$_POST['id40level']."',
|
|
||||||
f40t = '".$_POST['id40gid']."'
|
|
||||||
WHERE vref = $id") or die(mysqli_error($database->dblink));
|
|
||||||
|
|
||||||
header("Location: ../../../Admin/admin.php?action=recountPop&did=".$id."");
|
// ---------------------------------------------------------------------------
|
||||||
|
// Update
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
$database->query("UPDATE " . TB_PREFIX . "fdata SET $setSql WHERE vref = $id");
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
// Log admin
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
$adminId = (int)$_SESSION['id'];
|
||||||
|
$time = time();
|
||||||
|
$logText = "Recalculated buildings for village $id";
|
||||||
|
$logEsc = $database->escape($logText);
|
||||||
|
|
||||||
|
$database->query(
|
||||||
|
"INSERT INTO " . TB_PREFIX . "admin_log (`id`, `user`, `log`, `time`) " .
|
||||||
|
"VALUES (0, '$adminId', '$logEsc', $time)"
|
||||||
|
);
|
||||||
|
|
||||||
|
header("Location: ../../../Admin/admin.php?action=recountPop&did=" . $id);
|
||||||
|
exit;
|
||||||
?>
|
?>
|
||||||
@@ -3,45 +3,74 @@
|
|||||||
## -= YOU MAY NOT REMOVE OR CHANGE THIS NOTICE =- ##
|
## -= YOU MAY NOT REMOVE OR CHANGE THIS NOTICE =- ##
|
||||||
## --------------------------------------------------------------------------- ##
|
## --------------------------------------------------------------------------- ##
|
||||||
## Filename renameVillage.php ##
|
## Filename renameVillage.php ##
|
||||||
|
## Type BACKEND ##
|
||||||
## Developed by: aggenkeech ##
|
## Developed by: aggenkeech ##
|
||||||
## License: TravianZ Project ##
|
## License: TravianZ Project ##
|
||||||
## Copyright: TravianZ (c) 2010-2025. All rights reserved. ##
|
## Copyright: TravianZ (c) 2010-2025. All rights reserved. ##
|
||||||
## ##
|
## ##
|
||||||
#################################################################################
|
#################################################################################
|
||||||
if (!isset($_SESSION)) session_start();
|
|
||||||
if($_SESSION['access'] < 9) die("Access Denied: You are not Admin!");
|
if (!isset($_SESSION)) {
|
||||||
|
session_start();
|
||||||
|
}
|
||||||
|
if (empty($_SESSION['access']) || $_SESSION['access'] < 9) {
|
||||||
|
die("Access Denied: You are not Admin!");
|
||||||
|
}
|
||||||
|
|
||||||
include_once("../../config.php");
|
include_once("../../config.php");
|
||||||
|
|
||||||
// go max 5 levels up - we don't have folders that go deeper than that
|
// ---------------------------------------------------------------------------
|
||||||
|
// Autoloader path
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
$autoprefix = '';
|
$autoprefix = '';
|
||||||
for ($i = 0; $i < 5; $i++) {
|
for ($i = 0; $i < 5; $i++) {
|
||||||
$autoprefix = str_repeat('../', $i);
|
$autoprefix = str_repeat('../', $i);
|
||||||
if (file_exists($autoprefix . 'autoloader.php')) {
|
if (file_exists($autoprefix . 'autoloader.php')) {
|
||||||
// we have our path, let's leave
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
include_once($autoprefix . "GameEngine/Database.php");
|
include_once($autoprefix . "GameEngine/Database.php");
|
||||||
|
|
||||||
$nameorig = $_POST['villagename'];
|
// ---------------------------------------------------------------------------
|
||||||
|
// Input
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
$session = (int)($_POST['admid'] ?? 0);
|
||||||
|
$did = (int)($_POST['did'] ?? 0);
|
||||||
|
$nameOrig = trim($_POST['villagename'] ?? '');
|
||||||
|
|
||||||
foreach ($_POST as $key => $value) {
|
if ($did <= 0 || $nameOrig === '') {
|
||||||
$_POST[$key] = $database->escape($value);
|
header("Location: ../../../Admin/admin.php?p=village&did=$did&e=1");
|
||||||
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
$did = (int) $_POST['did'];
|
// ---------------------------------------------------------------------------
|
||||||
$name = $_POST['villagename'];
|
// Verificare admin
|
||||||
$session = (int) $_POST['admid'];
|
// ---------------------------------------------------------------------------
|
||||||
|
$admin = $database->getUserArray($session, 1);
|
||||||
|
if (!$admin || (int)$admin['access'] !== 9) {
|
||||||
|
die('<h1><font color="red">Access Denied: You are not Admin!</font></h1>');
|
||||||
|
}
|
||||||
|
|
||||||
$sql = mysqli_query($GLOBALS["link"], "SELECT * FROM ".TB_PREFIX."users WHERE id = ".$session."");
|
// ---------------------------------------------------------------------------
|
||||||
$access = mysqli_fetch_array($sql);
|
// Update
|
||||||
$sessionaccess = $access['access'];
|
// ---------------------------------------------------------------------------
|
||||||
|
$nameEsc = $database->escape($nameOrig);
|
||||||
|
$database->query("UPDATE " . TB_PREFIX . "vdata SET name = '$nameEsc' WHERE wref = $did");
|
||||||
|
|
||||||
if($sessionaccess != 9) die("<h1><font color=\"red\">Access Denied: You are not Admin!</font></h1>");
|
// ---------------------------------------------------------------------------
|
||||||
|
// Log admin
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
$adminId = (int)$_SESSION['id'];
|
||||||
|
$time = time();
|
||||||
|
$logText = "Renamed village <a href='admin.php?p=village&did=$did'>$did</a> to '$nameEsc'";
|
||||||
|
$logEsc = $database->escape($logText);
|
||||||
|
|
||||||
$sql = "UPDATE ".TB_PREFIX."vdata SET name = '$name' WHERE wref = $did";
|
$database->query(
|
||||||
mysqli_query($GLOBALS["link"], $sql);
|
"INSERT INTO " . TB_PREFIX . "admin_log (`id`, `user`, `log`, `time`) " .
|
||||||
|
"VALUES (0, '$adminId', '$logEsc', $time)"
|
||||||
|
);
|
||||||
|
|
||||||
header("Location: ../../../Admin/admin.php?p=village&did=".$did."&name=".$nameorig."");
|
header("Location: ../../../Admin/admin.php?p=village&did=" . $did);
|
||||||
|
exit;
|
||||||
?>
|
?>
|
||||||
@@ -3,39 +3,81 @@
|
|||||||
## -= YOU MAY NOT REMOVE OR CHANGE THIS NOTICE =- ##
|
## -= YOU MAY NOT REMOVE OR CHANGE THIS NOTICE =- ##
|
||||||
## --------------------------------------------------------------------------- ##
|
## --------------------------------------------------------------------------- ##
|
||||||
## Filename sendMessage.php ##
|
## Filename sendMessage.php ##
|
||||||
|
## Type BACKEND ##
|
||||||
## Developed by: aggenkeech ##
|
## Developed by: aggenkeech ##
|
||||||
## License: TravianZ Project ##
|
## License: TravianZ Project ##
|
||||||
## Copyright: TravianZ (c) 2010-2025. All rights reserved. ##
|
## Copyright: TravianZ (c) 2010-2025. All rights reserved. ##
|
||||||
## ##
|
## ##
|
||||||
#################################################################################
|
#################################################################################
|
||||||
if (!isset($_SESSION)) session_start();
|
|
||||||
if($_SESSION['access'] < 9) die("Access Denied: You are not Admin!");
|
if (!isset($_SESSION)) {
|
||||||
|
session_start();
|
||||||
|
}
|
||||||
|
if (empty($_SESSION['access']) || $_SESSION['access'] < 9) {
|
||||||
|
die("Access Denied: You are not Admin!");
|
||||||
|
}
|
||||||
|
|
||||||
include_once("../../config.php");
|
include_once("../../config.php");
|
||||||
|
|
||||||
// go max 5 levels up - we don't have folders that go deeper than that
|
// ---------------------------------------------------------------------------
|
||||||
|
// Autoloader path
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
$autoprefix = '';
|
$autoprefix = '';
|
||||||
for ($i = 0; $i < 5; $i++) {
|
for ($i = 0; $i < 5; $i++) {
|
||||||
$autoprefix = str_repeat('../', $i);
|
$autoprefix = str_repeat('../', $i);
|
||||||
if (file_exists($autoprefix . 'autoloader.php')) {
|
if (file_exists($autoprefix . 'autoloader.php')) {
|
||||||
// we have our path, let's leave
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
include_once($autoprefix . "GameEngine/Database.php");
|
include_once($autoprefix . "GameEngine/Database.php");
|
||||||
|
|
||||||
$session = (int) $_POST['admid'];
|
// ---------------------------------------------------------------------------
|
||||||
|
// Input
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
$session = (int)($_POST['admid'] ?? 0);
|
||||||
|
$uid = (int)($_POST['uid'] ?? 0);
|
||||||
|
$topic = trim($_POST['topic'] ?? 'Admin Message');
|
||||||
|
$message = trim($_POST['message'] ?? '');
|
||||||
|
|
||||||
|
if ($uid <= 0 || $message === '') {
|
||||||
|
header("Location: ../../../Admin/admin.php?p=Newmessage&uid=$uid&e=1");
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
$sql = mysqli_query($GLOBALS["link"], "SELECT * FROM ".TB_PREFIX."users WHERE id = ".$session."");
|
// ---------------------------------------------------------------------------
|
||||||
$access = mysqli_fetch_array($sql);
|
// Verificare admin
|
||||||
$sessionaccess = $access['access'];
|
// ---------------------------------------------------------------------------
|
||||||
|
$admin = $database->getUserArray($session, 1);
|
||||||
|
if (!$admin || (int)$admin['access'] !== 9) {
|
||||||
|
die('<h1><font color="red">Access Denied: You are not Admin!</font></h1>');
|
||||||
|
}
|
||||||
|
|
||||||
if($sessionaccess != 9) die("<h1><font color=\"red\">Access Denied: You are not Admin!</font></h1>");
|
// ---------------------------------------------------------------------------
|
||||||
|
// Insert mesaj
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
$time = time();
|
||||||
|
$topicEsc = $database->escape($topic);
|
||||||
|
$msgEsc = $database->escape($message);
|
||||||
|
|
||||||
$query = "INSERT INTO ".TB_PREFIX."mdata (target, owner, topic, message, viewed, time) VALUES ('$uid', 1, '$topic', '$message', 0, '$time')";
|
$database->query(
|
||||||
|
"INSERT INTO " . TB_PREFIX . "mdata
|
||||||
|
(target, owner, topic, message, viewed, time, archive)
|
||||||
|
VALUES ($uid, 1, '$topicEsc', '$msgEsc', 0, $time, 0)"
|
||||||
|
);
|
||||||
|
|
||||||
mysqli_query($GLOBALS["link"], $query);
|
// ---------------------------------------------------------------------------
|
||||||
|
// Log admin
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
$adminId = (int)$_SESSION['id'];
|
||||||
|
$logText = "Sent message to uid $uid: '$topicEsc'";
|
||||||
|
$logEsc = $database->escape($logText);
|
||||||
|
|
||||||
|
$database->query(
|
||||||
|
"INSERT INTO " . TB_PREFIX . "admin_log (`id`, `user`, `log`, `time`) " .
|
||||||
|
"VALUES (0, '$adminId', '$logEsc', $time)"
|
||||||
|
);
|
||||||
|
|
||||||
header("Location: ../../../Admin/admin.php?p=Newmessage&uid=" . $uid . "&msg=ok");
|
header("Location: ../../../Admin/admin.php?p=Newmessage&uid=" . $uid . "&msg=ok");
|
||||||
|
exit;
|
||||||
?>
|
?>
|
||||||
+155
-197
@@ -1,21 +1,23 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
#################################################################################
|
#################################################################################
|
||||||
## ##
|
## -= YOU MAY NOT REMOVE OR CHANGE THIS NOTICE =- ##
|
||||||
## -= YOU MUST NOT REMOVE OR CHANGE THIS NOTICE =- ##
|
|
||||||
## ##
|
|
||||||
## --------------------------------------------------------------------------- ##
|
## --------------------------------------------------------------------------- ##
|
||||||
## ##
|
|
||||||
## Project: TravianZ ##
|
## Project: TravianZ ##
|
||||||
## Version: 05.03.2014 ##
|
## Version: 18.05.2026 ##
|
||||||
## Filename: GameEngine/Admin/database.php ##
|
## Filename: GameEngine\Admin\database.php ##
|
||||||
## Developed by: Dzoki ##
|
## Developed by: Dzoki ##
|
||||||
## Edited by: Shadow and ronix ##
|
## Refactored by: Shadow ##
|
||||||
## License: Creative Commons BY-NC-SA 3.0 ##
|
## License: TravianZ Project ##
|
||||||
## Copyright: TravianZ (c) 2014 - All rights reserved ##
|
## Copyright: TravianZ (c) 2010-2026. All rights reserved. ##
|
||||||
## URLs: http://travian.shadowss.ro ##
|
## URLs: https://travianz.org ##
|
||||||
## Source code: https://github.com/Shadowss/TravianZ ##
|
## https://github.com/Shadowss/TravianZ ##
|
||||||
## ##
|
## ##
|
||||||
#################################################################################
|
#################################################################################
|
||||||
|
|
||||||
|
/* ---------------------------------------------------------------------------
|
||||||
|
* Compatibilitate mysqli_result pentru cod legacy
|
||||||
|
* --------------------------------------------------------------------------- */
|
||||||
if (!function_exists('mysqli_result')) {
|
if (!function_exists('mysqli_result')) {
|
||||||
function mysqli_result($res, $row, $field = 0) {
|
function mysqli_result($res, $row, $field = 0) {
|
||||||
$res->data_seek($row);
|
$res->data_seek($row);
|
||||||
@@ -24,16 +26,20 @@ if (!function_exists('mysqli_result')) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// go max 5 levels up - we don't have folders that go deeper than that
|
/* ---------------------------------------------------------------------------
|
||||||
|
* Autoloader path - caută maxim 5 nivele în sus
|
||||||
|
* --------------------------------------------------------------------------- */
|
||||||
$autoprefix = '';
|
$autoprefix = '';
|
||||||
for ($i = 0; $i < 5; $i++) {
|
for ($i = 0; $i < 5; $i++) {
|
||||||
$autoprefix = str_repeat('../', $i);
|
$autoprefix = str_repeat('../', $i);
|
||||||
if (file_exists($autoprefix. 'autoloader.php')) {
|
if (file_exists($autoprefix. 'autoloader.php')) {
|
||||||
// we have our path, let's leave
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* ---------------------------------------------------------------------------
|
||||||
|
* Include-uri condiționate
|
||||||
|
* --------------------------------------------------------------------------- */
|
||||||
if (isset($gameinstall) && $gameinstall == 1) {
|
if (isset($gameinstall) && $gameinstall == 1) {
|
||||||
include_once($autoprefix. "GameEngine/config.php");
|
include_once($autoprefix. "GameEngine/config.php");
|
||||||
include_once($autoprefix. "GameEngine/Data/buidata.php");
|
include_once($autoprefix. "GameEngine/Data/buidata.php");
|
||||||
@@ -43,25 +49,31 @@ if(isset($gameinstall) && $gameinstall == 1){
|
|||||||
include_once($autoprefix. "GameEngine/Data/buidata.php");
|
include_once($autoprefix. "GameEngine/Data/buidata.php");
|
||||||
}
|
}
|
||||||
include_once($autoprefix. "GameEngine/Database.php");
|
include_once($autoprefix. "GameEngine/Database.php");
|
||||||
|
|
||||||
|
/* ---------------------------------------------------------------------------
|
||||||
|
* Clasa principală admin DB
|
||||||
|
* --------------------------------------------------------------------------- */
|
||||||
class adm_DB {
|
class adm_DB {
|
||||||
|
|
||||||
var $connection;
|
var $connection;
|
||||||
|
|
||||||
function __construct() {
|
function __construct() {
|
||||||
global $database;
|
global $database;
|
||||||
$database = new MYSQLi_DB(SQL_SERVER, SQL_USER, SQL_PASS, SQL_DB, (defined('SQL_PORT')? SQL_PORT : 3306));
|
$database = new MYSQLi_DB(SQL_SERVER, SQL_USER, SQL_PASS, SQL_DB, (defined('SQL_PORT')? SQL_PORT : 3306));
|
||||||
$this->connection = $database->return_link();
|
$this->connection = $database->return_link();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* ---------------- Login admin ---------------- */
|
||||||
function Login($username, $password) {
|
function Login($username, $password) {
|
||||||
global $database;
|
global $database;
|
||||||
list($username, $password) = $database->escape_input($username, $password);
|
list($username, $password) = $database->escape_input($username, $password);
|
||||||
|
|
||||||
$q = "SELECT id, password, is_bcrypt FROM ".TB_PREFIX."users where username = '$username' and access >= ".MULTIHUNTER;
|
$q = "SELECT id, password, is_bcrypt FROM ". TB_PREFIX. "users WHERE username = '$username' AND access >= ". MULTIHUNTER;
|
||||||
$result = mysqli_query($this->connection, $q);
|
$result = mysqli_query($this->connection, $q);
|
||||||
|
|
||||||
// if we didn't update the database for bcrypt hashes yet...
|
// compatibilitate cu DB fără coloana is_bcrypt
|
||||||
if (mysqli_error($database->dblink)!= '') {
|
if (mysqli_error($database->dblink)!= '') {
|
||||||
$q = "SELECT id, password, 0 as is_bcrypt FROM ".TB_PREFIX."users where username = '$username' and access >= ".MULTIHUNTER;
|
$q = "SELECT id, password, 0 as is_bcrypt FROM ". TB_PREFIX. "users WHERE username = '$username' AND access >= ". MULTIHUNTER;
|
||||||
$result = mysqli_query($this->connection, $q);
|
$result = mysqli_query($this->connection, $q);
|
||||||
$bcrypt_update_done = false;
|
$bcrypt_update_done = false;
|
||||||
} else {
|
} else {
|
||||||
@@ -70,10 +82,7 @@ class adm_DB {
|
|||||||
|
|
||||||
$dbarray = mysqli_fetch_array($result);
|
$dbarray = mysqli_fetch_array($result);
|
||||||
|
|
||||||
// even if we didn't do a DB conversion for bcrypt passwords,
|
// verificare parolă - bcrypt sau md5 legacy
|
||||||
// we still need to check if this password wasn't encrypted via password_hash,
|
|
||||||
// since all methods were updated to use that instead of md5 and therefore
|
|
||||||
// new passwords in DB will be bcrypt already even without the is_bcrypt field present
|
|
||||||
$bcrypted = true;
|
$bcrypted = true;
|
||||||
$pwOk = password_verify($password, $dbarray['password']);
|
$pwOk = password_verify($password, $dbarray['password']);
|
||||||
|
|
||||||
@@ -84,20 +93,19 @@ class adm_DB {
|
|||||||
|
|
||||||
$username = htmlspecialchars($username);
|
$username = htmlspecialchars($username);
|
||||||
if ($pwOk) {
|
if ($pwOk) {
|
||||||
// update password to bcrypt, if correct
|
// upgrade la bcrypt dacă e necesar
|
||||||
if (!$dbarray['is_bcrypt'] &&!$bcrypted) {
|
if (!$dbarray['is_bcrypt'] &&!$bcrypted) {
|
||||||
mysqli_query($this->connection, "UPDATE " . TB_PREFIX . "users SET password = '".password_hash($password, PASSWORD_BCRYPT,['cost' => 12])."'".($bcrypt_update_done ? ', is_bcrypt = 1' : '')." where id = ".(int) $dbarray['id']);
|
mysqli_query($this->connection, "UPDATE ". TB_PREFIX. "users SET password = '". password_hash($password, PASSWORD_BCRYPT, ['cost' => 12]). "'". ($bcrypt_update_done? ", is_bcrypt = 1" : ""). " WHERE id = ". (int)$dbarray['id']);
|
||||||
}
|
}
|
||||||
|
mysqli_query($this->connection, "INSERT INTO ". TB_PREFIX. "admin_log VALUES (0,'X','$username logged in (IP: <b>". $_SERVER['REMOTE_ADDR']. "</b>)',". time(). ")");
|
||||||
mysqli_query($this->connection,"Insert into ".TB_PREFIX."admin_log values (0,'X','$username logged in (IP: <b>".$_SERVER['REMOTE_ADDR']."</b>)',".time().")");
|
|
||||||
return true;
|
return true;
|
||||||
}
|
} else {
|
||||||
else {
|
mysqli_query($this->connection, "INSERT INTO ". TB_PREFIX. "admin_log VALUES (0,'X','<font color=\'red\'><b>IP: ". $_SERVER['REMOTE_ADDR']. " tried to log in with username <u> $username</u> but access was denied!</font></b>',". time(). ")");
|
||||||
mysqli_query($this->connection,"Insert into ".TB_PREFIX."admin_log values (0,'X','<font color=\'red\'><b>IP: ".$_SERVER['REMOTE_ADDR']." tried to log in with username <u> $username</u> but access was denied!</font></b>',".time().")");
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* ---------------- Recalculare populație ---------------- */
|
||||||
function recountPopUser($uid) {
|
function recountPopUser($uid) {
|
||||||
global $database;
|
global $database;
|
||||||
$villages = $database->getProfileVillages($uid);
|
$villages = $database->getProfileVillages($uid);
|
||||||
@@ -119,8 +127,7 @@ class adm_DB {
|
|||||||
$popTot += $this->buildingPOP($building, $lvl);
|
$popTot += $this->buildingPOP($building, $lvl);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
$q = "UPDATE ". TB_PREFIX. "vdata SET pop = $popTot WHERE wref = ". (int)$vid;
|
||||||
$q = "UPDATE ".TB_PREFIX."vdata set pop = $popTot where wref = ".(int) $vid;
|
|
||||||
mysqli_query($this->connection, $q);
|
mysqli_query($this->connection, $q);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -135,7 +142,7 @@ class adm_DB {
|
|||||||
$popTot += $this->buildingCP($building, $lvl);
|
$popTot += $this->buildingCP($building, $lvl);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$q = "UPDATE ".TB_PREFIX."vdata set cp = $popTot where wref = ".(int) $vid;
|
$q = "UPDATE ". TB_PREFIX. "vdata SET cp = $popTot WHERE wref = ". (int)$vid;
|
||||||
mysqli_query($this->connection, $q);
|
mysqli_query($this->connection, $q);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -144,7 +151,6 @@ class adm_DB {
|
|||||||
global $$name;
|
global $$name;
|
||||||
$popT = 0;
|
$popT = 0;
|
||||||
$dataarray = $$name;
|
$dataarray = $$name;
|
||||||
|
|
||||||
for ($i = 1; $i <= $lvl; $i++) {
|
for ($i = 1; $i <= $lvl; $i++) {
|
||||||
$popT += $dataarray[$i]['pop']?? 0;
|
$popT += $dataarray[$i]['pop']?? 0;
|
||||||
}
|
}
|
||||||
@@ -156,15 +162,15 @@ class adm_DB {
|
|||||||
global $$name;
|
global $$name;
|
||||||
$popT = 0;
|
$popT = 0;
|
||||||
$dataarray = $$name;
|
$dataarray = $$name;
|
||||||
|
|
||||||
for ($i = 1; $i <= $lvl; $i++) {
|
for ($i = 1; $i <= $lvl; $i++) {
|
||||||
$popT += $dataarray[$i]['cp']?? 0;
|
$popT += $dataarray[$i]['cp']?? 0;
|
||||||
}
|
}
|
||||||
return $popT;
|
return $popT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* ---------------- Utilitare sate ---------------- */
|
||||||
function getWref($x, $y) {
|
function getWref($x, $y) {
|
||||||
$q = "SELECT id FROM ".TB_PREFIX."wdata where x = ".(int) $x." and y = ".(int) $y;
|
$q = "SELECT id FROM ". TB_PREFIX. "wdata WHERE x = ". (int)$x. " AND y = ". (int)$y;
|
||||||
$result = mysqli_query($this->connection, $q);
|
$result = mysqli_query($this->connection, $q);
|
||||||
$r = mysqli_fetch_array($result);
|
$r = mysqli_fetch_array($result);
|
||||||
return $r['id'];
|
return $r['id'];
|
||||||
@@ -173,11 +179,11 @@ class adm_DB {
|
|||||||
function AddVillage($post) {
|
function AddVillage($post) {
|
||||||
global $database;
|
global $database;
|
||||||
$wid = $this->getWref($post['x'], $post['y']);
|
$wid = $this->getWref($post['x'], $post['y']);
|
||||||
$uid = $post['uid'];
|
$uid = (int)$post['uid'];
|
||||||
$status = $database->getVillageState($wid);
|
$status = $database->getVillageState($wid);
|
||||||
$status = 0;
|
$status = 0;
|
||||||
if ($status == 0) {
|
if ($status == 0) {
|
||||||
mysqli_query($this->connection,"Insert into ".TB_PREFIX."admin_log values (0,".(int) $_SESSION['id'].",'Added new village <b><a href=\'admin.php?p=village&did=$wid\'>$wid</a></b> to user <b><a href=\'admin.php?p=player&uid=$uid\'>$uid</a></b>',".time().")");
|
mysqli_query($this->connection, "INSERT INTO ". TB_PREFIX. "admin_log VALUES (0,". (int)$_SESSION['id']. ",'Added new village <b><a href=\'admin.php?p=village&did=$wid\'>$wid</a></b> to user <b><a href=\'admin.php?p=player&uid=$uid\'>$uid</a></b>',". time(). ")");
|
||||||
$database->setFieldTaken($wid);
|
$database->setFieldTaken($wid);
|
||||||
$username = $database->getUserArray($uid, 1);
|
$username = $database->getUserArray($uid, 1);
|
||||||
$username = $username['username'];
|
$username = $username['username'];
|
||||||
@@ -189,107 +195,119 @@ class adm_DB {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* ---------------- Pedepsire jucător ---------------- */
|
||||||
|
|
||||||
function Punish($post) {
|
function Punish($post) {
|
||||||
global $database;
|
global $database;
|
||||||
$villages = $database->getProfileVillages($post['uid']);
|
$villages = $database->getProfileVillages($post['uid']);
|
||||||
$admid = $post['admid'];
|
|
||||||
$user = $database->getUserArray($post['uid'], 1);
|
$user = $database->getUserArray($post['uid'], 1);
|
||||||
for ($i = 0; $i <= count($villages)-1; $i++) {
|
$logPunishment = '';
|
||||||
$vid = $villages[$i]['wref'];
|
|
||||||
if($post['punish']){
|
|
||||||
$logPunishment = "<b>-".(int) $post['punish']."%</b> population";
|
|
||||||
$popOld = $villages[$i]['pop'];
|
|
||||||
$proc = 100-$post['punish'];
|
|
||||||
$pop = floor(($popOld/100)*($proc));
|
|
||||||
if($pop <= 1 ){$pop = 2;}
|
|
||||||
$this->PunishBuilding($vid,$proc,$pop);
|
|
||||||
|
|
||||||
|
for ($i = 0; $i < count($villages); $i++) {
|
||||||
|
$vid = (int)$villages[$i]['wref'];
|
||||||
|
|
||||||
|
// 1. pedeapsă procent populație
|
||||||
|
if (!empty($post['punish'])) {
|
||||||
|
$punish = (int)$post['punish'];
|
||||||
|
$logPunishment = "<b>-". $punish ."%</b> population";
|
||||||
|
$popOld = (int)$villages[$i]['pop'];
|
||||||
|
$proc = 100 - $punish;
|
||||||
|
$pop = floor(($popOld / 100) * $proc);
|
||||||
|
if ($pop < 2) { $pop = 2; }
|
||||||
|
$this->PunishBuilding($vid, $proc, $pop);
|
||||||
}
|
}
|
||||||
if($post['del_troop']){
|
|
||||||
|
// 2. ștergere trupe - CORECTAT
|
||||||
|
if (!empty($post['del_troop'])) {
|
||||||
$logPunishment = "<b>troops removal</b>";
|
$logPunishment = "<b>troops removal</b>";
|
||||||
if($user['tribe'] == 1) {
|
$tribe = (int)$user['tribe'];
|
||||||
$unit = 1;
|
// 1=Romani (1-10), 2=Teutoni (11-20), 3=Gali (21-30), 4=Natura (31-40), 5=Natari (41-50)
|
||||||
}else if($user['tribe'] == 2) {
|
$unitStart = ($tribe >= 1 && $tribe <= 5) ? (($tribe - 1) * 10 + 1) : 1;
|
||||||
$unit = 11;
|
$this->DelUnits($vid, $unitStart);
|
||||||
}else if($user['tribe'] == 3) {
|
|
||||||
$unit = 21;
|
|
||||||
}
|
}
|
||||||
$this->DelUnits($villages[$i]['wref'],$unit);
|
|
||||||
}
|
// 3. golire depozite
|
||||||
if($post['clean_ware']){
|
if (!empty($post['clean_ware'])) {
|
||||||
$logPunishment = "<b>emptying warehouses</b>";
|
$logPunishment = "<b>emptying warehouses</b>";
|
||||||
$time = time();
|
$time = time();
|
||||||
$q = "UPDATE ".TB_PREFIX."vdata SET `wood` = '0', `clay` = '0', `iron` = '0', `crop` = '0', `lastupdate` = '$time' WHERE wref = ".(int) $vid;
|
$q = "UPDATE ". TB_PREFIX ."vdata SET `wood`='0', `clay`='0', `iron`='0', `crop`='0', `lastupdate`='$time' WHERE wref=$vid";
|
||||||
mysqli_query($this->connection, $q);
|
mysqli_query($this->connection, $q);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
mysqli_query($this->connection,"Insert into ".TB_PREFIX."admin_log values (0,".(int) $_SESSION['id'].",'Punished user: <a href=\'admin.php?p=player&uid=".(int) $post['uid']."\'>".(int) $post['uid']."</a> with ".$logPunishment."',".time().")");
|
|
||||||
|
mysqli_query($this->connection, "INSERT INTO ". TB_PREFIX ."admin_log VALUES (0,". (int)$_SESSION['id'] .",'Punished user: <a href=\'admin.php?p=player&uid=". (int)$post['uid'] ."\'>". (int)$post['uid'] ."</a> with ". $logPunishment ."',". time() .")");
|
||||||
}
|
}
|
||||||
|
|
||||||
function PunishBuilding($vid, $proc, $pop) {
|
function PunishBuilding($vid, $proc, $pop) {
|
||||||
global $database;
|
global $database;
|
||||||
$q = "UPDATE ".TB_PREFIX."vdata set pop = ".(int) $pop." where wref = ".(int) $vid;
|
$vid = (int)$vid;
|
||||||
mysqli_query($this->connection,$q);
|
mysqli_query($this->connection, "UPDATE ". TB_PREFIX ."vdata SET pop=". (int)$pop ." WHERE wref=$vid");
|
||||||
|
|
||||||
$fdata = $database->getResourceLevel($vid);
|
$fdata = $database->getResourceLevel($vid);
|
||||||
for ($i = 1; $i <= 40; $i++) {
|
for ($i = 1; $i <= 40; $i++) {
|
||||||
if ($fdata['f'.$i] > 1) {
|
if ($fdata['f'.$i] > 1) {
|
||||||
$zm = ($fdata['f'.$i] / 100) * $proc;
|
$zm = ($fdata['f'.$i] / 100) * $proc;
|
||||||
if($zm < 1){$zm = 1;}else{$zm = floor($zm);}
|
$zm = ($zm < 1) ? 1 : floor($zm);
|
||||||
$q = "UPDATE ".TB_PREFIX."fdata SET `f$i` = '$zm' WHERE `vref` = ".(int) $vid;
|
mysqli_query($this->connection, "UPDATE ". TB_PREFIX ."fdata SET `f$i`='$zm' WHERE `vref`=$vid");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// CORECTAT: șterge doar cele 10 unități ale tribului, FĂRĂ erou
|
||||||
|
function DelUnits($vid, $unitStart) {
|
||||||
|
$vid = (int)$vid;
|
||||||
|
$unitStart = (int)$unitStart;
|
||||||
|
$sets = [];
|
||||||
|
for ($i = $unitStart; $i <= $unitStart + 9; $i++) {
|
||||||
|
$sets[] = "`u$i`='0'";
|
||||||
|
}
|
||||||
|
// intenționat NU includem `hero` - eroul trebuie să rămână în sat
|
||||||
|
$q = "UPDATE ". TB_PREFIX ."units SET ". implode(', ', $sets) ." WHERE `vref`=$vid";
|
||||||
mysqli_query($this->connection, $q);
|
mysqli_query($this->connection, $q);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function DelUnits($vid,$unit){
|
|
||||||
for ($i = $unit; $i <= 9+$unit; $i++) {
|
|
||||||
$this->DelUnits2($vid,$unit);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
// păstrată pentru compatibilitate (nu mai e folosită în buclă)
|
||||||
function DelUnits2($vid, $unit) {
|
function DelUnits2($vid, $unit) {
|
||||||
$q = "UPDATE ".TB_PREFIX."units SET `u$unit` = '0' WHERE `vref` = ".(int) $vid;
|
$q = "UPDATE ". TB_PREFIX ."units SET `u". (int)$unit ."`='0' WHERE `vref`=". (int)$vid;
|
||||||
mysqli_query($this->connection, $q);
|
mysqli_query($this->connection, $q);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* ---------------- Ștergere jucător ---------------- */
|
||||||
function DelPlayer($uid, $pass) {
|
function DelPlayer($uid, $pass) {
|
||||||
global $database;
|
global $database;
|
||||||
$ID = (int) $_SESSION['id'];//$database->getUserField($_SESSION['username'],'id',1);
|
$ID = (int)$_SESSION['id'];
|
||||||
if ($this->CheckPass($pass, $ID)) {
|
if ($this->CheckPass($pass, $ID)) {
|
||||||
$villages = $database->getProfileVillages($uid);
|
$villages = $database->getProfileVillages($uid);
|
||||||
for ($i = 0; $i <= count($villages) - 1; $i++) {
|
for ($i = 0; $i <= count($villages) - 1; $i++) {
|
||||||
$this->DelVillage($villages[$i]['wref'], 1);
|
$this->DelVillage($villages[$i]['wref'], 1);
|
||||||
}
|
}
|
||||||
$q = "DELETE FROM ".TB_PREFIX."hero where uid = ".(int) $uid;
|
$q = "DELETE FROM ". TB_PREFIX. "hero WHERE uid = ". (int)$uid;
|
||||||
mysqli_query($this->connection, $q);
|
mysqli_query($this->connection, $q);
|
||||||
|
|
||||||
$name = $database->getUserField($uid, "username", 0);
|
$name = $database->getUserField($uid, "username", 0);
|
||||||
mysqli_query($this->connection,"Insert into ".TB_PREFIX."admin_log values (0,$ID,'Deleted user <a>$name</a>',".time().")");
|
mysqli_query($this->connection, "INSERT INTO ". TB_PREFIX. "admin_log VALUES (0,$ID,'Deleted user <a>$name</a>',". time(). ")");
|
||||||
|
|
||||||
$q = "DELETE FROM ". TB_PREFIX. "users WHERE `id` = ". (int)$uid;
|
$q = "DELETE FROM ". TB_PREFIX. "users WHERE `id` = ". (int)$uid;
|
||||||
mysqli_query($this->connection, $q);
|
mysqli_query($this->connection, $q);
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
function getUserActive() {
|
function getUserActive() {
|
||||||
$time = time() - (60 * 5);
|
$time = time() - (60 * 5);
|
||||||
$q = "SELECT * FROM ".TB_PREFIX."users where timestamp > $time and username != 'support' ORDER BY access DESC, username ASC";
|
$q = "SELECT * FROM ". TB_PREFIX. "users WHERE timestamp > $time AND username!= 'support' ORDER BY access DESC, username ASC";
|
||||||
$result = mysqli_query($this->connection, $q);
|
$result = mysqli_query($this->connection, $q);
|
||||||
return $this->mysqli_fetch_all($result);
|
return $this->mysqli_fetch_all($result);
|
||||||
}
|
}
|
||||||
|
|
||||||
function CheckPass($password, $uid) {
|
function CheckPass($password, $uid) {
|
||||||
$q = "SELECT id,password, is_bcrypt FROM ".TB_PREFIX."users where id = ".(int) $uid." and access = ".ADMIN;
|
$q = "SELECT id,password, is_bcrypt FROM ". TB_PREFIX. "users WHERE id = ". (int)$uid. " AND access = ". ADMIN;
|
||||||
$result = mysqli_query($this->connection, $q);
|
$result = mysqli_query($this->connection, $q);
|
||||||
|
|
||||||
// if we didn't update the database for bcrypt hashes yet...
|
|
||||||
if (mysqli_error($this->connection)!= '') {
|
if (mysqli_error($this->connection)!= '') {
|
||||||
// no need to select ID here, since the DB is not updated, so there will be no password conversion later
|
$q = "SELECT password, 0 as is_bcrypt FROM ". TB_PREFIX. "users WHERE id = ". (int)$uid. " AND access = ". ADMIN;
|
||||||
$q = "SELECT password, 0 as is_bcrypt FROM ".TB_PREFIX."users where id = ".(int) $uid." and access = ".ADMIN;
|
|
||||||
$result = mysqli_query($this->connection, $q);
|
$result = mysqli_query($this->connection, $q);
|
||||||
$bcrypt_update_done = false;
|
$bcrypt_update_done = false;
|
||||||
} else {
|
} else {
|
||||||
@@ -299,15 +317,10 @@ class adm_DB {
|
|||||||
$dbarray = mysqli_fetch_array($result);
|
$dbarray = mysqli_fetch_array($result);
|
||||||
|
|
||||||
if (!$dbarray) {
|
if (!$dbarray) {
|
||||||
mysqli_query($this->connection,"Insert into ".TB_PREFIX."admin_log values (0,'X','<font color=\'red\'><b>IP: ".$_SERVER['REMOTE_ADDR']." tried to log in with username <u> $username</u> but access was denied!</font></b>',".time().")");
|
mysqli_query($this->connection, "INSERT INTO ". TB_PREFIX. "admin_log VALUES (0,'X','<font color=\'red\'><b>IP: ". $_SERVER['REMOTE_ADDR']. " tried to log in with uid $uid but access was denied!</font></b>',". time(). ")");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// even if we didn't do a DB conversion for bcrypt passwords,
|
|
||||||
// we still need to check if this password wasn't encrypted via password_hash,
|
|
||||||
// since all methods were updated to use that instead of md5 and therefore
|
|
||||||
// new passwords in DB will be bcrypt already even without the is_bcrypt field present
|
|
||||||
$bcrypted = true;
|
$bcrypted = true;
|
||||||
$pwOk = password_verify($password, $dbarray['password']);
|
$pwOk = password_verify($password, $dbarray['password']);
|
||||||
|
|
||||||
@@ -317,9 +330,8 @@ class adm_DB {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($pwOk) {
|
if ($pwOk) {
|
||||||
// update password to bcrypt, if correct
|
|
||||||
if ($bcrypt_update_done &&!$dbarray['is_bcrypt']) {
|
if ($bcrypt_update_done &&!$dbarray['is_bcrypt']) {
|
||||||
mysqli_query($this->connection, "UPDATE " . TB_PREFIX . "users SET password = '".password_hash($password, PASSWORD_BCRYPT,['cost' => 12])."', is_bcrypt = 1 where id = ".(int) $dbarray['id']);
|
mysqli_query($this->connection, "UPDATE ". TB_PREFIX. "users SET password = '". password_hash($password, PASSWORD_BCRYPT, ['cost' => 12]). "', is_bcrypt = 1 WHERE id = ". (int)$dbarray['id']);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
@@ -327,63 +339,34 @@ class adm_DB {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* ---------------- Ștergere sat ---------------- */
|
||||||
function DelVillage($wref, $mode = 0) {
|
function DelVillage($wref, $mode = 0) {
|
||||||
global $database;
|
global $database;
|
||||||
$wref = (int)$wref;
|
$wref = (int)$wref;
|
||||||
if ($mode == 0) {
|
if ($mode == 0) {
|
||||||
$q = "SELECT Count(*) as Total FROM ".TB_PREFIX."vdata WHERE `wref` = $wref and capital = 0";
|
$q = "SELECT Count(*) as Total FROM ". TB_PREFIX. "vdata WHERE `wref` = $wref AND capital = 0";
|
||||||
} else {
|
} else {
|
||||||
$q = "SELECT Count(*) as Total FROM ". TB_PREFIX. "vdata WHERE `wref` = $wref";
|
$q = "SELECT Count(*) as Total FROM ". TB_PREFIX. "vdata WHERE `wref` = $wref";
|
||||||
}
|
}
|
||||||
|
|
||||||
$result = mysqli_fetch_array(mysqli_query($this->connection, $q), MYSQLI_ASSOC);
|
$result = mysqli_fetch_array(mysqli_query($this->connection, $q), MYSQLI_ASSOC);
|
||||||
if ($result['Total'] > 0) {
|
if ($result['Total'] > 0) {
|
||||||
mysqli_query($this->connection,"Insert into ".TB_PREFIX."admin_log values (0,".(int) $_SESSION['id'].",'Deleted village <b>$wref</b>',".time().")");
|
mysqli_query($this->connection, "INSERT INTO ". TB_PREFIX. "admin_log VALUES (0,". (int)$_SESSION['id']. ",'Deleted village <b>$wref</b>',". time(). ")");
|
||||||
|
|
||||||
$database->clearExpansionSlot($wref);
|
$database->clearExpansionSlot($wref);
|
||||||
|
|
||||||
$q = "DELETE FROM ".TB_PREFIX."abdata where vref = $wref";
|
$tables = ['abdata', 'bdata', 'market', 'odata', 'research', 'tdata', 'fdata', 'training', 'units', 'farmlist'];
|
||||||
mysqli_query($this->connection, $q);
|
foreach ($tables as $t) {
|
||||||
$q = "DELETE FROM ".TB_PREFIX."bdata where wid = $wref";
|
$field = ($t == 'bdata')? 'wid' : (($t == 'farmlist' || $t == 'market' || $t == 'research' || $t == 'tdata' || $t == 'fdata' || $t == 'training' || $t == 'abdata')? 'vref' : 'wref');
|
||||||
mysqli_query($this->connection, $q);
|
if ($t == 'odata') $field = 'wref';
|
||||||
$q = "DELETE FROM ".TB_PREFIX."market where vref = $wref";
|
mysqli_query($this->connection, "DELETE FROM ". TB_PREFIX. "$t WHERE $field = $wref");
|
||||||
mysqli_query($this->connection, $q);
|
}
|
||||||
$q = "DELETE FROM ".TB_PREFIX."odata where wref = $wref";
|
mysqli_query($this->connection, "DELETE FROM ". TB_PREFIX. "raidlist WHERE towref = $wref");
|
||||||
mysqli_query($this->connection, $q);
|
mysqli_query($this->connection, "DELETE FROM ". TB_PREFIX. "movement WHERE `from` = $wref AND proc=0");
|
||||||
$q = "DELETE FROM ".TB_PREFIX."research where vref = $wref";
|
mysqli_query($this->connection, "UPDATE ". TB_PREFIX. "wdata SET occupied = 0 WHERE id = $wref");
|
||||||
mysqli_query($this->connection, $q);
|
|
||||||
$q = "DELETE FROM ".TB_PREFIX."tdata where vref = $wref";
|
|
||||||
mysqli_query($this->connection, $q);
|
|
||||||
$q = "DELETE FROM ".TB_PREFIX."fdata where vref = $wref";
|
|
||||||
mysqli_query($this->connection, $q);
|
|
||||||
$q = "DELETE FROM ".TB_PREFIX."training where vref = $wref";
|
|
||||||
mysqli_query($this->connection, $q);
|
|
||||||
$q = "DELETE FROM ".TB_PREFIX."units where vref = $wref";
|
|
||||||
mysqli_query($this->connection, $q);
|
|
||||||
$q = "DELETE FROM ".TB_PREFIX."farmlist where wref = $wref";
|
|
||||||
mysqli_query($this->connection, $q);
|
|
||||||
$q = "DELETE FROM ".TB_PREFIX."raidlist where towref = $wref";
|
|
||||||
mysqli_query($this->connection, $q);
|
|
||||||
|
|
||||||
$q = "DELETE FROM ".TB_PREFIX."movement where `from` = $wref and proc=0";
|
|
||||||
mysqli_query($this->connection, $q);
|
|
||||||
|
|
||||||
$q = "UPDATE ".TB_PREFIX."wdata SET occupied = 0 where id = $wref";
|
|
||||||
mysqli_query($this->connection, $q);
|
|
||||||
|
|
||||||
// clear expansion slots, if this village is an expansion of any other village
|
|
||||||
$q = "
|
|
||||||
UPDATE
|
|
||||||
".TB_PREFIX."vdata
|
|
||||||
SET
|
|
||||||
exp1 = IF(exp1 = $wref, 0, exp1),
|
|
||||||
exp2 = IF(exp2 = $wref, 0, exp2),
|
|
||||||
exp3 = IF(exp3 = $wref, 0, exp3)
|
|
||||||
WHERE
|
|
||||||
exp1 = $wref OR
|
|
||||||
exp2 = $wref OR
|
|
||||||
exp3 = $wref";
|
|
||||||
|
|
||||||
|
// curăță sloturi expansiune
|
||||||
|
$q = "UPDATE ". TB_PREFIX. "vdata SET exp1 = IF(exp1 = $wref, 0, exp1), exp2 = IF(exp2 = $wref, 0, exp2), exp3 = IF(exp3 = $wref, 0, exp3) WHERE exp1 = $wref OR exp2 = $wref OR exp3 = $wref";
|
||||||
mysqli_query($this->connection, $q);
|
mysqli_query($this->connection, $q);
|
||||||
|
|
||||||
$getmovement = $database->getMovement(3, $wref, 1);
|
$getmovement = $database->getMovement(3, $wref, 1);
|
||||||
@@ -394,15 +377,12 @@ class adm_DB {
|
|||||||
$database->addMovement(4, $movedata['to'], $movedata['from'], $movedata['ref'], $time, $time + $time2);
|
$database->addMovement(4, $movedata['to'], $movedata['from'], $movedata['ref'], $time, $time + $time2);
|
||||||
}
|
}
|
||||||
|
|
||||||
//check return enforcement from del village
|
|
||||||
$this->returnTroops($wref);
|
$this->returnTroops($wref);
|
||||||
|
|
||||||
$q = "DELETE FROM ".TB_PREFIX."vdata WHERE `wref` = $wref";
|
mysqli_query($this->connection, "DELETE FROM ". TB_PREFIX. "vdata WHERE `wref` = $wref");
|
||||||
mysqli_query($this->connection, $q);
|
|
||||||
|
|
||||||
if (mysqli_affected_rows($this->connection) > 0) {
|
if (mysqli_affected_rows($this->connection) > 0) {
|
||||||
$q = "UPDATE ".TB_PREFIX."wdata set occupied = 0 where id = $wref";
|
mysqli_query($this->connection, "UPDATE ". TB_PREFIX. "wdata SET occupied = 0 WHERE id = $wref");
|
||||||
mysqli_query($this->connection, $q);
|
|
||||||
|
|
||||||
$getprisoners = $database->getPrisoners($wref);
|
$getprisoners = $database->getPrisoners($wref);
|
||||||
foreach ($getprisoners as $pris) {
|
foreach ($getprisoners as $pris) {
|
||||||
@@ -426,15 +406,14 @@ class adm_DB {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* ---------------- Ban / Unban ---------------- */
|
||||||
function DelBan($uid, $id) {
|
function DelBan($uid, $id) {
|
||||||
global $database;
|
global $database;
|
||||||
$name = addslashes($database->getUserField($uid, "username", 0));
|
$name = addslashes($database->getUserField($uid, "username", 0));
|
||||||
$uid = (int)$uid;
|
$uid = (int)$uid;
|
||||||
mysqli_query($this->connection,"Insert into ".TB_PREFIX."admin_log values (0,".(int) $_SESSION['id'].",'Unbanned user <a href=\'admin.php?p=player&uid=$uid\'>$name</a>',".time().")");
|
mysqli_query($this->connection, "INSERT INTO ". TB_PREFIX. "admin_log VALUES (0,". (int)$_SESSION['id']. ",'Unbanned user <a href=\'admin.php?p=player&uid=$uid\'>$name</a>',". time(). ")");
|
||||||
$q = "UPDATE ".TB_PREFIX."users SET `access` = '".USER."' WHERE `id` = $uid;";
|
mysqli_query($this->connection, "UPDATE ". TB_PREFIX. "users SET `access` = '". USER. "' WHERE `id` = $uid;");
|
||||||
mysqli_query($this->connection, $q);
|
mysqli_query($this->connection, "UPDATE ". TB_PREFIX. "banlist SET `active` = '0' WHERE `id` = ". (int)$id. ";");
|
||||||
$q = "UPDATE ".TB_PREFIX."banlist SET `active` = '0' WHERE `id` = $id;";
|
|
||||||
mysqli_query($this->connection, $q);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function AddBan($uid, $end, $reason) {
|
function AddBan($uid, $end, $reason) {
|
||||||
@@ -442,20 +421,20 @@ class adm_DB {
|
|||||||
$name = addslashes($database->getUserField($uid, "username", 0));
|
$name = addslashes($database->getUserField($uid, "username", 0));
|
||||||
list($end, $reason) = $database->escape_input($end, $reason);
|
list($end, $reason) = $database->escape_input($end, $reason);
|
||||||
$uid = (int)$uid;
|
$uid = (int)$uid;
|
||||||
mysqli_query($this->connection,"Insert into ".TB_PREFIX."admin_log values (0,".(int) $_SESSION['id'].",'Banned user <a href=\'admin.php?p=player&uid=$uid\'>$name</a>',".time().")");
|
mysqli_query($this->connection, "INSERT INTO ". TB_PREFIX. "admin_log VALUES (0,". (int)$_SESSION['id']. ",'Banned user <a href=\'admin.php?p=player&uid=$uid\'>$name</a>',". time(). ")");
|
||||||
$q = "UPDATE ".TB_PREFIX."users SET `access` = '0' WHERE `id` = $uid";
|
mysqli_query($this->connection, "UPDATE ". TB_PREFIX. "users SET `access` = '0' WHERE `id` = $uid");
|
||||||
mysqli_query($this->connection, $q);
|
|
||||||
$time = time();
|
$time = time();
|
||||||
$admin = (int) $_SESSION['id']; //$database->getUserField($_SESSION['username'],'id',1);
|
$admin = (int)$_SESSION['id'];
|
||||||
$name = addslashes($database->getUserField($uid, 'username', 0));
|
$name = addslashes($database->getUserField($uid, 'username', 0));
|
||||||
$q = "INSERT INTO ". TB_PREFIX. "banlist (`uid`, `name`, `reason`, `time`, `end`, `admin`, `active`) VALUES ($uid, '$name', '$reason', '$time', '$end', '$admin', '1');";
|
$q = "INSERT INTO ". TB_PREFIX. "banlist (`uid`, `name`, `reason`, `time`, `end`, `admin`, `active`) VALUES ($uid, '$name', '$reason', '$time', '$end', '$admin', '1');";
|
||||||
mysqli_query($this->connection, $q);
|
mysqli_query($this->connection, $q);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* ---------------- Căutări ---------------- */
|
||||||
function search_player($player) {
|
function search_player($player) {
|
||||||
global $database;
|
global $database;
|
||||||
$player = $database->escape($player);
|
$player = $database->escape($player);
|
||||||
$q = "SELECT id,username FROM ".TB_PREFIX."users WHERE `username` LIKE '%$player%' and username != 'support'";
|
$q = "SELECT id,username FROM ". TB_PREFIX. "users WHERE `username` LIKE '%$player%' AND username!= 'support'";
|
||||||
$result = mysqli_query($this->connection, $q);
|
$result = mysqli_query($this->connection, $q);
|
||||||
return $this->mysqli_fetch_all($result);
|
return $this->mysqli_fetch_all($result);
|
||||||
}
|
}
|
||||||
@@ -463,16 +442,15 @@ class adm_DB {
|
|||||||
function search_email($email) {
|
function search_email($email) {
|
||||||
global $database;
|
global $database;
|
||||||
$email = $database->escape($email);
|
$email = $database->escape($email);
|
||||||
$q = "SELECT id,email FROM ".TB_PREFIX."users WHERE `email` LIKE '%$email%' and username != 'support'";
|
$q = "SELECT id,email FROM ". TB_PREFIX. "users WHERE `email` LIKE '%$email%' AND username!= 'support'";
|
||||||
$result = mysqli_query($this->connection, $q);
|
$result = mysqli_query($this->connection, $q);
|
||||||
return $this->mysqli_fetch_all($result);
|
return $this->mysqli_fetch_all($result);
|
||||||
}
|
}
|
||||||
|
|
||||||
function search_village($village) {
|
function search_village($village) {
|
||||||
global $database;
|
global $database;
|
||||||
|
|
||||||
$village = $database->escape($village);
|
$village = $database->escape($village);
|
||||||
$q = "SELECT * FROM ".TB_PREFIX."vdata WHERE `name` LIKE '%$village%' or `wref` LIKE '%$village%'";
|
$q = "SELECT * FROM ". TB_PREFIX. "vdata WHERE `name` LIKE '%$village%' OR `wref` LIKE '%$village%'";
|
||||||
$result = mysqli_query($this->connection, $q);
|
$result = mysqli_query($this->connection, $q);
|
||||||
return $this->mysqli_fetch_all($result);
|
return $this->mysqli_fetch_all($result);
|
||||||
}
|
}
|
||||||
@@ -480,7 +458,7 @@ class adm_DB {
|
|||||||
function search_alliance($alliance) {
|
function search_alliance($alliance) {
|
||||||
global $database;
|
global $database;
|
||||||
$alliance = $database->escape($alliance);
|
$alliance = $database->escape($alliance);
|
||||||
$q = "SELECT * FROM ".TB_PREFIX."alidata WHERE `name` LIKE '%$alliance%' or `tag` LIKE '%$alliance%' or `id` LIKE '%$alliance%'";
|
$q = "SELECT * FROM ". TB_PREFIX. "alidata WHERE `name` LIKE '%$alliance%' OR `tag` LIKE '%$alliance%' OR `id` LIKE '%$alliance%'";
|
||||||
$result = mysqli_query($this->connection, $q);
|
$result = mysqli_query($this->connection, $q);
|
||||||
return $this->mysqli_fetch_all($result);
|
return $this->mysqli_fetch_all($result);
|
||||||
}
|
}
|
||||||
@@ -494,25 +472,24 @@ class adm_DB {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function search_banned() {
|
function search_banned() {
|
||||||
$q = "SELECT * FROM ".TB_PREFIX."banlist where active = '1'";
|
$q = "SELECT * FROM ". TB_PREFIX. "banlist WHERE active = '1'";
|
||||||
$result = mysqli_query($this->connection, $q);
|
$result = mysqli_query($this->connection, $q);
|
||||||
return $this->mysqli_fetch_all($result);
|
return $this->mysqli_fetch_all($result);
|
||||||
}
|
}
|
||||||
|
|
||||||
function Del_banned() {
|
function Del_banned() {
|
||||||
//$q = "SELECT * FROM ".TB_PREFIX."banlist";
|
$q = "SELECT * FROM ". TB_PREFIX. "banlist";
|
||||||
$result = mysqli_query($this->connection, $q);
|
$result = mysqli_query($this->connection, $q);
|
||||||
return $this->mysqli_fetch_all($result);
|
return $this->mysqli_fetch_all($result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***************************
|
/* ---------------- Helpers MySQLi ---------------- */
|
||||||
Function to process MYSQLi->fetch_all (Only exist in MYSQL)
|
|
||||||
References: Result
|
|
||||||
***************************/
|
|
||||||
function mysqli_fetch_all($result) {
|
function mysqli_fetch_all($result) {
|
||||||
$all = array();
|
$all = array();
|
||||||
if ($result) {
|
if ($result) {
|
||||||
while ($row = mysqli_fetch_assoc($result)){ $all[] = $row; }
|
while ($row = mysqli_fetch_assoc($result)) {
|
||||||
|
$all[] = $row;
|
||||||
|
}
|
||||||
return $all;
|
return $all;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -522,14 +499,12 @@ class adm_DB {
|
|||||||
return $this->mysqli_fetch_all($result);
|
return $this->mysqli_fetch_all($result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***************************
|
|
||||||
Function to do free query
|
|
||||||
References: Query
|
|
||||||
***************************/
|
|
||||||
function query($query) {
|
function query($query) {
|
||||||
return mysqli_query($query, $this->connection);
|
// corectat ordinea parametrilor
|
||||||
|
return mysqli_query($this->connection, $query);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* ---------------- Funcții joc ---------------- */
|
||||||
public function getTypeLevel($tid, $vid) {
|
public function getTypeLevel($tid, $vid) {
|
||||||
global $village, $database;
|
global $village, $database;
|
||||||
$keyholder = array();
|
$keyholder = array();
|
||||||
@@ -556,8 +531,7 @@ class adm_DB {
|
|||||||
if ($val == max($temparray))
|
if ($val == max($temparray))
|
||||||
$target = $key;
|
$target = $key;
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$target = 0;
|
$target = 0;
|
||||||
for ($i = 1; $i <= $element - 1; $i++) {
|
for ($i = 1; $i <= $element - 1; $i++) {
|
||||||
if ($resourcearray['f'. $keyholder[$i]] > $resourcearray['f'. $keyholder[$target]]) {
|
if ($resourcearray['f'. $keyholder[$i]] > $resourcearray['f'. $keyholder[$target]]) {
|
||||||
@@ -565,17 +539,14 @@ class adm_DB {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
} else if ($element == 1) {
|
||||||
else if($element == 1) {
|
|
||||||
$target = 0;
|
$target = 0;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if ($keyholder[$target]!= "") {
|
if ($keyholder[$target]!= "") {
|
||||||
return $resourcearray['f'. $keyholder[$target]];
|
return $resourcearray['f'. $keyholder[$target]];
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -603,21 +574,12 @@ class adm_DB {
|
|||||||
return round($distance * 3600 / INCREASE_SPEED);
|
return round($distance * 3600 / INCREASE_SPEED);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function returnTroops($wref) {
|
public function returnTroops($wref) {
|
||||||
global $database;
|
global $database;
|
||||||
|
|
||||||
$getenforce = $database->getEnforceVillage($wref, 0);
|
$getenforce = $database->getEnforceVillage($wref, 0);
|
||||||
|
|
||||||
//if(($enforce['from']==$village->wid) || ($enforce['vref']==$village->wid)){
|
|
||||||
foreach ($getenforce as $enforce) {
|
foreach ($getenforce as $enforce) {
|
||||||
|
|
||||||
$to = $database->getVillage($enforce['from']);
|
$to = $database->getVillage($enforce['from']);
|
||||||
$Gtribe = "";
|
|
||||||
if ($database->getUserField($to['owner'],'tribe',0) == '2'){ $Gtribe = "1"; }
|
|
||||||
else if ($database->getUserField($to['owner'],'tribe',0) == '3'){ $Gtribe = "2"; }
|
|
||||||
else if ($database->getUserField($to['owner'],'tribe',0) == '4'){ $Gtribe = "3"; }
|
|
||||||
else if ($database->getUserField($to['owner'],'tribe',0) == '5'){ $Gtribe = "4"; }
|
|
||||||
|
|
||||||
$start = ($database->getUserField($to['owner'], 'tribe', 0) - 1) * 10 + 1;
|
$start = ($database->getUserField($to['owner'], 'tribe', 0) - 1) * 10 + 1;
|
||||||
$end = ($database->getUserField($to['owner'], 'tribe', 0) * 10);
|
$end = ($database->getUserField($to['owner'], 'tribe', 0) * 10);
|
||||||
|
|
||||||
@@ -628,21 +590,13 @@ class adm_DB {
|
|||||||
$toCor = array('x' => $fromcoor['x'], 'y' => $fromcoor['y']);
|
$toCor = array('x' => $fromcoor['x'], 'y' => $fromcoor['y']);
|
||||||
|
|
||||||
$speeds = array();
|
$speeds = array();
|
||||||
|
|
||||||
//find slowest unit.
|
|
||||||
for ($i = $start; $i <= $end; $i++) {
|
for ($i = $start; $i <= $end; $i++) {
|
||||||
|
|
||||||
if (intval($enforce['u'. $i]) > 0) {
|
if (intval($enforce['u'. $i]) > 0) {
|
||||||
if($unitarray) { reset($unitarray); }
|
|
||||||
$unitarray = $GLOBALS["u". $i];
|
$unitarray = $GLOBALS["u". $i];
|
||||||
$speeds[] = $unitarray['speed'];
|
$speeds[] = $unitarray['speed'];
|
||||||
//echo print_r(array_keys($speeds))."unitspd\n".$i."trib\n";
|
|
||||||
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
$enforce['u'. $i] = '0';
|
$enforce['u'. $i] = '0';
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (intval($enforce['hero']) > 0) {
|
if (intval($enforce['hero']) > 0) {
|
||||||
@@ -664,10 +618,8 @@ class adm_DB {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function calculateProduction($wid, $uid, $b1, $b2, $b3, $b4, $fdata, $ocounter, $pop) {
|
public function calculateProduction($wid, $uid, $b1, $b2, $b3, $b4, $fdata, $ocounter, $pop) {
|
||||||
global $technology, $database;
|
global $technology, $database;
|
||||||
|
|
||||||
$isNatar = $database->getVillageField($wid, "natar");
|
$isNatar = $database->getVillageField($wid, "natar");
|
||||||
$upkeep = $technology->getUpkeep($this->getAllUnits($wid), 0, $wid);
|
$upkeep = $technology->getUpkeep($this->getAllUnits($wid), 0, $wid);
|
||||||
$production = [];
|
$production = [];
|
||||||
@@ -690,7 +642,9 @@ class adm_DB {
|
|||||||
$sawmill = $fdata['f'. $i];
|
$sawmill = $fdata['f'. $i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for($i=0;$i<=count($woodholder)-1;$i++) { $basewood+= $bid1[$fdata[$woodholder[$i]]]['prod']; }
|
for ($i = 0; $i <= count($woodholder) - 1; $i++) {
|
||||||
|
$basewood += $bid1[$fdata[$woodholder[$i]]]['prod'];
|
||||||
|
}
|
||||||
$wood = $basewood + $basewood * 0.25 * $ocounter[0];
|
$wood = $basewood + $basewood * 0.25 * $ocounter[0];
|
||||||
if ($sawmill >= 1) {
|
if ($sawmill >= 1) {
|
||||||
$wood += $basewood / 100 * $bid5[$sawmill]['attri'];
|
$wood += $basewood / 100 * $bid5[$sawmill]['attri'];
|
||||||
@@ -703,8 +657,8 @@ class adm_DB {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private function getClayProd($fdata, $ocounter, $b2) {
|
private function getClayProd($fdata, $ocounter, $b2) {
|
||||||
global $bid2,$bid6,$session;
|
global $bid2, $bid6;
|
||||||
$baseclay = $clay = $brick = 0;
|
$baseclay = $brick = 0;
|
||||||
$clayholder = array();
|
$clayholder = array();
|
||||||
for ($i = 1; $i <= 38; $i++) {
|
for ($i = 1; $i <= 38; $i++) {
|
||||||
if ($fdata['f'. $i. 't'] == 2) {
|
if ($fdata['f'. $i. 't'] == 2) {
|
||||||
@@ -714,7 +668,9 @@ class adm_DB {
|
|||||||
$brick = $fdata['f'. $i];
|
$brick = $fdata['f'. $i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for($i=0;$i<=count($clayholder)-1;$i++) { $baseclay+= $bid2[$fdata[$clayholder[$i]]]['prod']; }
|
for ($i = 0; $i <= count($clayholder) - 1; $i++) {
|
||||||
|
$baseclay += $bid2[$fdata[$clayholder[$i]]]['prod'];
|
||||||
|
}
|
||||||
$clay = $baseclay + $baseclay * 0.25 * $ocounter[1];
|
$clay = $baseclay + $baseclay * 0.25 * $ocounter[1];
|
||||||
if ($brick >= 1) {
|
if ($brick >= 1) {
|
||||||
$clay += $baseclay / 100 * $bid6[$brick]['attri'];
|
$clay += $baseclay / 100 * $bid6[$brick]['attri'];
|
||||||
@@ -738,7 +694,9 @@ class adm_DB {
|
|||||||
$foundry = $fdata['f'. $i];
|
$foundry = $fdata['f'. $i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for($i=0;$i<=count($ironholder)-1;$i++) { $baseiron+= $bid3[$fdata[$ironholder[$i]]]['prod']; }
|
for ($i = 0; $i <= count($ironholder) - 1; $i++) {
|
||||||
|
$baseiron += $bid3[$fdata[$ironholder[$i]]]['prod'];
|
||||||
|
}
|
||||||
$iron = $baseiron + $baseiron * 0.25 * $ocounter[2];
|
$iron = $baseiron + $baseiron * 0.25 * $ocounter[2];
|
||||||
if ($foundry >= 1) {
|
if ($foundry >= 1) {
|
||||||
$iron += $baseiron / 100 * $bid7[$foundry]['attri'];
|
$iron += $baseiron / 100 * $bid7[$foundry]['attri'];
|
||||||
@@ -765,7 +723,9 @@ class adm_DB {
|
|||||||
$bakery = $fdata['f'. $i];
|
$bakery = $fdata['f'. $i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for($i=0;$i<=count($cropholder)-1;$i++) { $basecrop+= $bid4[$fdata[$cropholder[$i]]]['prod']; }
|
for ($i = 0; $i <= count($cropholder) - 1; $i++) {
|
||||||
|
$basecrop += $bid4[$fdata[$cropholder[$i]]]['prod'];
|
||||||
|
}
|
||||||
$crop = $basecrop + $basecrop * 0.25 * $ocounter[3];
|
$crop = $basecrop + $basecrop * 0.25 * $ocounter[3];
|
||||||
$jcrop = 0;
|
$jcrop = 0;
|
||||||
if ($grainmill >= 1) $jcrop = (isset($bid8[$grainmill]['attri'])? $bid8[$grainmill]['attri'] : 0);
|
if ($grainmill >= 1) $jcrop = (isset($bid8[$grainmill]['attri'])? $bid8[$grainmill]['attri'] : 0);
|
||||||
@@ -802,7 +762,6 @@ class adm_DB {
|
|||||||
$ownunit['hero'] += $enforce['hero'];
|
$ownunit['hero'] += $enforce['hero'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//$enforcementarray = $database->getEnforceVillage($base,1);
|
|
||||||
$enforceoasis1 = $database->getOasisEnforce($base, 1);
|
$enforceoasis1 = $database->getOasisEnforce($base, 1);
|
||||||
if (count($enforceoasis1) > 0) {
|
if (count($enforceoasis1) > 0) {
|
||||||
foreach ($enforceoasis1 as $enforce) {
|
foreach ($enforceoasis1 as $enforce) {
|
||||||
@@ -813,7 +772,6 @@ class adm_DB {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$prisoners = $database->getPrisoners($base, 1);
|
$prisoners = $database->getPrisoners($base, 1);
|
||||||
if (!empty($prisoners)) {
|
if (!empty($prisoners)) {
|
||||||
foreach ($prisoners as $prisoner) {
|
foreach ($prisoners as $prisoner) {
|
||||||
|
|||||||
Reference in New Issue
Block a user