Not really quite the best way to do it, here is a small upgrade;Quote:
[....]
PHP Code:
<?php
require_once('connect.php');
$mysqli = new mysqli($hostdb, $dbuser, $dbpass, $dbname); // this should be in connect.php
$serverport = "5816";
$serveraddress = $serverip;
$port = 9959;
$ip = $serverip;
//EDIT HERE!!!
$status = '1'; //1: Checks the port. 2: *NOT CODED* Checks database table for 1/0.
//EDIT HERE!!!
function countRows($table, $mysqli, $filter = "") {
$queryString = "SELECT count(*) FROM ".$table;
if(!empty($filter)) {
$queryString .= " WHERE ".$filter;
}
$query = $mysqli->query($queryString);
$rows = $query->num_rows;
return $rows;
}
if ($status == '1')
{
echo '<p class="offline"><font style="color: ">Accounts: <font style="color: green"><b>'.countRows("accounts", $mysqli).'</p></b></font>';
echo '<p class="offline"><font style="color: ">Characters: <font style="color: green"><b>'.countRows("entities", $mysqli).'</p></b></font>';
echo '<p class="offline"><font style="color: ">Online Players: <font style="color: green"><b>'.countRows("entities", $mysqli, "Online=1").'</p></b></font>';
require_once("inc/online.php");
}
else if ($status == '2')
{
echo "WORKED2";
}
else
{
echo "EDIT INC/SERVERSTATUS.PHP";
}
?>