Edit some access for MH user and recreate mass messaage

Edit some access for MH user and recreate mass message and new maintenance system view for admins
This commit is contained in:
novgorodschi catalin
2026-06-02 10:59:35 +03:00
parent 2eaa92fc03
commit 547e164143
16 changed files with 595 additions and 344 deletions
+1 -1
View File
@@ -53,7 +53,7 @@ $user = $database->getUserArray($id,1);
<div>to <a href="admin.php?p=player&uid=<?php echo $user['id']; ?>"><?php echo $user['username']; ?></a></div>
</div>
<form method="post" action="../Admin/Mods/sendMessage.php" name="msg">
<form method="post" action="../GameEngine/Admin/Mods/sendMessage.php" name="msg">
<div class="msg-body">
<input type="hidden" name="uid" value="<?php echo $id; ?>">
+3 -1
View File
@@ -18,7 +18,9 @@
## --------------------------------------------------------------------------- ##
#################################################################################
$unarray = array(1=>U1,U2,U3,U4,U5,U6,U7,U8,U9,U10,U11,U12,U13,U14,U15,U16,U17,U18,U19,U20,U21,U22,U23,U24,U25,U26,U27,U28,U29,U30,U31,U32,U33,U34,U35,U36,U37,U38,U39,U40,U41,U42,U43,U44,U45,U46,U47,U48,U49,U50,U99,U0);
if($_SESSION['access'] < 9) die(ACCESS_DENIED_ADMIN);
if (empty($_SESSION['access']) || $_SESSION['access'] < 9) {
die(defined('ACCESS_DENIED_ADMIN') ? ACCESS_DENIED_ADMIN : 'Access Denied: You are not Admin!');
}
$id = $_GET['did'];
if(isset($id)){
$abtech = $database->getABTech($id);
+3 -1
View File
@@ -18,7 +18,9 @@
## --------------------------------------------------------------------------- ##
#################################################################################
$unarray = [1=>U1,U2,U3,U4,U5,U6,U7,U8,U9,U10,U11,U12,U13,U14,U15,U16,U17,U18,U19,U20,U21,U22,U23,U24,U25,U26,U27,U28,U29,U30,U31,U32,U33,U34,U35,U36,U37,U38,U39,U40,U41,U42,U43,U44,U45,U46,U47,U48,U49,U50,U99,U0];
if($_SESSION['access'] < 9) die(ACCESS_DENIED_ADMIN);
if (empty($_SESSION['access']) || $_SESSION['access'] < 9) {
die(defined('ACCESS_DENIED_ADMIN') ? ACCESS_DENIED_ADMIN : 'Access Denied: You are not Admin!');
}
$id = $_GET['did'];
if(isset($id)){
$units = $database->getUnit($village['wref']);
+1 -1
View File
@@ -17,7 +17,7 @@
## Copyright : TravianZ (c) 2010-2025. All rights reserved. ##
## --------------------------------------------------------------------------- ##
#################################################################################
if($_SESSION['access'] < ADMIN) die("Access Denied!");
if($_SESSION['access'] < MULTIHUNTER) die("Access Denied!");
$error = '';
$success = '';
+112
View File
@@ -0,0 +1,112 @@
<?php
#################################################################################
## -= YOU MAY NOT REMOVE OR CHANGE THIS NOTICE =- ##
## --------------------------------------------------------------------------- ##
## Filename : massmessage.tpl ##
## Type : Admin Panel Frontend ##
## --------------------------------------------------------------------------- ##
## Developed by : Dzoki (Original) ##
## Refactored by : Shadow ##
## Redesign by : Shadow ##
## --------------------------------------------------------------------------- ##
## Project : TravianZ ##
## GitHub : https://github.com/Shadowss/TravianZ ##
#################################################################################
if($_SESSION['access'] < ADMIN) die("Access Denied: You are not Admin!");
$id = $_SESSION['id'];
$_SESSION['mass_subject'] = $_SESSION['mass_subject'] ?? '';
$_SESSION['mass_color'] = $_SESSION['mass_color'] ?? 'black';
?>
<style>
.massmsg-wrap{max-width:700px;margin:30px auto;font-family:Verdana}
.massmsg-head{display:flex;align-items:center;gap:8px;margin-bottom:16px}
.massmsg-head svg{width:26px;height:26px}
.massmsg-head h2{margin:0;font-size:18px}
.massmsg-card{background:#fff;border:1px solid #ddd;border-radius:10px;padding:20px;box-shadow:0 2px 6px rgba(0,0,0,.06)}
.massmsg-card .top{display:flex;align-items:center;gap:12px;margin-bottom:16px}
.massmsg-card .icon{background:linear-gradient(135deg,#e67e22,#d35400);width:44px;height:44px;border-radius:50%;display:flex;align-items:center;justify-content:center;flex-shrink:0}
.massmsg-card .icon svg{width:24px;height:24px;fill:#fff}
.massmsg-card h3{margin:0;font-size:15px}
.massmsg-card p{margin:2px 0 0;color:#666;font-size:12px}
.massmsg-form{display:grid;grid-template-columns:1fr 1fr;gap:12px;margin-top:14px}
.massmsg-form .field{display:flex;flex-direction:column;gap:4px}
.massmsg-form label{font-size:11px;color:#555;font-weight:bold}
.massmsg-form input,.massmsg-form textarea{padding:9px 10px;border:1px solid #ccc;border-radius:6px;font-size:13px;font-family:Verdana}
.massmsg-form input:focus,.massmsg-form textarea:focus{outline:none;border-color:#e67e22;box-shadow:0 0 0 2px rgba(230,126,34,.2)}
.massmsg-form .full{grid-column:1/-1}
.massmsg-form button{grid-column:1/-1;background:#e67e22;color:#fff;border:0;padding:10px;border-radius:6px;font-weight:bold;cursor:pointer;font-size:14px;display:flex;align-items:center;justify-content:center;gap:6px}
.massmsg-form button:hover{background:#d35400}
.massmsg-success{margin-top:16px;padding:10px;background:#fef5e7;border:1px solid #e67e22;color:#a04000;border-radius:6px;text-align:center;font-weight:bold}
.massmsg-confirm{background:#fff3cd;border:1px solid #ffeaa7;padding:15px;border-radius:8px;margin-bottom:15px}
</style>
<div class="massmsg-wrap">
<div class="massmsg-head">
<svg viewBox="0 0 24 24" fill="none"><path d="M20 4H4c-1.1 0-2.9-2 2v12c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm0 4l-8 5-8-5V6l8 5 8-5v2z" fill="#e67e22"/></svg>
<h2>Mass Message</h2>
</div>
<div class="massmsg-card">
<div class="top">
<div class="icon">
<svg viewBox="0 0 24 24"><path d="M20 4H4c-1.1 0-2.9-2 2v12c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm0 4l-8 5-8-5V6l8 5 8-5v2z"/></svg>
</div>
<div>
<h3>Send Message to All Players</h3>
<p>Mesaj in-game pentru toti userii (ID > 5)</p>
</div>
</div>
<?php if(isset($_GET['confirm'])):?>
<div class="massmsg-confirm">
<b>Confirmare:</b> Esti sigur ca vrei sa trimiti?<br>
<b>Subject:</b> <span style="color:<?=$_SESSION['mass_color']?>"><?=htmlspecialchars($_SESSION['mass_subject'])?></span>
</div>
<form action="../GameEngine/Admin/Mods/massmessage.php" method="POST" class="massmsg-form">
<input type="hidden" name="admid" value="<?=$id?>">
<input type="hidden" name="action" value="execute">
<button type="submit" name="confirm" value="Yes" style="background:#27ae60">✓ Yes, Trimite</button>
<button type="submit" name="confirm" value="No" style="background:#95a5a6;margin-top:8px">Anuleaza</button>
</form>
<?php elseif(isset($_GET['sending'])):?>
<div style="text-align:center;padding:30px">
<div style="font-size:16px;margin-bottom:10px">Se trimit mesajele...</div>
<div style="color:#666"><?=$_GET['msg']?? ''?></div>
</div>
<?php else:?>
<form action="../GameEngine/Admin/Mods/massmessage.php" method="POST" class="massmsg-form">
<input type="hidden" name="admid" value="<?=$id?>">
<input type="hidden" name="action" value="prepare">
<div class="field">
<label>Subject</label>
<input type="text" name="subject" placeholder="ex: Mentenanta" required maxlength="100">
</div>
<div class="field">
<label>Message Color</label>
<input type="text" name="color" value="black" placeholder="black sau #e67e22">
</div>
<div class="field full">
<label>Message Content</label>
<textarea name="message" rows="12" placeholder="Scrie mesajul... poti folosi [url] [img]" required></textarea>
</div>
<button type="submit">
<svg width="16" height="16" viewBox="0 0 24 24" fill="none"><path d="M2 21l21-9L2 3v7l15 2-15 2v7z" fill="#fff"/></svg>
Continua
</button>
</form>
<?php endif;?>
</div>
<?php if(isset($_GET['done'])){?>
<div class="massmsg-success"> Mass message trimis cu succes la toti jucatorii!</div>
<?php }?>
</div>
+11 -6
View File
@@ -28,15 +28,20 @@
</style>
<table id="member">
<thead>
<tr>
<th colspan="2">Additional Information
<thead>
<tr>
<th colspan="2">
Additional Information
<?php if($_SESSION['access'] == ADMIN) { ?>
<a href='admin.php?p=editAdditional&uid=<?php echo $id; ?>' class="edit-icon" title="Edit Player Additional Info">
<svg viewBox="0 0 24 24"><path d="M12 20h9"/><path d="M16.5 3.5a2.1 2.1 0 0 1 3 3L7 19l-4 1 1-4 12.5-12.5z"/></svg>
</a>
</th>
</tr>
</thead>
<?php } ?>
</th>
</tr>
</thead>
<tbody>
<tr>
<td>Access</td>
+18 -18
View File
@@ -94,13 +94,13 @@
<tr>
<th>Population</th>
<td><?php echo number_format($totalpop,0,',','.'); ?>
<a href="?action=recountPopUsr&uid=<?php echo $user['id'];?>" title="Recount population" style="margin-left:6px;vertical-align:middle;display:inline-flex">
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="#64748b" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<path d="M21 12a9 9 0 1 1-3-6.7"/>
<path d="M21 3v6h-6"/>
</svg>
</a>
</td>
<a href="?action=recountPopUsr&uid=<?php echo $user['id'];?>" title="Recount population" style="margin-left:6px;vertical-align:middle;display:inline-flex">
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="#64748b" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<path d="M21 12a9 9 0 1 1-3-6.7"/>
<path d="M21 3v6h-6"/>
</svg>
</a>
</td>
</tr>
<tr>
<th>Age</th>
@@ -207,17 +207,17 @@
?>
<tr><td colspan="2"><a href="?p=ban&uid=<?php echo $user['id'];?>">&raquo; Ban User</a></td></tr>
<tr><td colspan="2"><a href="?p=Newmessage&uid=<?php echo $user['id'];?>">&raquo; Send Message</a></td></tr>
<tr><td colspan="2"><a href="?p=editPlus&uid=<?php echo $user['id'];?>">&raquo; Edit Plus & Res Bonus</a></td></tr>
<tr><td colspan="2"><a href="?p=editSitter&uid=<?php echo $user['id'];?>">&raquo; Edit Sitters</a></td></tr>
<!-- BUTON NOU ADAUGAT -->
<tr><td colspan="2"><a href="?p=editProtection&uid=<?php echo $user['id'];?>">&raquo; Edit Protection</a></td></tr>
<tr><td colspan="2"><a href="?p=editPassword&uid=<?php echo $user['id'];?>">&raquo; Edit Password</a></td></tr>
<tr><td colspan="2"><a href="?p=editOverall&uid=<?php echo $user['id'];?>">&raquo; Edit Overall Off & Def</a></td></tr>
<tr><td colspan="2"><a href="?p=editWeek&uid=<?php echo $user['id'];?>">&raquo; Edit Weekly Off, Def, Raid</a></td></tr>
<tr><td colspan="2"><a href="?p=userlogin&uid=<?php echo $user['id'];?>">&raquo; User Login Log</a></td></tr>
<tr><td colspan="2"><a href="?p=userillegallog&uid=<?php echo $user['id'];?>">&raquo; User Illegal Log</a></td></tr>
<tr><td colspan="2"><a href="?p=Newmessage&uid=<?php echo $user['id'];?>">&raquo; Send Message</a></td></tr>
<?php if($_SESSION['access'] == ADMIN) { ?>
<tr><td colspan="2"><a href="?p=editPlus&uid=<?php echo $user['id'];?>">&raquo; Edit Plus & Res Bonus</a></td></tr>
<tr><td colspan="2"><a href="?p=editSitter&uid=<?php echo $user['id'];?>">&raquo; Edit Sitters</a></td></tr>
<tr><td colspan="2"><a href="?p=editProtection&uid=<?php echo $user['id'];?>">&raquo; Edit Protection</a></td></tr>
<tr><td colspan="2"><a href="?p=editPassword&uid=<?php echo $user['id'];?>">&raquo; Edit Password</a></td></tr>
<tr><td colspan="2"><a href="?p=editOverall&uid=<?php echo $user['id'];?>">&raquo; Edit Overall Off & Def</a></td></tr>
<tr><td colspan="2"><a href="?p=editWeek&uid=<?php echo $user['id'];?>">&raquo; Edit Weekly Off, Def, Raid</a></td></tr>
<?php } ?>
<tr><td colspan="2"><a href="?p=userlogin&uid=<?php echo $user['id'];?>">&raquo; User Login Log</a></td></tr>
<tr><td colspan="2"><a href="?p=userillegallog&uid=<?php echo $user['id'];?>">&raquo; User Illegal Log</a></td></tr>
<tr>
<td colspan="2" class="desc2">
<div class="desc2div">
+117
View File
@@ -0,0 +1,117 @@
<?php
if ($_SESSION['access'] < ADMIN) die("Access Denied");
$id = $_SESSION['id'];
$_SESSION['sys_subject'] = $_SESSION['sys_subject'] ?? '';
$_SESSION['sys_message'] = $_SESSION['sys_message'] ?? '';
$_SESSION['sys_color'] = $_SESSION['sys_color'] ?? 'black';
?>
<style>
.sysmsg-wrap{max-width:700px;margin:30px auto;font-family:Verdana}
.sysmsg-head{display:flex;align-items:center;gap:8px;margin-bottom:16px}
.sysmsg-head svg{width:26px;height:26px}
.sysmsg-head h2{margin:0;font-size:18px}
.sysmsg-card{background:#fff;border:1px solid #ddd;border-radius:10px;padding:20px;box-shadow:0 2px 6px rgba(0,0,0,.06)}
.sysmsg-card .top{display:flex;align-items:center;gap:12px;margin-bottom:16px}
.sysmsg-card .icon{background:linear-gradient(135deg,#8e44ad,#6c3483);width:44px;height:44px;border-radius:50%;display:flex;align-items:center;justify-content:center}
.sysmsg-card .icon svg{width:24px;height:24px;fill:#fff}
.sysmsg-form{display:grid;grid-template-columns:1fr 1fr;gap:12px;margin-top:14px}
.sysmsg-form .field{display:flex;flex-direction:column;gap:4px}
.sysmsg-form label{font-size:11px;color:#555;font-weight:bold}
.sysmsg-form input,.sysmsg-form textarea{
padding:9px 10px;border:1px solid #ccc;border-radius:6px;font-size:13px;font-family:Verdana
}
.sysmsg-form input:focus,.sysmsg-form textarea:focus{
outline:none;border-color:#8e44ad;box-shadow:0 0 0 2px rgba(142,68,173,.2)
}
.sysmsg-form .full{grid-column:1/-1}
.sysmsg-form button{
grid-column:1/-1;background:#8e44ad;color:#fff;border:0;padding:10px;
border-radius:6px;font-weight:bold;cursor:pointer;font-size:14px;
display:flex;align-items:center;justify-content:center;gap:6px
}
.sysmsg-form button:hover{background:#6c3483}
.sysmsg-confirm{
background:#fff3cd;border:1px solid #ffeaa7;padding:15px;border-radius:8px;margin-bottom:15px
}
.sysmsg-success{
margin-top:16px;padding:10px;background:#e8f5e9;border:1px solid #2ecc71;
color:#1e7e34;border-radius:6px;text-align:center;font-weight:bold
}
</style>
<div class="sysmsg-wrap">
<div class="sysmsg-head">
<svg viewBox="0 0 24 24"><path d="M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z" fill="#8e44ad"/></svg>
<h2>System Message</h2>
</div>
<div class="sysmsg-card">
<?php if(isset($_GET['confirm'])): ?>
<div class="sysmsg-confirm">
<b>Confirmare system message</b><br><br>
<b>Color:</b> <span style="color:<?=htmlspecialchars($_SESSION['sys_color'])?>">
<?=htmlspecialchars($_SESSION['sys_subject'])?>
</span>
<br><br>
<div><?=nl2br(htmlspecialchars($_SESSION['sys_message']))?></div>
</div>
<form action="../GameEngine/Admin/Mods/sysmessage.php" method="POST" class="sysmsg-form">
<input type="hidden" name="admid" value="<?=$id?>">
<input type="hidden" name="action" value="execute">
<button type="submit" name="confirm" value="Yes" style="background:#27ae60">✓ Send System Message</button>
<button type="submit" name="confirm" value="No" style="background:#95a5a6;margin-top:8px">Cancel</button>
</form>
<?php elseif(isset($_GET['sending'])): ?>
<div style="text-align:center;padding:30px">
<div style="font-size:16px;margin-bottom:10px">Sending system message...</div>
</div>
<?php else: ?>
<form action="../GameEngine/Admin/Mods/sysmessage.php" method="POST" class="sysmsg-form">
<input type="hidden" name="admid" value="<?=$id?>">
<input type="hidden" name="action" value="prepare">
<div class="field">
<label>Subject</label>
<input type="text" name="subject" required maxlength="100">
</div>
<div class="field">
<label>Color</label>
<input type="text" name="color" value="black">
</div>
<div class="field full">
<label>Message</label>
<textarea name="message" rows="12" required></textarea>
</div>
<button type="submit">Continue</button>
</form>
<?php endif; ?>
<?php if(isset($_GET['done'])): ?>
<div class="sysmsg-success">✓ System message sent successfully</div>
<?php endif; ?>
</div>
</div>
+2
View File
@@ -55,9 +55,11 @@ $img = $tribe==1 ? "" : $tribe-1;
}
?>
</div>
<?php if($_SESSION['access']==ADMIN){ ?>
<div class="upg-foot">
<?php if($tribe==5){ echo '<span style="color:#94a3b8">Upgrades Troops</span>'; } else { echo '<a href="admin.php?p=addABTroops&did='.$_GET['did'].'">Upgrades Troops</a>'; } ?>
<a href="admin.php?p=techlog&did=<?=$_GET['did']?>" style="color:#64748b">Research Log</a>
</div>
<?php if(isset($_GET['ab'])) echo '<div style="text-align:right;padding:0 8px 6px;color:#dc2626;font-weight:600;font-size:12px">AB Tech updated</div>'; ?>
<?php } ?>
</div>
+9 -4
View File
@@ -122,7 +122,9 @@ if(isset($id)){
<input type="hidden" name="did" value="<?php echo $_GET['did']; ?>">
<input type="hidden" name="admid" value="<?php echo $_SESSION['id']; ?>">
<input class="input-mini" type="text" name="newowner" value="<?php echo $user['id']; ?>" style="width:65px">
<button class="btn-icon" title="Change"><?php echo $svgEdit; ?></button>
<?php if($_SESSION['access'] == ADMIN) { ?>
<button class="btn-icon" title="Change"><?php echo $svgEdit; ?></button>
<?php } ?>
</form>
</td>
</tr>
@@ -131,7 +133,9 @@ if(isset($id)){
<input type="hidden" name="did" value="<?php echo $_GET['did']; ?>">
<input type="hidden" name="admid" value="<?php echo $_SESSION['id']; ?>">
<input class="input-mini" type="text" name="villagename" value="<?php echo $village['name']; ?>" style="flex:1">
<button class="btn-icon" title="Rename"><?php echo $svgEdit; ?></button>
<?php if($_SESSION['access'] == ADMIN) { ?>
<button class="btn-icon" title="Rename"><?php echo $svgEdit; ?></button>
<?php } ?>
</form>
</td></tr>
<tr><td class="label">Population</td><td colspan="2"><?php echo $village['pop'];?> <a href="admin.php?action=recountPop&did=<?php echo $_GET['did']; ?>" class="btn-icon" style="margin-left:4px"><?php echo $svgRefresh; ?></a></td></tr>
@@ -142,7 +146,8 @@ if(isset($id)){
</div>
<!-- 2. RESOURCES - FULL WIDTH -->
<div class="vcard">
<div class="vhead">Resources <a href="admin.php?p=editResources&did=<?php echo $_GET['did']; ?>"><?php echo $svgEdit; ?></a></div>
<div class="vhead">Resources<?php if($_SESSION['access'] == ADMIN) { ?><a href="admin.php?p=editResources&did=<?php echo $_GET['did']; ?>"><?php echo $svgEdit; ?></a><?php } ?>
</div>
<table class="vtable" style="text-align:center">
<tr style="background:#f8fafc;font-size:11px;color:#64748b"><td style="text-align:left">Res</td><td>Amt</td><td>Cap</td><td>Prod</td></tr>
<tr><td style="text-align:left"><img src="../img/admin/r/1.gif"> Wood</td><td><?php echo floor($village['wood']); ?></td><td rowspan="3"><?php echo $village['maxstore'];?></td><td><?php echo $production['wood'];?></td></tr>
@@ -215,7 +220,7 @@ if(isset($id)){
<div class="vhead">Buildings</div>
<table class="vtable" style="text-align:center">
<tr style="background:#f8fafc;font-size:11px;color:#64748b"><td>ID</td><td>GID</td><td style="text-align:left">Name</td><td>Lvl</td><td>Edit</td></tr>
<?php for ($i = 1; $i <= 41; $i++){ if($i == 41) $i = 99; if($fdata['f'.$i.'t'] == 0) $bu = "-"; else $bu = $funct->procResType($fdata['f'.$i.'t']); echo '<tr><td>'.$i.'</td><td>'.$fdata['f'.$i.'t'].'</td><td style="text-align:left">'.$bu.'</td><td>'.$fdata['f'.$i].'</td><td><a href="admin.php?p=editVillage&did='.$_GET['did'].'" class="btn-icon">'.$svgEdit.'</a></td></tr>'; } ?>
<?php for ($i = 1; $i <= 41; $i++){ if($i == 41) $i = 99; if($fdata['f'.$i.'t'] == 0) $bu = "-"; else $bu = $funct->procResType($fdata['f'.$i.'t']); echo '<tr><td>'.$i.'</td><td>'.$fdata['f'.$i.'t'].'</td><td style="text-align:left">'.$bu.'</td><td>'.$fdata['f'.$i].'</td><td>'.($_SESSION['access'] == ADMIN ? '<a href="admin.php?p=editVillage&did='.$_GET['did'].'" class="btn-icon">'.$svgEdit.'</a>': '').'</td></tr>'; } ?>
</table>
</div>
+11 -3
View File
@@ -53,6 +53,14 @@ if (!empty($_GET['p'])) {
case 'message':
$subpage = 'Players Message';
break;
case 'massmessage':
$subpage = 'Mass Message';
break;
case 'sysmessage':
$subpage = 'System Message';
break;
case 'map':
$subpage = 'Map';
@@ -578,8 +586,8 @@ Logged: <b><?=$adminName?></b> <span style="color:#999;font-size:11px">(<?=$rank
<li class="sub"><a href="#">Messages</a>
<ul>
<li><a href="<?php echo rtrim(SERVER, '/'); ?>/nachrichten.php">Read In-Game Messages</a></li>
<li><a href="<?php echo rtrim(SERVER, '/'); ?>/massmessage.php">Create Mass Message</a></li>
<li><a href="<?php echo rtrim(SERVER, '/'); ?>/sysmsg.php">Create System Message</a></li>
<li><a href="admin.php?p=massmessage">Create Mass Message</a></li>
<li><a href="admin.php?p=sysmessage">Create System Message</a></li>
</ul>
</li>
<li class="sub"><a href="#">Ban</a>
@@ -613,7 +621,7 @@ Logged: <b><?=$adminName?></b> <span style="color:#999;font-size:11px">(<?=$rank
<ul>
<li><a href="?p=admin_log"><font color="Red"><b>Admin Log</b></font></a></li>
<li><a href="?p=config">Server Settings</a></li>
<li><a href="?p=maintenance">Server Maintenance</a></li>
<li><a href="?p=maintenance">Server Maintenance</a></li>
<li><a href="?p=resetServer">Server Resetting</a></li>
</ul>
</li>
+183
View File
@@ -0,0 +1,183 @@
<?php
#################################################################################
## -= YOU MAY NOT REMOVE OR CHANGE THIS NOTICE =- ##
## --------------------------------------------------------------------------- ##
## Filename massmessage.php ##
## Type BACKEND ##
## Developed by: Shadow ##
## License: TravianZ Project ##
## Copyright: TravianZ (c) 2010-2025. All rights reserved. ##
## ##
#################################################################################
session_start();
include_once("../../config.php");
include_once("../../Database.php");
if (!isset($_SESSION['access']) || $_SESSION['access'] < ADMIN) {
die("Access Denied");
}
/*
|--------------------------------------------------------------------------
| PREPARE
|--------------------------------------------------------------------------
*/
if (
isset($_POST['action']) &&
$_POST['action'] == 'prepare'
) {
if (empty($_POST['subject'])) {
die("Subject required");
}
if (empty($_POST['message'])) {
die("Message required");
}
$_SESSION['mass_subject'] = trim($_POST['subject']);
$_SESSION['mass_message'] = trim($_POST['message']);
$_SESSION['mass_color'] = trim($_POST['color']);
header("Location: ../../../Admin/admin.php?p=massmessage&confirm=1");
exit;
}
/*
|--------------------------------------------------------------------------
| EXECUTE
|--------------------------------------------------------------------------
*/
if (
isset($_POST['action']) &&
$_POST['action'] == 'execute'
) {
if (
empty($_SESSION['mass_subject']) ||
empty($_SESSION['mass_message'])
) {
header("Location: ../../../Admin/admin.php?p=massmessage");
exit;
}
$subject = $database->escape($_SESSION['mass_subject']);
$message = $_SESSION['mass_message'];
$color = $database->escape(
$_SESSION['mass_color'] ?: 'black'
);
/*
|--------------------------------------------------------------------------
| BBCode
|--------------------------------------------------------------------------
*/
$message = preg_replace(
"/\[img\](.*?)\[\/img\]/i",
"<img src='$1' alt='' />",
$message
);
$message = preg_replace(
"/\[url\](.*?)\[\/url\]/i",
"<a href='$1'>$1</a>",
$message
);
$message = preg_replace(
"/\[url=(.*?)\](.*?)\[\/url\]/i",
"<a href='$1'>$2</a>",
$message
);
$message = "[message]".$message."[/message]";
$message = $database->escape($message);
/*
|--------------------------------------------------------------------------
| ALL PLAYERS
|--------------------------------------------------------------------------
*/
$result = mysqli_query(
$database->dblink,
"SELECT id
FROM ".TB_PREFIX."users
WHERE id > 5
ORDER BY id ASC"
);
$rows = [];
$time = time();
while ($user = mysqli_fetch_assoc($result)) {
$uid = (int)$user['id'];
$rows[] =
"(".
$uid.",".
"1,".
"'<span style=\"color:".$color.";\">".$subject."</span>',".
"'".$message."',".
"0,".
"0,".
"0,".
$time.",".
"0,".
"0,".
"0,".
"0,".
"0,".
"0".
")";
}
if (!empty($rows)) {
$sql =
"INSERT INTO ".TB_PREFIX."mdata
(
target,
owner,
topic,
message,
viewed,
archived,
send,
time,
deltarget,
delowner,
alliance,
player,
coor,
report
)
VALUES
".implode(",", $rows);
mysqli_query(
$database->dblink,
$sql
);
}
unset(
$_SESSION['mass_subject'],
$_SESSION['mass_message'],
$_SESSION['mass_color']
);
header("Location: ../../../Admin/admin.php?p=massmessage&done=1");
exit;
}
header("Location: ../../../Admin/admin.php?p=massmessage");
exit;
?>
+67 -24
View File
@@ -13,6 +13,7 @@
if (!isset($_SESSION)) {
session_start();
}
if (empty($_SESSION['access']) || $_SESSION['access'] < 9) {
die("Access Denied: You are not Admin!");
}
@@ -33,51 +34,93 @@ for ($i = 0; $i < 5; $i++) {
include_once($autoprefix . "GameEngine/Database.php");
// ---------------------------------------------------------------------------
// Input
// INPUT
// ---------------------------------------------------------------------------
$session = (int)($_POST['admid'] ?? 0);
$adminId = (int)($_SESSION['id'] ?? 0);
$uid = (int)($_POST['uid'] ?? 0);
$topic = trim($_POST['topic'] ?? 'Admin Message');
$message = trim($_POST['message'] ?? '');
// ---------------------------------------------------------------------------
// VALIDARE
// ---------------------------------------------------------------------------
if ($adminId <= 0) {
die("Invalid admin session.");
}
if ($uid <= 0 || $message === '') {
header("Location: ../../../Admin/admin.php?p=Newmessage&uid=$uid&e=1");
exit;
}
// ---------------------------------------------------------------------------
// Verificare admin
// SANITIZARE
// ---------------------------------------------------------------------------
$admin = $database->getUserArray($session, 1);
if (!$admin || (int)$admin['access'] !== 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);
$database->query(
"INSERT INTO " . TB_PREFIX . "mdata
(target, owner, topic, message, viewed, time, archive)
VALUES ($uid, 1, '$topicEsc', '$msgEsc', 0, $time, 0)"
);
$time = time();
// ---------------------------------------------------------------------------
// Log admin
// INSERT MESAJ (FULL FIX)
// ---------------------------------------------------------------------------
$sql = "
INSERT INTO " . TB_PREFIX . "mdata
(
target,
owner,
topic,
message,
viewed,
archived,
send,
time,
deltarget,
delowner,
alliance,
player,
coor,
report
)
VALUES
(
$uid,
$adminId,
'$topicEsc',
'$msgEsc',
0,
0,
0,
$time,
0,
0,
0,
0,
0,
0
)
";
$result = $database->query($sql);
if (!$result) {
die("Message insert failed: " . $database->getError());
}
// ---------------------------------------------------------------------------
// LOG ADMIN ACTION
// ---------------------------------------------------------------------------
$adminId = (int)$_SESSION['id'];
$logText = "Sent message to uid $uid: '$topicEsc'";
$logEsc = $database->escape($logText);
$logEsc = $database->escape($logText);
$database->query(
"INSERT INTO " . TB_PREFIX . "admin_log (`id`, `user`, `log`, `time`) " .
"VALUES (0, '$adminId', '$logEsc', $time)"
);
$database->query("
INSERT INTO " . TB_PREFIX . "admin_log (`id`, `user`, `log`, `time`)
VALUES (0, $adminId, '$logEsc', $time)
");
// ---------------------------------------------------------------------------
// REDIRECT SUCCESS
// ---------------------------------------------------------------------------
header("Location: ../../../Admin/admin.php?p=Newmessage&uid=" . $uid . "&msg=ok");
exit;
?>
+51
View File
@@ -0,0 +1,51 @@
<?php
#################################################################################
## -= YOU MAY NOT REMOVE OR CHANGE THIS NOTICE =- ##
## --------------------------------------------------------------------------- ##
## Filename : maintenance_status.tpl ##
## Type : Left Menu Widget ##
## --------------------------------------------------------------------------- ##
## Developed by : Shadow ##
## Project : TravianZ ##
## --------------------------------------------------------------------------- ##
#################################################################################
global $database, $session;
// rulează doar pentru admin
if($isAdmin) {
// === TOGGLE RAPID din meniu (?m=on / ?m=off) ===
if(isset($_GET['m']) && ($_GET['m'] == 'on' || $_GET['m'] == 'off')) {
$newState = ($_GET['m'] == 'on') ? 1 : 0;
$database->setMaintenance($newState, $session->uid);
// redirect ca sa curatam URL-ul
$cleanUrl = strtok($_SERVER["REQUEST_URI"], '?');
header("Location: $cleanUrl");
exit;
}
$maint = $database->getMaintenance();
if(!empty($maint['active'])) {
$started = $maint['started_at'] ? date('H:i d.m.Y', $maint['started_at']) : '-';
$starter = $database->getUserArray($maint['started_by'], 1);
$starterName = $starter['username'] ?? 'UID '.$maint['started_by'];
?>
<a href="?m=off"
title="Pornit de <?=htmlspecialchars($starterName)?> la <?=$started?> - Click pentru OPRIRE"
style="color:#dc2626; font-weight:700;">
Maintenance ON
</a>
<?php
} else {
?>
<a href="?m=on"
title="Server deschis - Click pentru ACTIVARE"
style="color:#16a34a; font-weight:700;">
Maintenance OFF
</a>
<?php
}
}
?>
+6 -4
View File
@@ -126,10 +126,6 @@ $idUser = isset($_SESSION['id_user']) ? (int)$_SESSION['id_user'] : 0;
<font color="Red"><?php echo ADMIN_PANEL; ?></font>
</a>
<a href="massmessage.php">
<?php echo MASS_MESSAGE; ?>
</a>
<a href="build_croppers.php">
Build Cropper
</a>
@@ -197,6 +193,12 @@ $idUser = isset($_SESSION['id_user']) ? (int)$_SESSION['id_user'] : 0;
* Natars include
*/
include("Templates/natars.tpl");
/**
* Maintenance status for admins
*/
include("Templates/maintenance_status.tpl");
?>
</p>
-281
View File
@@ -1,281 +0,0 @@
<?php
#################################################################################
## -= YOU MAY NOT REMOVE OR CHANGE THIS NOTICE =- ##
## --------------------------------------------------------------------------- ##
## Project: TravianZ ##
## Filename massmessage.php ##
## Developed by: Dzoki ##
## License: TravianZ Project ##
## Copyright: TravianZ (c) 2010-2026. All rights reserved. ##
## URLs: http://travian.shadowss.ro ##
## Source code: https://github.com/Shadowss/TravianZ ##
## ##
#################################################################################
use App\Utils\AccessLogger;
include_once("GameEngine/Account.php");
AccessLogger::logRequest();
$max_per_pass = 1000;
// Default flow flags used later in template conditions.
$NextStep = false;
$NextStep2 = false;
$done = false;
if (mysqli_num_rows(mysqli_query($database->dblink,"SELECT id FROM ".TB_PREFIX."users WHERE access = 9 AND id = ".(int) $session->uid)) != '1') die("Hacking attemp!");
if (@$_POST['submit'] == "Send")
{
unset ($_SESSION['m_message']); unset ($_SESSION['m_subject']); unset ($_SESSION['m_color']);
if (!$_POST['message']){die("You have to enter message");}
if (!$_POST['subject']){die("You have to enter subject");}
if (!$_POST['color']){$_SESSION['m_color'] = "black";}
$_SESSION['m_subject'] = $_POST['subject'];
if (!$_SESSION['m_color']){$_SESSION['m_color'] = $_POST['color'];}
$_SESSION['m_message'] = $_POST['message'];
$NextStep = true;
}
if (@isset($_POST['confirm']))
{
if ($_POST['confirm'] == 'Yes') $NextStep2 = true;
if ($_POST['confirm'] == 'No' ) $Interupt = true;
}
$max_per_pass = 1000;
if (isset($_GET['send']) && isset($_GET['from']))
{
$_SESSION['m_message'] = preg_replace("/\[img\]([a-z0-9\_\.\:\/\-]*)\[\/img\]/i","<img src='$1' alt='Corrupted image'/>", $_SESSION['m_message']);
$_SESSION['m_message'] = preg_replace("/\[url\]([a-z0-9\_\.\:\/\-]*)\[\/url\]/i", "<a href='$1'>$1</a>", $_SESSION['m_message']);
$_SESSION['m_message'] = preg_replace("/\[url\=([a-z0-9\_\.\:\/\-]*)\]([a-z0-9\_\.\:\/\-]*)\[\/url\]/i", "<a href='$1'>$2</a>", $_SESSION['m_message']);
$_SESSION['m_message'] = preg_replace("/\*u([0-9]*)(left|right)\*/i", "<img src='img/u2/u$1.gif' style='float:$2;' alt='unit$1' />", $_SESSION['m_message']);
$_SESSION['m_message'] = "[message]".$_SESSION['m_message']."[/message]";
$_SESSION['m_color'] = $database->escape($_SESSION['m_color']);
$_SESSION['m_subject'] = $database->escape($_SESSION['m_subject']);
$_SESSION['m_message'] = $database->escape($_SESSION['m_message']);
$users_count = mysqli_fetch_assoc(mysqli_query($database->dblink,"SELECT count(*) as count FROM ".TB_PREFIX."users WHERE id != 0"));
$users_count = $users_count['count'];
if ($_GET['from'] + $max_per_pass <= $users_count) $plus = $max_per_pass; else $plus = $users_count - $_GET['from'];
$sql = "INSERT INTO ".TB_PREFIX."mdata (`target`, `owner`, `topic`, `message`, `viewed`, `archived`, `send`, `time`,`deltarget`,`delowner`,`alliance`,`player`,`coor`,`report`) VALUES ";
for($i = $_GET['from']; $i < ($_GET['from'] + $plus) ; $i++) {
if($i > 5){
if ($_SESSION['m_color'])
{
$sql .= "($i, 1, '<span style=\'color:{$_SESSION['m_color']};\'>{$_SESSION['m_subject']}</span>', \"{$_SESSION['m_message']}\", 0, 0, 0, ".time().",0,0,0,0,0,0),";
}
else
{
$sql .= "($i, 1, '{$_SESSION['m_subject']}', \"{$_SESSION['m_message']}\", 0, 0, 0, ".time().",0,0,0,0,0,0),";
}
}
}
if($i > 5){
if ($_SESSION['m_color'])
{
$sql .= "($i, 1, '<span style=\'color:{$_SESSION['m_color']};\'>{$_SESSION['m_subject']}</span>', \"{$_SESSION['m_message']}\", 0, 0, 0, ".time().",0,0,0,0,0,0)";
}
else
{
$sql .= "($i, 0, '{$_SESSION['m_subject']}', \"{$_SESSION['m_message']}\", 0, 0, 0, ".time().",0,0,0,0,0,0),";
}
}
mysqli_query($database->dblink,$sql);
if (($users_count - $_GET['from']) > $max_per_pass) {
header("Location: massmessage.php?send=true&from=",$_GET['from'] + $max_per_pass);
exit;
} else $done = true;
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title><?php echo SERVER_NAME ?> - Mass Message</title>
<link rel="shortcut icon" href="favicon.ico"/>
<meta http-equiv="cache-control" content="max-age=0" />
<meta http-equiv="pragma" content="no-cache" />
<meta http-equiv="expires" content="0" />
<meta http-equiv="imagetoolbar" content="no" />
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<script src="mt-full.js?0ac37" type="text/javascript"></script>
<script src="unx.js?f4b7h" type="text/javascript"></script>
<script src="new.js?0ac37" type="text/javascript"></script>
<link href="<?php echo GP_LOCATE; ?>lang/en/lang.css?f4b7d" rel="stylesheet" type="text/css" />
<link href="<?php echo GP_LOCATE; ?>lang/en/compact.css?f4b7i" rel="stylesheet" type="text/css" />
<?php
if($session->gpack == null || GP_ENABLE == false) {
echo "
<link href='".GP_LOCATE."travian.css?e21d2' rel='stylesheet' type='text/css' />
<link href='".GP_LOCATE."lang/en/lang.css?e21d2' rel='stylesheet' type='text/css' />";
} else {
echo "
<link href='".$session->gpack."travian.css?e21d2' rel='stylesheet' type='text/css' />
<link href='".$session->gpack."lang/en/lang.css?e21d2' rel='stylesheet' type='text/css' />";
}
?>
<script language="javascript" type="text/javascript">
function smilie(text) {
document.myform.message.value += text;
}
</script>
<script language="javascript">
function toggleDisplay(e){
element = document.getElementById(e).style;
element.display == 'none' ? element.display = 'block' :
element.display='none';
}
</script>
<script type="text/javascript">
window.addEvent('domready', start);
</script>
<?php
if($session->gpack == null || GP_ENABLE == false) {
echo "
<link href='".GP_LOCATE."travian.css?e21d2' rel='stylesheet' type='text/css' />
<link href='".GP_LOCATE."lang/en/lang.css?e21d2' rel='stylesheet' type='text/css' />";
} else {
echo "
<link href='".$session->gpack."travian.css?e21d2' rel='stylesheet' type='text/css' />
<link href='".$session->gpack."lang/en/lang.css?e21d2' rel='stylesheet' type='text/css' />";
}
?>
<script type="text/javascript">
window.addEvent('domready', start);
</script>
</head>
<body class="v35 ie ie8">
<div class="wrapper">
<img style="filter:chroma();" src="img/x.gif" id="msfilter" alt="" />
<div id="dynamic_header">
</div>
<?php include("Templates/header.tpl"); ?>
<div id="mid">
<?php include("Templates/menu.tpl"); ?>
<div id="content" class="login">
<?php if (@!$NextStep && @!$NextStep2 && @!$done){?>
<form method="post" action="massmessage.php" name="myform" id="myform">
<table cellspacing="1" cellpadding="2" class="tbg" style="background-color:#C0C0C0; border: 0px solid #C0C0C0; font-size: 10pt;">
<tbody>
<tr>
<td class="rbg" style="font-size: 10pt; text-align:center;" colspan="2"><?php echo MASS; ?></td>
</tr>
<tr>
<td style="font-size: 10pt; text-align: left; width: 200px;"><?php echo MASS_SUBJECT; ?></td>
<td style="font-size: 10pt; text-align: left;">
<input type="text" style="width: 240px;" class="fm" name="subject" value="" size="30" /></td>
</tr>
<tr>
<td style="font-size: 10pt; text-align: left;"><?php echo MASS_COLOR; ?></td>
<td style="font-size: 10pt; text-align: left;">
<input type="text" style="width: 240px;" class="fm" name="color" size="30" /></td>
</tr>
<tr>
<td colspan="2" style="font-size: 10pt; text-align:center;"><?php echo MASS; ?> <br />
<textarea class="fm" name="message" cols="60" rows="23"></textarea></td>
</tr>
<tr>
<td colspan="2" style="text-align:center;"><?php echo MASS_REQUIRED; ?></td>
</tr>
<tr>
<td colspan="2" style="text-align:center;">
<input type="submit" value="Send" name="submit" /> </td>
</tr>
</tbody>
</table>
</form>
<?php
// TODO: these never worked... let's bring them back once we have BBCode entity parsing restored and working again
// note: they will need real images because classes like "uu1", "uu2"... don't exist in the CSS
if (0 == -1 && @!$NextStep && @!$NextStep2 && @!$done){
echo MASS_UNITS; ?>
<a href="javascript:toggleDisplay('message_smilies')"><?php echo MASS_SHOWHIDE; ?></a>
<div id="message_smilies" style="background:none repeat scroll 0 0 #EFEFEF;border:1px solid #71D000;left:20px;margin-top:5px;max-width:660px;padding:5px;position:relative;display: none;">
<?php echo MASS_READ; ?>
<a href="#" onclick="smilie('*u1*')"><img src="img/x.gif" class="uu1" /></a>
<a href="#" onclick="smilie('*u2*')"><img src="img/x.gif" class="uu2" /></a>
<a href="#" onclick="smilie('*u3*')"><img src="img/x.gif" class="uu3" /></a>
<a href="#" onclick="smilie('*u4*')"><img src="img/x.gif" class="uu4" /></a>
<a href="#" onclick="smilie('*u5*')"><img src="img/x.gif" class="uu5" /></a>
<a href="#" onclick="smilie('*u6*')"><img src="img/x.gif" class="uu6" /></a>
<a href="#" onclick="smilie('*u7*')"><img src="img/x.gif" class="uu7" /></a>
<a href="#" onclick="smilie('*u8*')"><img src="img/x.gif" class="uu8" /></a>
<a href="#" onclick="smilie('*u9*')"><img src="img/x.gif" class="uu9" /></a>
<a href="#" onclick="smilie('*u10*')"><img src="img/x.gif" class="uu10" /></a>
<a href="#" onclick="smilie('*u11*')"><img src="img/x.gif" class="uu11" /></a>
<a href="#" onclick="smilie('*u12*')"><img src="img/x.gif" class="uu12" /></a><br />
<a href="#" onclick="smilie('*u13*')"><img src="img/x.gif" class="uu13" /></a>
<a href="#" onclick="smilie('*u14*')"><img src="img/x.gif" class="uu14" /></a>
<a href="#" onclick="smilie('*u15*')"><img src="img/x.gif" class="uu15" /></a>
<a href="#" onclick="smilie('*u16*')"><img src="img/x.gif" class="uu16" /></a>
<a href="#" onclick="smilie('*u17*')"><img src="img/x.gif" class="uu17" /></a>
<a href="#" onclick="smilie('*u18*')"><img src="img/x.gif" class="uu18" /></a>
<a href="#" onclick="smilie('*u19*')"><img src="img/x.gif" class="uu19" /></a>
<a href="#" onclick="smilie('*u21*')"><img src="img/x.gif" class="uu21" /></a>
<a href="#" onclick="smilie('*u22*')"><img src="img/x.gif" class="uu22" /></a>
<a href="#" onclick="smilie('*u23*')"><img src="img/x.gif" class="uu23" /></a>
<a href="#" onclick="smilie('*u24*')"><img src="img/x.gif" class="uu24" /></a><br />
<a href="#" onclick="smilie('*u25*')"><img src="img/x.gif" class="uu25" /></a>
<a href="#" onclick="smilie('*u26*')"><img src="img/x.gif" class="uu26" /></a>
<a href="#" onclick="smilie('*u29*')"><img src="img/x.gif" class="uu29" /></a>
</div>
<?php } ?>
<?php }elseif (@$NextStep){?>
<form method="post" action="massmessage.php">
<table cellspacing="1" cellpadding="2" class="tbg">
<tbody>
<tr>
<td class="rbg" colspan="2"><?php echo MASS_CONFIRM; ?></td>
</tr>
<tr>
<td style="text-align: left; width: 200px;"><?php echo MASS_REALLY; ?></td>
<td style="text-align: left;">
<input type="submit" style="width: 240px;" class="fm" name="confirm" value="Yes" />
<input type="submit" style="width: 240px;" class="fm" name="confirm" value="No" /></td>
</tr>
</tbody>
</table>
</form>
<?php }elseif (@$NextStep2){?>
<script>document.location.href='massmessage.php?send=true&from=0'</script>
<?php }elseif (@$Interupt){?>
<b><?php echo MASS_ABORT; ?></b>
<?php }elseif (@$done){?>
<?php echo MASS_SENT; ?>
<?php }else{die("Something is wrong");}?>
</div>
<div id="side_info" class="outgame">
</div>
<div class="clear"></div>
</div>
<div class="footer-stopper outgame"></div>
<div class="clear"></div>
<?php include("Templates/footer.tpl"); ?>
<div id="ce"></div>
</body>
</html>