mirror of
https://github.com/Shadowss/TravianZ.git
synced 2026-06-28 00:24:23 +00:00
Admin panel fixes
+Plus and bonuses duration, can now be decreased or resetted, by inserting a negative value of days +Artifacts and artifacts villages created on a user account, won't contain any troops +Some clean up
This commit is contained in:
@@ -24,57 +24,24 @@ for ($i = 0; $i < 5; $i++) {
|
||||
|
||||
include_once($autoprefix."GameEngine/Database.php");
|
||||
|
||||
$session = (int) $_POST['admid'];
|
||||
$id = (int) $_POST['id'];
|
||||
|
||||
$sql = mysqli_query($GLOBALS["link"], "SELECT * FROM ".TB_PREFIX."users WHERE id = ".$session."");
|
||||
$access = mysqli_fetch_array($sql);
|
||||
$sessionaccess = $access['access'];
|
||||
$bonusDuration = [];
|
||||
$time = time();
|
||||
$bonusDuration['plus'] = (int) $_POST['plus'] * 86400; //Plus
|
||||
$bonusDuration['b1'] = (int) $_POST['wood'] * 86400; //+25% Wood
|
||||
$bonusDuration['b2'] = (int) $_POST['clay'] * 86400; //+25% Clay
|
||||
$bonusDuration['b3'] = (int) $_POST['iron'] * 86400; //+25% Iron
|
||||
$bonusDuration['b4'] = (int) $_POST['crop'] * 86400; //+25% Crop
|
||||
|
||||
if($sessionaccess != 9) die("<h1><font color=\"red\">Access Denied: You are not Admin!</font></h1>");
|
||||
$user = $database->getUserArray($id, 1);
|
||||
|
||||
$pdur = (int) $_POST['plus'] * 86400;
|
||||
$b1dur = (int) $_POST['wood'] * 86400;
|
||||
$b2dur = (int) $_POST['clay'] * 86400;
|
||||
$b3dur = (int) $_POST['iron'] * 86400;
|
||||
$b4dur = (int) $_POST['crop'] * 86400;
|
||||
|
||||
$sql1 = mysqli_query($GLOBALS["link"], "SELECT * FROM ".TB_PREFIX."users WHERE id = ".$id."");
|
||||
$user = mysqli_fetch_array($sql1);
|
||||
|
||||
if($user['plus'] < time()){
|
||||
if($pdur > 1){ $plus = (time() + $pdur); } else { $plus = time(); }
|
||||
}else{
|
||||
if($pdur > 1){ $plus = ($user['plus'] + $pdur); } else { $plus = $user['plus']; }
|
||||
}
|
||||
if($user['b1'] < time()){
|
||||
if($b1dur > 1){ $wood = (time() + $b1dur); } else { $wood = time(); }
|
||||
}else{
|
||||
if($b1dur > 1){ $wood = ($user['b1'] + $b1dur); } else { $wood = $user['b1']; }
|
||||
}
|
||||
if($user['b2'] < time()){
|
||||
if($b2dur > 1){ $clay = (time() + $b2dur); } else { $clay = time(); }
|
||||
}else{
|
||||
if($b2dur > 1){ $clay = ($user['b2'] + $b2dur); } else { $clay = $user['b2']; }
|
||||
}
|
||||
if($user['b3'] < time()){
|
||||
if($b3dur > 1){ $iron = (time() + $b3dur); } else { $iron = time(); }
|
||||
}else{
|
||||
if($b3dur > 1){ $iron = ($user['b3'] + $b3dur); } else { $iron = $user['b3']; }
|
||||
}
|
||||
if($user['b4'] < time()){
|
||||
if($b4dur > 1){ $crop = (time() + $b4dur); } else { $crop = time(); }
|
||||
}else{
|
||||
if($b4dur > 1){ $crop = ($user['b4'] + $b4dur); } else { $crop = $user['b4']; }
|
||||
foreach($bonusDuration as $index => $bonus){
|
||||
$bonusDuration[$index] = $bonusDuration[$index] + ($user[$index] < $time ? $time : $user[$index]);
|
||||
if($bonusDuration[$index] < $time) $bonusDuration[$index] = 0;
|
||||
}
|
||||
|
||||
mysqli_query($GLOBALS["link"], "UPDATE ".TB_PREFIX."users SET
|
||||
plus = '".$plus."',
|
||||
b1 = '".$wood."',
|
||||
b2 = '".$clay."',
|
||||
b3 = '".$iron."',
|
||||
b4 = '".$crop."'
|
||||
WHERE id = $id") or die(mysqli_error($database->dblink));
|
||||
$database->updateUserField($id, array_keys($bonusDuration), array_values($bonusDuration), 1);
|
||||
|
||||
header("Location: ../../../Admin/admin.php?p=player&uid=".$id."");
|
||||
?>
|
||||
Reference in New Issue
Block a user