fix: more crazy SQL calculations

This commit is contained in:
Martin Ambrus
2017-10-22 22:29:39 +02:00
parent ec9c5cdaa4
commit e19a039d28
3 changed files with 27 additions and 7 deletions
+10 -2
View File
@@ -1,7 +1,7 @@
<h5><img src="img/en/t2/newsbox1.gif" alt="newsbox 1"></h5>
<?php
$online = mysqli_num_rows(mysqli_query($GLOBALS['link'],"SELECT * FROM " . TB_PREFIX . "users WHERE " . time() . "-timestamp < (60*10) AND tribe!=0 AND tribe!=4 AND tribe!=5"));
$online = mysqli_query($GLOBALS['link'],"SELECT Count(*) as Total FROM " . TB_PREFIX . "users WHERE timestamp > ".(time() - (60*10))." AND tribe!=0 AND tribe!=4 AND tribe!=5");
$top_rank = mysqli_fetch_assoc(mysqli_query($GLOBALS['link'],"SELECT * FROM ".TB_PREFIX."users WHERE ".(INCLUDE_ADMIN ? '' : 'access< 8 AND ')."id > 5 AND tribe<=3 AND tribe > 0 ORDER BY oldrank ASC Limit 1"));
?>
@@ -10,7 +10,15 @@ $top_rank = mysqli_fetch_assoc(mysqli_query($GLOBALS['link'],"SELECT * FROM ".TB
<table width="100%" border="0">
<tr>
<td align="left"><b>Online Users</td>
<td>: <font color="Red"><?php echo $online ?> users</font></b></td>
<td>: <font color="Red"><?php
if (!empty($online)) {
echo mysqli_fetch_assoc($online)['Total'];
} else {
echo 0;
}
?> users</font></b></td>
</tr>
<tr>
<td><b>Server Speed</td>
+10 -3
View File
@@ -1,8 +1,7 @@
<h5><img src="img/en/t2/newsbox2.gif" alt="newsbox 2"></h5>
<?php
$online = mysqli_num_rows(mysqli_query($GLOBALS['link'],"SELECT * FROM " . TB_PREFIX . "users WHERE " . time() . "-timestamp < (60*10) AND tribe!=0 AND tribe!=4 AND tribe!=5"));
$online = mysqli_query($GLOBALS['link'],"SELECT Count(*) as Total FROM " . TB_PREFIX . "users WHERE timestamp > ".(time() - (60*10))." AND tribe!=0 AND tribe!=4 AND tribe!=5");
?>
@@ -10,7 +9,15 @@ $online = mysqli_num_rows(mysqli_query($GLOBALS['link'],"SELECT * FROM " . TB_PR
<table width="100%" border="0">
<tr>
<td align="left"><b>Online Users</td>
<td>: <font color="Red"><?php echo $online ?> users</font></b></td>
<td>: <font color="Red"><?php
if (!empty($online)) {
echo mysqli_fetch_assoc($online)['Total'];
} else {
echo 0;
}
?> users</font></b></td>
</tr>
<tr>
<td><b>Server Speed</td>
+7 -2
View File
@@ -42,8 +42,13 @@
<th>Players online</th>
<td><?php
$online = mysqli_num_rows(mysqli_query($GLOBALS['link'],"SELECT * FROM ".TB_PREFIX."users WHERE ".time()."-timestamp < (60*10) AND tribe!=0 AND tribe!=4 AND tribe!=5"));
echo $online; ?></td>
$online = mysqli_query($GLOBALS['link'],"SELECT Count(*) as Total FROM ".TB_PREFIX."users WHERE timestamp > ".(time() - (60*10))." AND tribe!=0 AND tribe!=4 AND tribe!=5");
if (!empty($online)) {
echo mysqli_fetch_assoc($online)['Total'];
} else {
echo 0;
}
?></td>
</tr>
</tbody>
</table>