mirror of
https://github.com/Shadowss/TravianZ.git
synced 2026-07-25 14:06:12 +00:00
Merge branch 'master' of https://github.com/Shadowss/TravianZ
This commit is contained in:
@@ -13,25 +13,23 @@
|
||||
if(!isset($_SESSION)) session_start();
|
||||
if($_SESSION['access'] < 9) die(ACCESS_DENIED_ADMIN);
|
||||
include_once("../../Database.php");
|
||||
include_once("../../Technology.php");
|
||||
include_once("../../Data/unitdata.php");
|
||||
|
||||
$id = $_POST['id'];
|
||||
$id = (int)$_POST['id'];
|
||||
$village = $database->getVillage($id);
|
||||
$user = $database->getUserArray($village['owner'],1);
|
||||
$units="";
|
||||
$tribe = $user['tribe'];
|
||||
if($tribe ==1){ $u = 0;}
|
||||
if($tribe ==2){ $u = 10;}
|
||||
if($tribe ==3){ $u = 20;}
|
||||
if($tribe ==4){ $u = 30;}
|
||||
if($tribe ==5){ $u = 40;}
|
||||
if($tribe ==6){ $u = 50;}
|
||||
$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) ? ", " : ""));
|
||||
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 = ".(int) $id;
|
||||
|
||||
$q = "UPDATE ".TB_PREFIX."units SET ".$units." WHERE vref = ".$id;
|
||||
$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().")");
|
||||
|
||||
$database->addStarvationData($id);
|
||||
header("Location: ../../../Admin/admin.php?p=village&did=".$id."&d");
|
||||
?>
|
||||
@@ -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."");
|
||||
?>
|
||||
@@ -30,14 +30,6 @@ for ($i = 0; $i < 5; $i++) {
|
||||
|
||||
include_once($autoprefix."GameEngine/Database.php");
|
||||
|
||||
$session = (int) $_POST['admid'];
|
||||
|
||||
$sql = mysqli_query($GLOBALS["link"], "SELECT * FROM ".TB_PREFIX."users WHERE id = ".$session."");
|
||||
$access = mysqli_fetch_array($sql);
|
||||
$sessionaccess = $access['access'];
|
||||
|
||||
if($sessionaccess != 9) 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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user