Example #1
0
function ServerStatsAndTime($format)
{
    ServerStats($format);
    echo '<BR><BR>
Total player-time:
<BR>';
    ServerTime($format);
}
Example #2
0
    global $TIME_REFRESH, $BASE_URL;
    $result = "";
    $hours = floor($PlayerMinutes / 60) % 24;
    $days = floor($PlayerMinutes / (60 * 24)) % 365;
    $years = floor($PlayerMinutes / (60 * 24 * 365));
    switch ($format) {
        case "minutes":
            $result = $PlayerMinutes;
            break;
        case "ajaxupdate":
            $data = json_encode(array("yr" => $years, "dy" => $days, "hr" => $hours));
            $result = $_GET['jsonp_callback'] . "(" . $data . ")";
            break;
        default:
            $result = "<span id=\"years\">{$years}</span> " . plural($years, "year") . ", ";
            $result .= "<span id=\"days\">{$days}</span> " . plural($days, "day") . ", ";
            $result .= "<span id=\"hours\">{$hours}</span> " . plural($hours, "hour") . "";
            $startscript = '<script type="text/javascript">' . "\n" . 'function uppt(){setTimeout(function (){jQuery.ajax({dataType: "jsonp",jsonp: "jsonp_callback",url: "' . $BASE_URL . 'servertime.php?format=ajaxupdate",success: function (data){jQuery("#years").empty().append(data.yr);jQuery("#days").empty().append(data.dy);jQuery("#hours").empty().append(data.hr);uppt();}});}, ' . 1000 * $TIME_REFRESH . ');}' . "\n" . 'jQuery(document).ready(function($){uppt();});</script>' . "\n";
            $result = $startscript . $result;
            break;
    }
    echo $result;
}
//If we were called directly
if (basename(__FILE__) == basename($_SERVER["SCRIPT_FILENAME"])) {
    $format = "";
    if (isset($_REQUEST["format"])) {
        $format = $_REQUEST["format"];
    }
    ServerTime($format);
}