Fixed bugs in trade routes

+Trade routes can't be hacked anymore
+Fixed a bug that permitted to choose any village when adding a trade
route
+Fixed a bug that permitted to choose a time greater than 23 and less
than 0
+Fixed a bug that permitted to choose a number of repetitions greater
than 3 and less than 1
+Fixed a bug that permitted to edit other players trade route
+Fixed a bug that permitted to create a trading route with the same
village you were in
+Fixed some minor bugs
+Reworked the post/get request system, it's buch better now
This commit is contained in:
iopietro
2018-04-17 22:54:07 +02:00
parent 9c8637318b
commit 5270b1ca30
5 changed files with 107 additions and 124 deletions
+9 -11
View File
@@ -7,23 +7,19 @@
</p>
<?php include("17_menu.tpl");
if(isset($_GET['action'])){
if(isset($_POST['action'])){
$routeaccess = 1;
}
if(isset($_GET['create']) && $session->gold > 1){
$routeaccess = 1;
include("17_create.tpl");
}else if($_GET['action'] == 'editRoute' && isset($_GET['routeid']) && $_GET['routeid'] != ""){
$traderoute = $database->getTradeRouteUid($_GET['routeid']);
if($traderoute == $session->uid){
}else if($_POST['action'] == 'editRoute' && isset($_POST['routeid']) && !empty($_POST['routeid']) && $database->getTradeRouteUid($_POST['routeid']) == $session->uid){
include("17_edit.tpl");
}
}else{
?>
<p><?php echo TRADE_ROUTES_DESC;?> <img src="../../<?php echo GP_LOCATE; ?>img/a/gold.gif" alt="Gold" title="<?php echo GOLD;?>"><b>2</b>.</p>
<form method="post" action ="build.php?id=34&t=4">
<table id="npc" cellpadding="1" cellspacing="1">
<thead>
<tr>
@@ -41,7 +37,7 @@ $routes = $database->getTradeRoute($session->uid);
foreach($routes as $route){
?>
<tr>
<th><label><input class="radio" type="radio" onclick="window.location.href = '?id=<?php echo $id; ?>&t=4&routeid=<?php echo $route['id']; ?>';" name="routeid" value="<?php echo $route['id']; ?>" <?php if($routeid == $route['id']) { echo "".CHECKED.""; } ?>></label></th>
<th><label><input class="radio" type="radio" name="routeid" value="<?php echo $route['id']; ?>" <?php if($routeid == $route['id']) { echo "".CHECKED.""; } ?>></label></th>
<th>
<?php
echo "".TRADE_ROUTE_TO." <a href=karte.php?d=".$route['wid']."&c=".$generator->getMapCheck($route['wid']).">".$database->getVillageField($route['wid'],"name")."</a>";
@@ -57,16 +53,18 @@ echo "".TRADE_ROUTE_TO." <a href=karte.php?d=".$route['wid']."&c=".$generator->g
</th>
<th colspan="4">
<?php $routeid=$routeid == 0? $routeid=0:$routeid; ?>
<a href="build.php?action=extendRoute&routeid=<?php echo $routeid; ?>"><?php echo EXTEND;?></a>*
| <a href="build.php?id=<?php echo $id; ?>&t=4&action=editRoute&routeid=<?php echo $routeid; ?>"><?php echo EDIT;?></a>
| <a href="build.php?action=delRoute&routeid=<?php echo $routeid; ?>"><?php echo DELETE;?></a>
<button type="submit" name="action" value="extendRoute"><?php echo EXTEND;?>*</button>
| <button type="submit" name="action" value="editRoute"><?php echo EDIT;?></button>
| <button type="submit" name="action" value="delRoute"><?php echo DELETE;?></button>
</th></tr></tfoot></table>
</form>
* <?php echo EXTEND_TRADE_ROUTES;?> <img src="../../<?php echo GP_LOCATE; ?>img/a/gold.gif" alt="Gold" title="<?php echo GOLD;?>"><b>2</b>
<br>
<div class="options">
<a class="arrow" href="build.php?gid=17&t=4&create">» <?php echo CREATE_TRADE_ROUTES;?></a>
</div>
</div>
<?php
}}else{
header("Location: build.php?id=".$_GET['id']."");
+2 -2
View File
@@ -59,14 +59,14 @@
<th>
<?php echo COSTS;?>: </th>
<td>
<img src="../../<?php echo GP_LOCATE; ?>img/a/gold.gif" alt="Gold" title="<?php echo GOLD;?>"> 2
<img src="../../<?php echo GP_LOCATE; ?>img/a/gold.gif" alt="Gold" title="<?php echo GOLD;?>"> <b>2</b>
</td>
</tr>
<tr>
<th>
<?php echo DURATION;?>: </th>
<td>
7 <?php echo DAYS;?>
<b>7</b> <?php echo DAYS;?>
</td>
</tr>
</tbody></table>
+3 -3
View File
@@ -1,8 +1,8 @@
<?php $edited_route = $database->getTradeRoute2($_GET['routeid']); ?>
<?php $edited_route = $database->getTradeRoute2($_POST['routeid']); ?>
<form action="build.php" method="post">
<div class="boxes boxesColor gray"><div class="boxes-tl"></div><div class="boxes-tr"></div><div class="boxes-tc"></div><div class="boxes-ml"></div><div class="boxes-mr"></div><div class="boxes-mc"></div><div class="boxes-bl"></div><div class="boxes-br"></div><div class="boxes-bc"></div><div class="boxes-contents cf">
<input type="hidden" name="action" value="editRoute">
<input type="hidden" name="routeid" value="<?php echo $_GET['routeid']; ?>">
<input type="hidden" name="action" value="editRoute2">
<input type="hidden" name="routeid" value="<?php echo $_POST['routeid']; ?>">
<table cellpadding="1" cellspacing="1" id="npc" class="transparent">
<thead>
<tr>