29 lines
1002 B
PHP
29 lines
1002 B
PHP
<?php
|
|
class RegionManager
|
|
{
|
|
private $allRegions = array();
|
|
|
|
function __construct($startRegion, $totalRegionCount)
|
|
{
|
|
global $RUNTIME;
|
|
|
|
$topRegionStatement = $RUNTIME['PDO']->prepare("SELECT regions.RegionName AS Name, regions.RegionUUID AS UUID, regions.RegionImage AS Image, regions.RegionOwner AS OwnerID, users.UserName AS OwnerName, onlinetimes.RegionLastSeen AS LastSeen, onlinetimes.RegionOnlineUser AS OnlineCount FROM regions INNER JOIN onlinetimes ON regions.RegionUUID = onlinetimes.RegionUUID INNER JOIN users ON regions.RegionOwner = users.UserUUID WHERE onlinetimes.RegionLastSeen > ? ORDER BY OnlineCount DESC LIMIT ".$startRegion.", ".$totalRegionCount);
|
|
$topRegionStatement->execute(array(time() - 320));
|
|
|
|
while($row = $topRegionStatement->fetch())
|
|
{
|
|
array_push($this->allRegions, $row);
|
|
}
|
|
}
|
|
|
|
function getRegionCount()
|
|
{
|
|
return count($this->allRegions);
|
|
}
|
|
|
|
function getNextRegion()
|
|
{
|
|
return array_shift($this->allRegions);
|
|
}
|
|
}
|
|
?>
|