some improves by nextrack and fix carry of merchants

This commit is contained in:
unknown
2012-05-25 14:39:44 +03:00
parent 158d902dd5
commit 6fcc3e6803
3 changed files with 182 additions and 180 deletions
+146 -146
View File
@@ -19,164 +19,164 @@ $users = mysql_num_rows(mysql_query("SELECT SQL_CACHE * FROM ".TB_PREFIX."users"
<br /><br /> <br /><br />
<table id="profile"> <table id="profile">
<thead> <thead>
<tr> <tr>
<th colspan="2">Player Information</th> <th colspan="2">Player Information</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<tr> <tr>
<td>Registered players</td> <td>Registered players</td>
<td><?php echo $users; ?></td> <td><?php echo $users; ?></td>
</tr> </tr>
<tr> <tr>
<td>Active players</td> <td>Active players</td>
<td><?php $result = mysql_query("SELECT SQL_CACHE * FROM ".TB_PREFIX."active"); $num_rows = mysql_num_rows($result); echo $num_rows; ?></td> <td><?php $result = mysql_query("SELECT SQL_CACHE * FROM ".TB_PREFIX."active"); $num_rows = mysql_num_rows($result); echo $num_rows; ?></td>
</tr> </tr>
<tr> <tr>
<td>Players online</td> <td>Players online</td>
<td><?php $t =time(); <td><?php $t =time();
$result = mysql_query("SELECT SQL_CACHE * FROM ".TB_PREFIX."users WHERE ".$t." - timestamp < 300") or die(mysql_error());; $result = mysql_query("SELECT SQL_CACHE * FROM ".TB_PREFIX."users WHERE ".$t." - timestamp < 300") or die(mysql_error());;
$num_rows = mysql_num_rows($result); $num_rows = mysql_num_rows($result);
echo $num_rows;?> echo $num_rows;?>
</td> </td>
</tr> </tr>
<tr> <tr>
<td>Players Banned</td> <td>Players Banned</td>
<td><?php <td><?php
$result = mysql_query("SELECT SQL_CACHE * FROM ".TB_PREFIX."users WHERE access = 0"); $result = mysql_query("SELECT SQL_CACHE * FROM ".TB_PREFIX."users WHERE access = 0");
$num_rows = mysql_num_rows($result); $num_rows = mysql_num_rows($result);
echo $num_rows;?> echo $num_rows;?>
</td> </td>
</tr> </tr>
<tr> <tr>
<td>Villages settled</td> <td>Villages settled</td>
<td><?php <td><?php
$result = mysql_query("SELECT SQL_CACHE * FROM ".TB_PREFIX."vdata"); $result = mysql_query("SELECT SQL_CACHE * FROM ".TB_PREFIX."vdata");
$num_rows = mysql_num_rows($result); $num_rows = mysql_num_rows($result);
echo $num_rows; ?> echo $num_rows; ?>
</td> </td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
<br /> <br />
<table id="profile"> <table id="profile">
<thead> <thead>
<tr><th colspan="3">Player Information</th></tr> <tr><th colspan="3">Player Information</th></tr>
<td class="b">Tribe</td> <td class="b">Tribe</td>
<td class="b">Registered</td> <td class="b">Registered</td>
<td class="b">Percent</td> <td class="b">Percent</td>
</thead> </thead>
<tbody> <tbody>
<tr> <tr>
<td>Romans</td> <td>Romans</td>
<td><?php echo $tribes[0]; ?></td> <td><?php echo $tribes[0]; ?></td>
<td><?php $percents = 100*($tribes[0] / $users); echo $percents = intval ($percents); echo "%"; ?></td> <td><?php $percents = 100*($tribes[0] / $users); echo $percents = intval ($percents); echo "%"; ?></td>
</tr> </tr>
<tr> <tr>
<td>Teutons</td> <td>Teutons</td>
<td><?php echo $tribes[1]; ?></td> <td><?php echo $tribes[1]; ?></td>
<td><?php $percents = 100*($tribes[1] / $users); echo $percents = intval ($percents); echo "%";?></td> <td><?php $percents = 100*($tribes[1] / $users); echo $percents = intval ($percents); echo "%";?></td>
</tr> </tr>
<tr> <tr>
<td>Gauls</td> <td>Gauls</td>
<td><?php echo $tribes[2]; ?></td> <td><?php echo $tribes[2]; ?></td>
<td><?php $percents = 100*($tribes[2] / $users); echo $percents = intval ($percents); echo "%"; ?></td> <td><?php $percents = 100*($tribes[2] / $users); echo $percents = intval ($percents); echo "%"; ?></td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
<br /> <br />
<table id="profile"> <table id="profile">
<thead> <thead>
<tr> <tr>
<th colspan="3">Server Information</th> <th colspan="3">Server Information</th>
</tr> </tr>
<td class="b"></td> <td class="b"></td>
<td class="b">Total</td> <td class="b">Total</td>
<td class="b">Average</td> <td class="b">Average</td>
</thead> </thead>
<tbody> <tbody>
<tr> <tr>
<td><img src="../../<?php echo GP_LOCATE; ?>img/a/gold.gif" alt="Gold" title="Gold"> Gold</td> <td><img src="../../<?php echo GP_LOCATE; ?>img/a/gold.gif" alt="Gold" title="Gold"> Gold</td>
<td><?php $gold = mysql_query("SELECT SUM(gold) AS sumofgold FROM ".TB_PREFIX."users"); $getgold=mysql_fetch_assoc($gold); echo $getgold['sumofgold']; ?></td> <td><?php $gold = mysql_query("SELECT SUM(gold) AS sumofgold FROM ".TB_PREFIX."users"); $getgold=mysql_fetch_assoc($gold); echo $getgold['sumofgold']; ?></td>
<td><?php $gold = mysql_query("SELECT SUM(gold) AS sumofgold FROM ".TB_PREFIX."users"); $getgold=mysql_fetch_assoc($gold); echo round($getgold['sumofgold'] / $users);?></td> <td><?php $gold = mysql_query("SELECT SUM(gold) AS sumofgold FROM ".TB_PREFIX."users"); $getgold=mysql_fetch_assoc($gold); echo round($getgold['sumofgold'] / $users);?></td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
</div> </div>
<table id="member"> <table id="member">
<thead> <thead>
<tr> <tr>
<th colspan="10">Troops on the Server</th> <th colspan="10">Troops on the Server</th>
</tr> </tr>
<?php <?php
for($i=1; $i<11; $i++) for($i=1; $i<11; $i++)
{ {
echo '<td class="on"><img src="../../<?php echo GP_LOCATE; ?>img/u/'.$i.'.gif"></td>'; echo '<td class="on"><img src="../../'.GP_LOCATE.'img/u/'.$i.'.gif"></td>';
} }
echo '</thead><tbody>'; echo '</thead><tbody>';
for($i=1; $i<11; $i++) for($i=1; $i<11; $i++)
{ {
$t = mysql_query("SELECT SUM(u".$i.") AS sumof FROM ".TB_PREFIX."units"); $t = mysql_query("SELECT SUM(u".$i.") AS sumof FROM ".TB_PREFIX."units");
$troop = mysql_fetch_assoc($t); $troop = mysql_fetch_assoc($t);
echo '<td class="on">'.$troop['sumof'].'</td>'; echo '<td class="on">'.$troop['sumof'].'</td>';
} }
echo "</tr>"; echo "</tr>";
for($i=11; $i<21; $i++) for($i=11; $i<21; $i++)
{ {
echo '<td class="on"><img src="../../<?php echo GP_LOCATE; ?>img/u/'.$i.'.gif"></td>'; echo '<td class="on"><img src="../../'.GP_LOCATE.'img/u/'.$i.'.gif"></td>';
} }
echo '</thead><tbody>'; echo '</thead><tbody>';
for($i=11; $i<21; $i++) for($i=11; $i<21; $i++)
{ {
$t = mysql_query("SELECT SUM(u".$i.") AS sumof FROM ".TB_PREFIX."units"); $t = mysql_query("SELECT SUM(u".$i.") AS sumof FROM ".TB_PREFIX."units");
$troop = mysql_fetch_assoc($t); $troop = mysql_fetch_assoc($t);
echo '<td class="on">'.$troop['sumof'].'</td>'; echo '<td class="on">'.$troop['sumof'].'</td>';
} }
echo "</tr>"; echo "</tr>";
for($i=21; $i<31; $i++) for($i=21; $i<31; $i++)
{ {
echo '<td class="on"><img src="../../<?php echo GP_LOCATE; ?>img/u/'.$i.'.gif"></td>'; echo '<td class="on"><img src="../../'.GP_LOCATE.'img/u/'.$i.'.gif"></td>';
} }
echo '</thead><tbody>'; echo '</thead><tbody>';
for($i=21; $i<31; $i++) for($i=21; $i<31; $i++)
{ {
$t = mysql_query("SELECT SUM(u".$i.") AS sumof FROM ".TB_PREFIX."units"); $t = mysql_query("SELECT SUM(u".$i.") AS sumof FROM ".TB_PREFIX."units");
$troop = mysql_fetch_assoc($t); $troop = mysql_fetch_assoc($t);
echo '<td class="on">'.$troop['sumof'].'</td>'; echo '<td class="on">'.$troop['sumof'].'</td>';
} }
echo "</tr>"; echo "</tr>";
for($i=31; $i<41; $i++) for($i=31; $i<41; $i++)
{ {
echo '<td class="on"><img src="../../<?php echo GP_LOCATE; ?>img/u/'.$i.'.gif"></td>'; echo '<td class="on"><img src="../../'.GP_LOCATE.'img/u/'.$i.'.gif"></td>';
} }
echo '</thead><tbody>'; echo '</thead><tbody>';
for($i=31; $i<41; $i++) for($i=31; $i<41; $i++)
{ {
$t = mysql_query("SELECT SUM(u".$i.") AS sumof FROM ".TB_PREFIX."units"); $t = mysql_query("SELECT SUM(u".$i.") AS sumof FROM ".TB_PREFIX."units");
$troop = mysql_fetch_assoc($t); $troop = mysql_fetch_assoc($t);
echo '<td class="on">'.$troop['sumof'].'</td>'; echo '<td class="on">'.$troop['sumof'].'</td>';
} }
echo "</tr>"; echo "</tr>";
for($i=41; $i<51; $i++) for($i=41; $i<51; $i++)
{ {
echo '<td class="on"><img src="../../<?php echo GP_LOCATE; ?>img/u/'.$i.'.gif"></td>'; echo '<td class="on"><img src="../../'.GP_LOCATE.'img/u/'.$i.'.gif"></td>';
} }
echo '</thead><tbody>'; echo '</thead><tbody>';
for($i=41; $i<51; $i++) for($i=41; $i<51; $i++)
{ {
$t = mysql_query("SELECT SUM(u".$i.") AS sumof FROM ".TB_PREFIX."units"); $t = mysql_query("SELECT SUM(u".$i.") AS sumof FROM ".TB_PREFIX."units");
$troop = mysql_fetch_assoc($t); $troop = mysql_fetch_assoc($t);
echo '<td class="on">'.$troop['sumof'].'</td>'; echo '<td class="on">'.$troop['sumof'].'</td>';
} }
?> ?>
</tbody> </tbody>
</table> </table>
<div> <div>
+4 -2
View File
@@ -23,7 +23,9 @@ else if($_POST['dname']!=""){
$getwref = $database->getVillageByName($_POST['dname']); $getwref = $database->getVillageByName($_POST['dname']);
$checkexist = $database->checkVilExist($getwref); $checkexist = $database->checkVilExist($getwref);
} }
if(isset($_POST['ft'])=='check' && $allres!=0 && $allres <= $market->maxcarry && ($_POST['x']!="" && $_POST['y']!="" or $_POST['dname']!="") && $checkexist){ $maxcarry = $market->maxcarry;
$maxcarry *= $market->merchantAvail();
if(isset($_POST['ft'])=='check' && $allres!=0 && $allres <= $maxcarry && ($_POST['x']!="" && $_POST['y']!="" or $_POST['dname']!="") && $checkexist){
?> ?>
<form method="POST" name="snd" action="build.php"> <form method="POST" name="snd" action="build.php">
<input type="hidden" name="ft" value="mk1"> <input type="hidden" name="ft" value="mk1">
@@ -200,7 +202,7 @@ if(isset($_POST['ft'])=='check'){
$error = '<span class="error"><b>Resources not selected.</b></span>'; $error = '<span class="error"><b>Resources not selected.</b></span>';
}elseif(!$_POST['x'] && !$_POST['y'] && !$_POST['dname']){ }elseif(!$_POST['x'] && !$_POST['y'] && !$_POST['dname']){
$error = '<span class="error"><b>Enter coordinates or village name.</b></span>'; $error = '<span class="error"><b>Enter coordinates or village name.</b></span>';
}elseif($allres > $market->maxcarry){ }elseif($allres > $maxcarry){
$error = '<span class="error"><b>Too few merchants.</b></span>'; $error = '<span class="error"><b>Too few merchants.</b></span>';
} }
echo $error; echo $error;
+1 -1
View File
@@ -14,7 +14,7 @@
| TravianX All rights reserved | TravianX All rights reserved
| |
*/ */
if(isset($_GET['aid']) && !is_numeric($_GET['aid'])) die('Attempt of sql injection blocked');
include ("GameEngine/Village.php"); include ("GameEngine/Village.php");
include ("GameEngine/Chat.php"); include ("GameEngine/Chat.php");
$start = $generator->pageLoadTimeStart(); $start = $generator->pageLoadTimeStart();