mirror of
https://github.com/Shadowss/TravianZ.git
synced 2026-06-28 00:24:23 +00:00
General fixes
+Medals can now be deleted correctly
This commit is contained in:
@@ -21,20 +21,14 @@ if(isset($id))
|
||||
$varray = $database->getProfileVillages($id);
|
||||
$refreshiconfrm = "../img/admin/refresh.png";
|
||||
$refreshicon = "<img src=\"".$refreshiconfrm."\">";
|
||||
if($user)
|
||||
{
|
||||
if($user){
|
||||
$totalpop = 0;
|
||||
foreach($varray as $vil)
|
||||
{
|
||||
$totalpop += $vil['pop'];
|
||||
}
|
||||
foreach($varray as $vil) $totalpop += $vil['pop'];
|
||||
|
||||
include('search2.tpl');
|
||||
echo "<br />";
|
||||
$deletion = false;
|
||||
if($deletion)
|
||||
{
|
||||
include("playerdeletion.tpl");
|
||||
}
|
||||
if($deletion) include("playerdeletion.tpl");
|
||||
|
||||
include("playerinfo.tpl");
|
||||
include("playerheroinfo.tpl");
|
||||
@@ -88,9 +82,6 @@ if(isset($id))
|
||||
</table>
|
||||
<?php
|
||||
}
|
||||
else
|
||||
{
|
||||
include("404.tpl");
|
||||
}
|
||||
else include("404.tpl");
|
||||
}
|
||||
?>
|
||||
@@ -1,6 +1,3 @@
|
||||
<form action="../GameEngine/Admin/Mods/medals.php" method="POST">
|
||||
<input type="hidden" name="uid" value="<?php echo $_GET['uid']; ?>">
|
||||
<input type="hidden" name="admid" id="admid" value="<?php echo $_SESSION['id']; ?>">
|
||||
<table id="profile">
|
||||
<thead>
|
||||
<tr>
|
||||
@@ -16,36 +13,33 @@
|
||||
</tr>
|
||||
</thead>
|
||||
<?php
|
||||
if(sizeof($varmedal) ==0)
|
||||
{ ?>
|
||||
<td colspan="5"><center>This player has no medals yet</center></td><?php
|
||||
if(empty($varmedal)){ ?>
|
||||
<td colspan="5"><div style="text-align: center">This player has no medals yet</div></td><?php
|
||||
}
|
||||
elseif(sizeof($varmedal) >0)
|
||||
{
|
||||
foreach($varmedal as $medal)
|
||||
{
|
||||
$titel="Bonus";
|
||||
switch ($medal['categorie'])
|
||||
{
|
||||
case "1": $titel="Attackers"; break;
|
||||
case "2": $titel="Defenders"; break;
|
||||
case "3": $titel="Climbers"; break;
|
||||
case "4": $titel="Robbers"; break;
|
||||
case "5": $titel="Top 10 Att and Def"; break;
|
||||
case "6": $titel="Top 3 Att, ".$medal['points']." in a row"; break;
|
||||
case "7": $titel="Top 3 Def,".$medal['points']." in a row"; break;
|
||||
case "8": $titel="Top 3 Climber, ".$medal['points']." in a row"; break;
|
||||
case "9": $titel="Top 3 Robber, ".$medal['points']." in a row"; break;
|
||||
case "10": $titel="Climber of the week"; break;
|
||||
case "11": $titel="Top 3 Climber, ".$medal['points']." in a row"; break;
|
||||
case "12": $titel="Top 10 Attacker, ".$medal['points']." in a row"; break;
|
||||
elseif(!empty($varmedal)){
|
||||
foreach($varmedal as $medal){
|
||||
$title = "Bonus";
|
||||
switch ($medal['categorie']){
|
||||
case 1: $title = "Attackers"; break;
|
||||
case 2: $title = "Defenders"; break;
|
||||
case 3: $title = "Climbers"; break;
|
||||
case 4: $title = "Robbers"; break;
|
||||
case 5: $title = "Top 10 Att and Def"; break;
|
||||
case 6: $title = "Top 3 Att, ".$medal['points']." in a row"; break;
|
||||
case 7: $title = "Top 3 Def,".$medal['points']." in a row"; break;
|
||||
case 8: $title = "Top 3 Climber, ".$medal['points']." in a row"; break;
|
||||
case 9: $title = "Top 3 Robber, ".$medal['points']." in a row"; break;
|
||||
case 10: $title = "Climber of the week"; break;
|
||||
case 11: $title = "Top 3 Climber, ".$medal['points']." in a row"; break;
|
||||
case 12: $title = "Top 10 Attacker, ".$medal['points']." in a row"; break;
|
||||
}
|
||||
$title = $titel;
|
||||
|
||||
$rank = $medal['plaats'];
|
||||
if($rank == '0') { $rank = "<p>Bonus</p>"; } else { $rank = $rank; }
|
||||
if($rank == 0) $rank = "<p>Bonus</p>";
|
||||
|
||||
$week = $medal['week'];
|
||||
$points = $medal['points'];
|
||||
if($points == '') { $points = "<p>Bonus</p>"; } else { $points = $points; }
|
||||
if($points == '') $points = "<p>Bonus</p>";
|
||||
|
||||
echo"
|
||||
<tr>
|
||||
@@ -54,38 +48,36 @@
|
||||
<td>$week</td>
|
||||
<td>$points</td>
|
||||
<td><img src=\"../gpack/travian_default/img/t/".$medal['img'].".jpg\"></td>
|
||||
<td>
|
||||
<input type=\"image\" name=\"medalid\" value=\"".$medal['id']."\" style=\"background-image: url('../gpack/travian_default/img/a/del.gif'); height: 12px; width: 12px;\" src=\"../gpack/travian_default/img/a/x.gif\">
|
||||
</td>
|
||||
<form action=\"../GameEngine/Admin/Mods/medals.php\" method=\"POST\">
|
||||
<td>
|
||||
<input type=\"hidden\" name=\"uid\" value=\"".$_GET['uid']."\">
|
||||
<input type=\"hidden\" name=\"medalid\" value=\"".$medal['id']."\" >
|
||||
<input type=\"image\" style=\"background-image: url('../gpack/travian_default/img/a/del.gif'); height: 12px; width: 12px;\" src=\"../gpack/travian_default/img/a/x.gif\">
|
||||
</td>
|
||||
</form>
|
||||
</tr>";
|
||||
}
|
||||
|
||||
$averagerank = 0;
|
||||
foreach($varmedal as $medal)
|
||||
{
|
||||
foreach($varmedal as $medal){
|
||||
$rank = $medal['plaats'];
|
||||
if($rank > 0)
|
||||
{
|
||||
if(is_numeric($rank))
|
||||
{
|
||||
$i = $i + 1;
|
||||
$averagerank = $averagerank + $medal['plaats'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$averagerank = $averagerank + 0;
|
||||
if($rank > 0){
|
||||
if(is_numeric($rank)){
|
||||
$i++;
|
||||
$averagerank += $medal['plaats'];
|
||||
}
|
||||
}
|
||||
}
|
||||
$average = $averagerank / $i;
|
||||
$average = round($averagerank / $i, 1);
|
||||
echo "</form><tr><td><b>Average Rank</b></td><td>$average</td><td></td><td></td><td>Delete All</td>";
|
||||
}
|
||||
?>
|
||||
<td>
|
||||
<form action="../GameEngine/Admin/Mods/deletemedalbyuser.php" method="POST">
|
||||
<input type="hidden" name="admid" id="admid" value="<?php echo $_SESSION['id']; ?>">
|
||||
<input type="image" name="userid" value="<?php echo $id; ?>" style="background-image: url('../gpack/travian_default/img/a/del.gif'); height: 12px; width: 12px;" src="../gpack/travian_default/img/a/x.gif">
|
||||
</form>
|
||||
</td>
|
||||
<td>
|
||||
<form action="../GameEngine/Admin/Mods/medals.php" method="POST">
|
||||
<input type="hidden" name="uid" value="<?php echo $_GET['uid']; ?>">
|
||||
<input type="hidden" name="userid" value="<?php echo $id; ?>">
|
||||
<input type="image" style="background-image: url('../gpack/travian_default/img/a/del.gif'); height: 12px; width: 12px;" src="../gpack/travian_default/img/a/x.gif">
|
||||
</form>
|
||||
</td>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
+13
-13
@@ -30,20 +30,20 @@ $active = $admin->getUserActive();
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<center>
|
||||
<div style="text-align: center">
|
||||
<select name="punish">
|
||||
<option name="punish" value="10" selected="selected">10%</option>
|
||||
<option name="punish" value="20">20%</option>
|
||||
<option name="punish" value="30">30%</option>
|
||||
<option name="punish" value="40">40%</option>
|
||||
<option name="punish" value="50">50%</option>
|
||||
<option name="punish" value="60">60%</option>
|
||||
<option name="punish" value="70">70%</option>
|
||||
<option name="punish" value="80">80%</option>
|
||||
<option name="punish" value="90">90%</option>
|
||||
<option name="punish" value="100">100%</option>
|
||||
<option value="10" selected="selected">10%</option>
|
||||
<option value="20">20%</option>
|
||||
<option value="30">30%</option>
|
||||
<option value="40">40%</option>
|
||||
<option value="50">50%</option>
|
||||
<option value="60">60%</option>
|
||||
<option value="70">70%</option>
|
||||
<option value="80">80%</option>
|
||||
<option value="90">90%</option>
|
||||
<option value="100">100%</option>
|
||||
</select>
|
||||
</center>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
@@ -88,5 +88,5 @@ $active = $admin->getUserActive();
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</table><br />
|
||||
</form>
|
||||
@@ -24,23 +24,19 @@ for ($i = 0; $i < 5; $i++) {
|
||||
|
||||
include_once($autoprefix."GameEngine/Database.php");
|
||||
|
||||
if (!isset($_SESSION)) session_start();
|
||||
if($_SESSION['access'] < ADMIN) die("Access Denied: You are not Admin!");
|
||||
if(isset($_POST['medalid']) && !empty($_POST['medalid']) && is_numeric($_POST['medalid'])){
|
||||
$medalID = (int) $_POST['medalid'];
|
||||
mysqli_query($database->dblink, "UPDATE ".TB_PREFIX."medal set del = 1 WHERE id = ".$medalID."");
|
||||
}
|
||||
elseif(isset($_POST['userid']) && !empty($_POST['userid']) && is_numeric($_POST['userid'])){
|
||||
$userID = (int) $_POST['userid'];
|
||||
mysqli_query($database->dblink, "UPDATE ".TB_PREFIX."medal set del = 1 WHERE userid = ".$userID."");
|
||||
}
|
||||
|
||||
$medalid = (int) $_POST['medalid'];
|
||||
$uid = (int) $_POST['uid'];
|
||||
$admid = (int) $_POST['admid'];
|
||||
$admidID = (int) $_SESSION['id'];
|
||||
$name = $database->getUserField($adminID, "name", 0);
|
||||
//TODO: Make a dedicated method for logging
|
||||
mysqli_query($database->dblink, "INSERT INTO ".TB_PREFIX."admin_log values (0, $admid, 'Deleted medal id [#".$medalid."] from the user <a href=\'admin.php?p=player&uid=$uid\'>$name</a> ',".time().")");
|
||||
|
||||
mysqli_query($GLOBALS["link"], "UPDATE ".TB_PREFIX."medal set del = 1 WHERE id = ".$medalid."");
|
||||
|
||||
$name = mysqli_fetch_array(mysqli_query($GLOBALS["link"], "SELECT name FROM ".TB_PREFIX."users WHERE id= ".$uid.""), MYSQLI_ASSOC);
|
||||
$name = $name['name'];
|
||||
|
||||
mysqli_query($GLOBALS["link"], "Insert into ".TB_PREFIX."admin_log values (0,$admid,'Deleted medal id [#".$medalid."] from the user <a href=\'admin.php?p=player&uid=$uid\'>$name</a> ',".time().")");
|
||||
|
||||
|
||||
$deleteweek = (int) $_POST['medalweek'];
|
||||
mysqli_query($GLOBALS["link"], "UPDATE ".TB_PREFIX."medal set del = 1 WHERE week = ".$deleteweek."");
|
||||
|
||||
header("Location: ../../../Admin/admin.php?p=player&uid=".$uid."");
|
||||
header("Location: ../../../Admin/admin.php?p=player&uid=".$_POST['uid']."");
|
||||
?>
|
||||
Reference in New Issue
Block a user