fix some bugs

This commit is contained in:
unknown
2012-07-09 13:58:10 +03:00
parent cb86d9494f
commit c0730af9ee
4 changed files with 69 additions and 39 deletions
+6 -6
View File
@@ -100,7 +100,7 @@ $users = mysql_num_rows(mysql_query("SELECT SQL_CACHE * FROM ".TB_PREFIX."users"
</thead>
<tbody>
<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 round($getgold['sumofgold'] / $users);?></td>
</tr>
@@ -115,7 +115,7 @@ $users = mysql_num_rows(mysql_query("SELECT SQL_CACHE * FROM ".TB_PREFIX."users"
<?php
for($i=1; $i<11; $i++)
{
echo '<td class="on"><img src="../../'.GP_LOCATE.'img/u/'.$i.'.gif"></td>';
echo '<td class="on"><img src="../'.GP_LOCATE.'img/u/'.$i.'.gif"></td>';
}
echo '</thead><tbody>';
for($i=1; $i<11; $i++)
@@ -128,7 +128,7 @@ $users = mysql_num_rows(mysql_query("SELECT SQL_CACHE * FROM ".TB_PREFIX."users"
echo "</tr>";
for($i=11; $i<21; $i++)
{
echo '<td class="on"><img src="../../'.GP_LOCATE.'img/u/'.$i.'.gif"></td>';
echo '<td class="on"><img src="../'.GP_LOCATE.'img/u/'.$i.'.gif"></td>';
}
echo '</thead><tbody>';
for($i=11; $i<21; $i++)
@@ -141,7 +141,7 @@ $users = mysql_num_rows(mysql_query("SELECT SQL_CACHE * FROM ".TB_PREFIX."users"
echo "</tr>";
for($i=21; $i<31; $i++)
{
echo '<td class="on"><img src="../../'.GP_LOCATE.'img/u/'.$i.'.gif"></td>';
echo '<td class="on"><img src="../'.GP_LOCATE.'img/u/'.$i.'.gif"></td>';
}
echo '</thead><tbody>';
for($i=21; $i<31; $i++)
@@ -154,7 +154,7 @@ $users = mysql_num_rows(mysql_query("SELECT SQL_CACHE * FROM ".TB_PREFIX."users"
echo "</tr>";
for($i=31; $i<41; $i++)
{
echo '<td class="on"><img src="../../'.GP_LOCATE.'img/u/'.$i.'.gif"></td>';
echo '<td class="on"><img src="../'.GP_LOCATE.'img/u/'.$i.'.gif"></td>';
}
echo '</thead><tbody>';
for($i=31; $i<41; $i++)
@@ -167,7 +167,7 @@ $users = mysql_num_rows(mysql_query("SELECT SQL_CACHE * FROM ".TB_PREFIX."users"
echo "</tr>";
for($i=41; $i<51; $i++)
{
echo '<td class="on"><img src="../../'.GP_LOCATE.'img/u/'.$i.'.gif"></td>';
echo '<td class="on"><img src="../'.GP_LOCATE.'img/u/'.$i.'.gif"></td>';
}
echo '</thead><tbody>';
for($i=41; $i<51; $i++)
+21 -8
View File
@@ -1,4 +1,5 @@
<?php
$place = $place1 = $place2 = $place3 = "?";
$db_host=SQL_SERVER; $db_user=SQL_USER; $db_pass=SQL_PASS; $db_name=SQL_DB;
$con = mysql_connect($db_host, $db_user, $db_pass);
@@ -13,7 +14,7 @@
mysql_select_db($db_name, $con);
$result = mysql_query("SELECT * FROM ".TB_PREFIX."alidata ORDER BY ap DESC Limit 10");
$result = mysql_query("SELECT * FROM ".TB_PREFIX."alidata ORDER BY ap DESC, id DESC Limit 10");
$result2 = mysql_query("SELECT * FROM ".TB_PREFIX."alidata WHERE id = '".$session->alliance."' ORDER BY ap DESC Limit 1");
?>
<table cellpadding="1" cellspacing="1">
@@ -40,6 +41,9 @@
<?php
while($row = mysql_fetch_array($result))
{
if($row['id']==$session->alliance) {
$place = $i;
}
if($row['id']==$session->alliance) {
echo "<tr class=\"own hl\">"; } else { echo "<tr>"; }
echo "<td class=\"ra fc\">".$i++.".&nbsp;</td>";
@@ -56,7 +60,7 @@
{
if($row['id'] == $session->alliance) {
echo "<tr class=\"none\">"; } else { echo "<tr class=\"own hl\">"; }
echo "<td class=\"ra fc\">?&nbsp;</td>";
echo "<td class=\"ra fc\">".$place."&nbsp;</td>";
if($row['id'] == $session->alliance) {
echo "<td class=\"pla\">".$row['tag']."</td>"; } else { echo "<td class=\"pla\"><a href='allianz.php?aid=".$row['id']."'>".$row['tag']."</a></td>"; }
echo "<td class=\"val lc\">".$row['ap']."</td>";
@@ -71,7 +75,7 @@
for($i=1;$i<=0;$i++) {
echo "Row ".$i;
}
$result = mysql_query("SELECT * FROM ".TB_PREFIX."alidata ORDER BY dp DESC Limit 10");
$result = mysql_query("SELECT * FROM ".TB_PREFIX."alidata ORDER BY dp DESC, id DESC Limit 10");
$result2 = mysql_query("SELECT * FROM ".TB_PREFIX."alidata WHERE id = '".$session->alliance."' ORDER BY dp DESC Limit 1");
?>
<table cellpadding="1" cellspacing="1" id="top10_defs" class="top10 row_table_data">
@@ -91,6 +95,9 @@
<?php
while($row = mysql_fetch_array($result))
{
if($row['id']==$session->alliance) {
$place1 = $i;
}
if($row['id']==$session->alliance) {
echo "<tr class=\"own hl\">"; } else { echo "<tr>"; }
echo "<td class=\"ra fc\">".$i++.".&nbsp;</td>";
@@ -108,7 +115,7 @@
{
if($row['id'] == $session->alliance) {
echo "<tr class=\"none\">"; } else { echo "<tr class=\"own hl\">"; }
echo "<td class=\"ra fc\">?&nbsp;</td>";
echo "<td class=\"ra fc\">".$place1."&nbsp;</td>";
if($row['id'] == $session->alliance) {
echo "<td class=\"pla\">".$row['tag']."</td>"; } else { echo "<td class=\"pla\"><a href='allianz.php?aid=".$row['id']."'>".$row['tag']."</a></td>"; }
echo "<td class=\"val lc\">".$row['dp']."</td>";
@@ -122,7 +129,7 @@
for($i=1;$i<=0;$i++) {
echo "Row ".$i;
}
$result = mysql_query("SELECT * FROM ".TB_PREFIX."alidata ORDER BY clp DESC Limit 10");
$result = mysql_query("SELECT * FROM ".TB_PREFIX."alidata ORDER BY clp DESC, id DESC Limit 10");
$result2 = mysql_query("SELECT * FROM ".TB_PREFIX."alidata WHERE id = '".$session->alliance."' ORDER BY clp DESC Limit 1");
?>
<div class="clear"></div>
@@ -143,6 +150,9 @@
<?php
while($row = mysql_fetch_array($result))
{
if($row['id']==$session->alliance) {
$place2 = $i;
}
if($row['id']==$session->alliance) {
echo "<tr class=\"own hl\">"; } else { echo "<tr>"; }
echo "<td class=\"ra fc\">".$i++.".&nbsp;</td>";
@@ -159,7 +169,7 @@
{
if($row['id'] == $session->alliance) {
echo "<tr class=\"none\">"; } else { echo "<tr class=\"own hl\">"; }
echo "<td class=\"ra fc\">?&nbsp;</td>";
echo "<td class=\"ra fc\">".$place2."&nbsp;</td>";
if($row['id'] == $session->alliance) {
echo "<td class=\"pla\">".$row['tag']."</td>"; } else { echo "<td class=\"pla\"><a href='allianz.php?aid=".$row['id']."'>".$row['tag']."</a></td>"; }
echo "<td class=\"val lc\">".$row['clp']."</td>";
@@ -172,7 +182,7 @@
for($i=1;$i<=0;$i++) {
echo "Row ".$i;
}
$result = mysql_query("SELECT * FROM ".TB_PREFIX."alidata ORDER BY RR DESC Limit 10");
$result = mysql_query("SELECT * FROM ".TB_PREFIX."alidata ORDER BY RR DESC, id DESC Limit 10");
$result2 = mysql_query("SELECT * FROM ".TB_PREFIX."alidata WHERE id = '".$session->alliance."' ORDER BY RR DESC Limit 1");
?>
<table cellpadding="1" cellspacing="1" id="top10_raiders" class="top10 row_table_data">
@@ -194,6 +204,9 @@
{
if($row['RR'] >= 0) {
if($row['id']==$session->alliance) {
$place3 = $i;
}
if($row['id']==$session->alliance) {
echo "<tr class=\"own hl\">"; } else { echo "<tr>"; }
echo "<td class=\"ra fc\">".$i++.".&nbsp;</td>";
echo "<td class=\"pla\"><a href='allianz.php?aid=".$row['id']."'>".$row['tag']."</a></td>";
@@ -210,7 +223,7 @@
{
if($row['id'] == $session->alliance) {
echo "<tr class=\"none\">"; } else { echo "<tr class=\"own hl\">"; }
echo "<td class=\"ra fc\">?&nbsp;</td>";
echo "<td class=\"ra fc\">".$place3."&nbsp;</td>";
if($row['id'] == $session->alliance) {
echo "<td class=\"pla\">".$row['tag']."</td>"; } else { echo "<td class=\"pla\"><a href='allianz.php?aid=".$row['id']."'>".$row['tag']."</a></td>"; }
echo "<td class=\"val lc\">".$row['RR']."</td>";
+37 -24
View File
@@ -1,4 +1,5 @@
<?php
$place = $place1 = $place2 = $place3 = "?";
$db_host=SQL_SERVER; $db_user=SQL_USER; $db_pass=SQL_PASS; $db_name=SQL_DB;
$con = mysql_connect($db_host, $db_user, $db_pass);
@@ -13,8 +14,8 @@
mysql_select_db($db_name, $con);
$result = mysql_query("SELECT * FROM ".TB_PREFIX."users WHERE access<".(INCLUDE_ADMIN?"10":"8")." AND id > 5 AND tribe<=3 AND tribe > 0 ORDER BY ap DESC Limit 10");
$result2 = mysql_query("SELECT * FROM ".TB_PREFIX."users WHERE username = '".$session->username."' ORDER BY ap DESC Limit 1");
$result = mysql_query("SELECT * FROM ".TB_PREFIX."users WHERE access<".(INCLUDE_ADMIN?"10":"8")." AND id > 5 AND tribe<=3 AND tribe > 0 ORDER BY ap DESC, id DESC Limit 10");
$result2 = mysql_query("SELECT * FROM ".TB_PREFIX."users WHERE id = '".$session->uid."' ORDER BY ap DESC Limit 1");
?>
<table cellpadding="1" cellspacing="1">
<thead>
@@ -40,7 +41,10 @@
<?php
while($row = mysql_fetch_array($result))
{
if($row['username']==$session->username) {
if($row['id']==$session->uid) {
if($row['id']==$session->uid) {
$place = $i;
}
echo "<tr class=\"own hl\">"; } else { echo "<tr>"; }
echo "<td class=\"ra fc\">".$i++.".&nbsp;</td>";
echo "<td class=\"pla\"><a href='spieler.php?uid=".$row['id']."'>".$row['username']."</a></td>";
@@ -54,10 +58,10 @@
<?php
while($row = mysql_fetch_array($result2))
{
if($row['username'] == $session->username) {
if($row['id'] == $session->uid) {
echo "<tr class=\"none\">"; } else { echo "<tr class=\"own hl\">"; }
echo "<td class=\"ra fc\">?&nbsp;</td>";
if($row['username'] == $session->username) {
echo "<td class=\"ra fc\">".$place."&nbsp;</td>";
if($row['id'] == $session->uid) {
echo "<td class=\"pla\">".$row['username']."</td>"; } else { echo "<td class=\"pla\"><a href='spieler.php?uid=".$row['id']."'>".$row['username']."</a></td>"; }
echo "<td class=\"val lc\">".$row['ap']."</td>";
echo "</tr>";
@@ -71,8 +75,8 @@
for($i=1;$i<=0;$i++) {
echo "Row ".$i;
}
$result = mysql_query("SELECT * FROM ".TB_PREFIX."users WHERE access<".(INCLUDE_ADMIN?"10":"8")." AND id > 5 AND tribe<=3 AND tribe > 0 ORDER BY dp DESC Limit 10");
$result2 = mysql_query("SELECT * FROM ".TB_PREFIX."users WHERE username = '".$session->username."' ORDER BY dp DESC Limit 1");
$result = mysql_query("SELECT * FROM ".TB_PREFIX."users WHERE access<".(INCLUDE_ADMIN?"10":"8")." AND id > 5 AND tribe<=3 AND tribe > 0 ORDER BY dp DESC, id DESC Limit 10");
$result2 = mysql_query("SELECT * FROM ".TB_PREFIX."users WHERE id = '".$session->uid."' ORDER BY dp DESC Limit 1");
?>
<table cellpadding="1" cellspacing="1" id="top10_defs" class="top10 row_table_data">
<thead>
@@ -91,7 +95,10 @@
<?php
while($row = mysql_fetch_array($result))
{
if($row['username']==$session->username) {
if($row['id']==$session->uid) {
$place1 = $i;
}
if($row['id']==$session->uid) {
echo "<tr class=\"own hl\">"; } else { echo "<tr>"; }
echo "<td class=\"ra fc\">".$i++.".&nbsp;</td>";
echo "<td class=\"pla\"><a href='spieler.php?uid=".$row['id']."'>".$row['username']."</a></td>";
@@ -106,10 +113,10 @@
<?php
while($row = mysql_fetch_array($result2))
{
if($row['username'] == $session->username) {
if($row['id'] == $session->uid) {
echo "<tr class=\"none\">"; } else { echo "<tr class=\"own hl\">"; }
echo "<td class=\"ra fc\">?&nbsp;</td>";
if($row['username'] == $session->username) {
echo "<td class=\"ra fc\">".$place1."&nbsp;</td>";
if($row['id'] == $session->uid) {
echo "<td class=\"pla\">".$row['username']."</td>"; } else { echo "<td class=\"pla\"><a href='spieler.php?uid=".$row['id']."'>".$row['username']."</a></td>"; }
echo "<td class=\"val lc\">".$row['dp']."</td>";
echo "</tr>";
@@ -122,8 +129,8 @@
for($i=1;$i<=0;$i++) {
echo "Row ".$i;
}
$result = mysql_query("SELECT * FROM ".TB_PREFIX."users WHERE access<".(INCLUDE_ADMIN?"10":"8")." AND id > 5 AND tribe<=3 AND tribe > 0 ORDER BY clp DESC Limit 10");
$result2 = mysql_query("SELECT * FROM ".TB_PREFIX."users WHERE username = '".$session->username."' ORDER BY clp DESC Limit 1");
$result = mysql_query("SELECT * FROM ".TB_PREFIX."users WHERE access<".(INCLUDE_ADMIN?"10":"8")." AND id > 5 AND tribe<=3 AND tribe > 0 ORDER BY clp DESC, id DESC Limit 10");
$result2 = mysql_query("SELECT * FROM ".TB_PREFIX."users WHERE id = '".$session->uid."' ORDER BY clp DESC Limit 1");
?>
<div class="clear"></div>
<table cellpadding="1" cellspacing="1" id="top10_climbers" class="top10 row_table_data">
@@ -143,7 +150,10 @@
<?php
while($row = mysql_fetch_array($result))
{
if($row['username']==$session->username) {
if($row['id']==$session->uid) {
$place2 = $i;
}
if($row['id']==$session->uid) {
echo "<tr class=\"own hl\">"; } else { echo "<tr>"; }
echo "<td class=\"ra fc\">".$i++.".&nbsp;</td>";
echo "<td class=\"pla\"><a href='spieler.php?uid=".$row['id']."'>".$row['username']."</a></td>";
@@ -157,10 +167,10 @@
<?php
while($row = mysql_fetch_array($result2))
{
if($row['username'] == $session->username) {
if($row['id'] == $session->uid) {
echo "<tr class=\"none\">"; } else { echo "<tr class=\"own hl\">"; }
echo "<td class=\"ra fc\">?&nbsp;</td>";
if($row['username'] == $session->username) {
echo "<td class=\"ra fc\">".$place2."&nbsp;</td>";
if($row['id'] == $session->uid) {
echo "<td class=\"pla\">".$row['username']."</td>"; } else { echo "<td class=\"pla\"><a href='spieler.php?uid=".$row['id']."'>".$row['username']."</a></td>"; } echo "<td class=\"val lc\">".$row['clp']."</td>";
echo "</tr>";
}
@@ -171,8 +181,8 @@
for($i=1;$i<=0;$i++) {
echo "Row ".$i;
}
$result = mysql_query("SELECT * FROM ".TB_PREFIX."users WHERE access<".(INCLUDE_ADMIN?"10":"8")." AND id > 5 AND tribe<=3 AND tribe > 0 ORDER BY RR DESC Limit 10");
$result2 = mysql_query("SELECT * FROM ".TB_PREFIX."users WHERE username = '".$session->username."' ORDER BY RR DESC Limit 1");
$result = mysql_query("SELECT * FROM ".TB_PREFIX."users WHERE access<".(INCLUDE_ADMIN?"10":"8")." AND id > 5 AND tribe<=3 AND tribe > 0 ORDER BY RR DESC, id DESC Limit 10");
$result2 = mysql_query("SELECT * FROM ".TB_PREFIX."users WHERE id = '".$session->uid."' ORDER BY RR DESC Limit 1");
?>
<table cellpadding="1" cellspacing="1" id="top10_raiders" class="top10 row_table_data">
<thead>
@@ -192,7 +202,10 @@
while($row = mysql_fetch_array($result))
{
if($row['RR'] >= 0) {
if($row['username']==$session->username) {
if($row['id']==$session->uid) {
$place3 = $i;
}
if($row['id']==$session->uid) {
echo "<tr class=\"own hl\">"; } else { echo "<tr>"; }
echo "<td>".$i++.".&nbsp;</td>";
echo "<td><a href='spieler.php?uid=".$row['id']."'>".$row['username']."</a></td>";
@@ -207,10 +220,10 @@
<?php
while($row = mysql_fetch_array($result2))
{
if($row['username'] == $session->username) {
if($row['id']==$session->uid) {
echo "<tr class=\"none\">"; } else { echo "<tr class=\"own hl\">"; }
echo "<td class=\"ra fc\">?&nbsp;</td>";
if($row['username'] == $session->username) {
echo "<td class=\"ra fc\">".$place3."&nbsp;</td>";
if($row['id']==$session->uid) {
echo "<td class=\"pla\">".$row['username']."</td>"; } else { echo "<td class=\"pla\"><a href='spieler.php?uid=".$row['id']."'>".$row['username']."</a></td>"; }
echo "<td class=\"val lc\">".$row['RR']."</td>";
echo "</tr>";
+5 -1
View File
@@ -24,13 +24,15 @@
array_unshift($units,$database->getUnit($vid));
echo '<tr class="'.$class.'"><td class="vil fc"><a href="dorf1.php?newdid='.$vid.'">'.$vil['name'].'</a></td>';
$movement = $database->getVillageMovement($vid);
for ($i=($session->tribe-1)*10+1; $i<=($session->tribe)*10; $i++) {
$uni['u'.$i] = 0;
foreach($units as $unit) {
$uni['u'.$i] += $unit['u'.$i];
$unit_total['u'.$i] += $unit['u'.$i];
}
$uni['u'.$i] += $movement['u'.$i];
$unit_total['u'.$i] += $movement['u'.$i];
if($uni['u'.$i] !=0){$cl = '';}else{$cl = 'none';}
echo '<td class="'.$cl.'">'.$uni['u'.$i].'</td>';
}
@@ -39,6 +41,8 @@
$uni['hero'] += $unit['hero'];
$unit_total['hero'] += $unit['hero'];
}
$uni['hero'] += $movement['hero'];
$unit_total['hero'] += $movement['hero'];
if($uni['hero'] !=0){$cl = '';}else{$cl = 'none';}
echo '<td class="'.$cl.'">'.$uni['hero'].'</td>';
echo '</tr>';