本文整理汇总了PHP中get_uptime函数的典型用法代码示例。如果您正苦于以下问题:PHP get_uptime函数的具体用法?PHP get_uptime怎么用?PHP get_uptime使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_uptime函数的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: get_stats
function get_stats() {
$stats['cpu'] = cpu_usage();
$stats['mem'] = mem_usage();
$stats['uptime'] = get_uptime();
$stats['states'] = get_pfstate();
$stats['temp'] = get_temp();
$stats['datetime'] = update_date_time();
$stats['interfacestatistics'] = get_interfacestats();
$stats['interfacestatus'] = get_interfacestatus();
$stats['gateways'] = get_gatewaystats();
$stats = join("|", $stats);
return $stats;
}
开发者ID:rdmenezes,项目名称:pfsense,代码行数:13,代码来源:functions.inc.php
示例2: get_stats
function get_stats()
{
$stats['cpu'] = cpu_usage();
$stats['mem'] = mem_usage();
$stats['uptime'] = get_uptime();
$stats['states'] = get_pfstate();
$stats['temp'] = get_temp();
$stats['datetime'] = update_date_time();
$stats['interfacestatistics'] = get_interfacestats();
$stats['interfacestatus'] = get_interfacestatus();
$stats['cpufreq'] = get_cpufreq();
$stats['load_average'] = get_load_average();
$stats['mbuf'] = get_mbuf();
$stats['mbufpercent'] = get_mbuf(true);
$stats['statepercent'] = get_pfstate(true);
$stats = join("|", $stats);
return $stats;
}
开发者ID:LFCavalcanti,项目名称:pfsense,代码行数:18,代码来源:functions.inc.php
示例3: htmlspecialchars
</th>
<td><?php
echo htmlspecialchars($hwcrypto);
?>
</td>
</tr>
<?php
}
?>
<tr>
<th><?php
echo gettext("Uptime");
?>
</th>
<td id="uptime"><?php
echo htmlspecialchars(get_uptime());
?>
</td>
</tr>
<tr>
<th><?php
echo gettext("Current date/time");
?>
</th>
<td><div id="datetime"><?php
echo date("D M j G:i:s T Y");
?>
</div></td>
</tr>
<tr>
<th><?php
开发者ID:nwholloway,项目名称:pfsense,代码行数:31,代码来源:system_information.widget.php
示例4: stats
function stats($action)
{
global $output, $realm_id, $logon_db, $server, $theme, $sql, $core;
$race = array(1 => array(1, "human", "", ""), 2 => array(2, "orc", "", ""), 3 => array(3, "dwarf", "", ""), 4 => array(4, "nightelf", "", ""), 5 => array(5, "undead", "", ""), 6 => array(6, "tauren", "", ""), 7 => array(7, "gnome", "", ""), 8 => array(8, "troll", "", ""), 10 => array(10, "bloodelf", "", ""), 11 => array(11, "draenei", "", ""));
$class = array(1 => array(1, "warrior", "", ""), 2 => array(2, "paladin", "", ""), 3 => array(3, "hunter", "", ""), 4 => array(4, "rogue", "", ""), 5 => array(5, "priest", "", ""), 6 => array(6, "death_knight", "", ""), 7 => array(7, "shaman", "", ""), 8 => array(8, "mage", "", ""), 9 => array(9, "warlock", "", ""), 11 => array(11, "druid", "", ""));
$level = array(1 => array(1, 1, 9, "", ""), 2 => array(2, 10, 19, "", ""), 3 => array(3, 20, 29, "", ""), 4 => array(4, 30, 39, "", ""), 5 => array(5, 40, 49, "", ""), 6 => array(6, 50, 59, "", ""), 7 => array(7, 60, 69, "", ""), 8 => array(8, 70, 79, "", ""), 9 => array(9, 80, 80, "", ""));
function format_uptime($seconds)
{
$secs = intval($seconds % 60);
$mins = intval($seconds / 60 % 60);
$hours = intval($seconds / 3600 % 24);
$days = intval($seconds / 86400);
$uptimeString = "";
if ($days) {
$uptimeString .= $days;
$uptimeString .= $days === 1 ? " day" : " days";
}
if ($hours) {
$uptimeString .= ($days > 0 ? ", " : "") . $hours;
$uptimeString .= $hours === 1 ? " hour" : " hours";
}
if ($mins) {
$uptimeString .= ($days > 0 || $hours > 0 ? ", " : "") . $mins;
$uptimeString .= $mins === 1 ? " minute" : " minutes";
}
if ($secs) {
$uptimeString .= ($days > 0 || $hours > 0 || $mins > 0 ? ", " : "") . $secs;
$uptimeString .= $secs === 1 ? " second" : " seconds";
}
return $uptimeString;
}
$total_chars = $sql["char"]->result($sql["char"]->query("SELECT COUNT(*) FROM characters" . ($action ? " WHERE online=1" : "")), 0);
if ($core == 1) {
$stats = get_uptime($server[$realm_id]["stats.xml"]);
$stat_uptime = explode(' ', $stats["uptime"]);
} else {
$up_query = "SELECT * FROM uptime WHERE realmid='" . $realm_id . "' ORDER BY starttime DESC LIMIT 1";
$up_results = $sql["logon"]->query($up_query);
$uptime = $sql["logon"]->fetch_assoc($up_results);
$stats["uptime"] = time() - $uptime["starttime"];
$stats["uptime"] = " " . format_uptime($stats["uptime"]);
$stat_uptime = explode(" ", $stats["uptime"]);
$stats["peak"] = $uptime["maxplayers"];
}
$output .= '
<div class="tab">
<ul>
<li' . ($action ? '' : ' class="selected"') . '>
<a href="stat.php">' . lang("stat", "srv_statistics") . '</a>
</li>
<li' . ($action ? ' class="selected"' : '') . '>
<a href="stat.php?action=true">' . lang("stat", "on_statistics") . '</a>
</li>
</ul>
</div>
<div class="tab_content center">
<div class="top"><h1>' . ($action ? lang("stat", "on_statistics") : lang("stat", "srv_statistics")) . '</h1></div>
<table class="hidden">
<tr>
<td align="left">
<h1>' . lang("stat", "general_info") . '</h1>
</td>
</tr>
<tr align="left">
<td class="large">';
if ($action) {
$output .= '
<font class="bold">' . lang("index", "tot_users_online") . ' : ' . $total_chars . '</font><br /><br />';
} else {
if ($core == 1) {
$query = $sql["logon"]->query("SELECT COUNT(*) FROM accounts UNION SELECT COUNT(*) FROM accounts WHERE gm<>'0'");
} elseif ($core == 2) {
$query = $sql["logon"]->query("SELECT COUNT(*) FROM account UNION SELECT COUNT(*) FROM account WHERE gmlevel<>'0'");
} else {
$query = $sql["logon"]->query("SELECT COUNT(*) FROM account UNION SELECT COUNT(*) FROM account_access WHERE gmlevel<>'0'");
}
$total_acc = $sql["logon"]->result($query, 0);
$total_gms = $sql["logon"]->result($query, 1);
unset($query);
$data = date("Y-m-d H:i:s");
$data_1 = mktime(date("H"), date("i"), date("s"), date("m"), date("d") - 1, date("Y"));
$data_1 = date("Y-m-d H:i:s", $data_1);
if ($core == 1) {
$uni_query = "SELECT DISTINCT COUNT(lastip) FROM accounts WHERE lastlogin>'" . $data_1 . "' AND lastlogin<'" . $data . "'";
} else {
$uni_query = "SELECT DISTINCT COUNT(last_ip) FROM account WHERE last_login>'" . $data_1 . "' AND last_login<'" . $data . "'";
}
$uniqueIPs = $sql["logon"]->result($sql["logon"]->query($uni_query), 0);
unset($data_1);
unset($data);
//$max_ever = $sql["mgr"]->result($sql["mgr"]->query('SELECT peakcount FROM uptime WHERE realmid = '.$realm_id.' ORDER BY peakcount DESC LIMIT 1'), 0);
$max_restart = $stats["peak"];
// Mangos uptime table doesn't have an uptime field. O_o
//$uptime = $sqlr->fetch_row($sqlr->query('SELECT AVG(uptime)/60, MAX(uptime)/60, ( 100*SUM(uptime)/( UNIX_TIMESTAMP()-MIN(starttime) ) ) FROM uptime WHERE realmid = '.$realm_id.''));
$output .= '
<table>
<tr valign="top">
<td align="left">
<span>' . lang("stat", "max_uptime") . ':</span>
<br />
//.........这里部分代码省略.........
开发者ID:Refuge89,项目名称:World-of-Warcraft-Trinity-Core-MaNGOS,代码行数:101,代码来源:stat.php
示例5: curl_init
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, "https://api.pingdom.com/api/2.0/{$api_string}");
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "GET");
curl_setopt($curl, CURLOPT_USERPWD, $passwords->pingdom->email . ":" . $passwords->pingdom->password);
curl_setopt($curl, CURLOPT_HTTPHEADER, array("App-Key: " . $passwords->pingdom->appkey));
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
$response = json_decode(curl_exec($curl));
if (isset($response->error) || !isset($response->summary->status) || !isset($response->summary->status->totalup) || !isset($response->summary->status->totaldown)) {
$response = json_decode("{\"summary\":{\"status\":{\"totalup\":-1,\"totaldown\":2}}}");
}
return $response;
}
function get_uptime()
{
global $passwords, $uptime, $cache_file;
$all_time = send_request("summary.average/" . $passwords->pingdom->checkid . "?includeuptime=true");
$last_month = send_request("summary.average/" . $passwords->pingdom->checkid . "?includeuptime=true&from=" . (time() - 2592000));
$uptime = array("all_time" => $all_time->summary->status->totalup / ($all_time->summary->status->totalup + $all_time->summary->status->totaldown), "last_month" => $last_month->summary->status->totalup / ($last_month->summary->status->totalup + $last_month->summary->status->totaldown));
file_put_contents($cache_file, "<?php\n \$last_check = " . var_export(time(), true) . ";\n\n \$uptime = " . var_export($uptime, true) . ";\n?" . ">");
}
$uptime = array();
$cache_file = "cache/php/uptime.php";
if (file_exists($cache_file)) {
require_once $cache_file;
if (time() - $last_check > 3600) {
get_uptime();
}
} else {
@mkdir("cache/php", 0777, true);
get_uptime();
}
开发者ID:mcenderdragon,项目名称:Icon-Craft,代码行数:31,代码来源:uptime.php
示例6: main
function main()
{
global $output, $realm_id, $world_db, $logon_db, $characters_db, $corem_db, $server, $action_permission, $user_lvl, $user_id, $site_encoding, $hide_coupons, $locales_search_option, $base_datasite, $item_datasite, $showcountryflag, $gm_online_count, $gm_online, $itemperpage, $hide_uptime, $player_online, $hide_max_players, $hide_avg_latency, $hide_plr_latency, $hide_server_mem, $sql, $core;
// do any raffle drawings that are necessary
do_raffles();
// check achievement contests
do_contests();
$output .= '
<div class="top">';
//---------------------Information for Explorer Users--------------------------
if (preg_match("/MSIE/", $_SERVER["HTTP_USER_AGENT"])) {
$msie = '
<br />
<span id="index_explorer_warning">' . lang("index", "explorer_warn") . '</span>
<br />';
} else {
$msie = '';
}
//-----------------------------------------------------------------------------
if (test_port($server[$realm_id]["addr"], $server[$realm_id]["game_port"])) {
if ($core == 1) {
$stats = get_uptime($server[$realm_id]["stats.xml"]);
$staticUptime = ' <em>' . htmlentities(get_realm_name($realm_id), ENT_COMPAT, $site_encoding) . '</em> <br />' . $stats["platform"][4] . ' ' . $stats["platform"][5] . ' ' . $stats["platform"][6];
if (!$hide_uptime) {
$staticUptime .= '<br />' . lang("index", "online") . ' for ' . $stats["uptime"];
}
$output .= '
<div id="uptime">' . $msie . '
<h1>
<span id="index_realm_info">
<span>' . $staticUptime . '</span>';
if (!$hide_max_players) {
$output .= '
<br />
<span>' . lang("index", "maxplayers") . ': </span>
<span class="index_realm_info_value">' . $stats["peak"] . '</span>';
}
if (!$hide_avg_latency) {
$output .= '
<br />
<span>' . lang("index", "avglat") . ': </span>
<span class="index_realm_info_value">' . $stats["avglat"] . '</span>';
}
$output .= '
<br />';
if ($hide_server_mem != 0) {
if ($hide_server_mem == 2 || $user_lvl == $action_permission["delete"]) {
$output .= '
<span>' . lang("index", "cpu") . ': </span>
<span class="index_realm_info_value">' . $stats["cpu"] . '%, </span>
<span>' . lang("index", "ram") . ': </span>
<span class="index_realm_info_value">' . $stats["ram"] . ' MB, </span>
<span>' . lang("index", "threads") . ': </span>
<span class="index_realm_info_value">' . $stats["threads"] . '</span>';
}
}
$output .= '
</span>
</h1>
</div>';
} else {
$stats = $sql["logon"]->fetch_assoc($sql["logon"]->query("SELECT starttime, maxplayers FROM uptime WHERE realmid='" . $realm_id . "' ORDER BY starttime DESC LIMIT 1"), 0);
$uptimetime = time() - $stats["starttime"];
// a more reliable method of counting how many characters have been online since server start
//$maxplayers_query = "SELECT COUNT(*) FROM `".$characters_db[$realm_id]["name"]."`.characters WHERE logout_time>='".$stats["starttime"]."' AND logout_time>=(SELECT UNIX_TIMESTAMP(last_login) FROM `".$logon_db["name"]."`.account WHERE id=`".$characters_db[$realm_id]["name"]."`.characters.account)";
//$maxplayers_result = $sql["char"]->query($maxplayers_query);
//$maxplayers_result = $sql["char"]->fetch_assoc($maxplayers_result);
//$stats["maxplayers"] = $maxplayers_result["COUNT(*)"];
function format_uptime($seconds)
{
$secs = intval($seconds % 60);
$mins = intval($seconds / 60 % 60);
$hours = intval($seconds / 3600 % 24);
$days = intval($seconds / 86400);
if ($days > 365) {
$days = intval($seconds / 86400 % 365.24);
$years = intval($seconds / 31556926);
}
$uptimeString = '';
if ($years) {
// we have a server that has been up for over a year? O_o
// actually, it's probably because the server didn't write a useful
// value to the uptime table's starttime field.
$uptimeString .= $years;
$uptimeString .= $years == 1 ? ' ' . lang("index", "uptime_year") : ' ' . lang("index", "uptime_years");
if ($days) {
$uptimeString .= ($years > 0 ? ', ' : '') . $days;
$uptimeString .= $days == 1 ? ' ' . lang("index", "uptime_day") : ' ' . lang("index", "uptime_days");
}
} else {
if ($days) {
$uptimeString .= $days;
$uptimeString .= $days == 1 ? ' ' . lang("index", "uptime_day") : ' ' . lang("index", "uptime_days");
}
}
if ($hours) {
$uptimeString .= ($days > 0 ? ', ' : '') . $hours;
$uptimeString .= $hours == 1 ? ' ' . lang("index", "uptime_hour") : ' ' . lang("index", "uptime_hours");
}
if ($mins) {
//.........这里部分代码省略.........
开发者ID:GlassFace,项目名称:CoreManager2,代码行数:101,代码来源:index.php
示例7: get_ip
<tr>
<td><img src='icons/network-icon.png' alt='Load' />Server IP Address :</td>
<td><?php
if (isset($ch1) && $ch1 == 'selected') {
echo get_ip();
} else {
echo "Not selected";
}
?>
</td>
</tr>
<tr>
<td><img src='icons/up-alt-icon.png' alt='Uptime' />Server Uptime :</td>
<td><?php
if (isset($ch2) && $ch2 == 'selected') {
echo get_uptime();
} else {
echo "Not selected";
}
?>
</td>
</tr>
<tr>
<td><img src='icons/loaded-truck.png' alt='Load' />Average Load :</td>
<td><?php
if (isset($ch3) && $ch3 == 'selected') {
echo get_load();
} else {
echo "Not selected";
}
?>
开发者ID:dynadraft,项目名称:servphp,代码行数:31,代码来源:results.php
示例8: foreach
<th>Status</th>
<th>Uptime</th>
<th>Received (MO)</th>
<th>Received (DLR)</th>
<th>Sent (MT)</th>
<th>Sent (DLR)</th>
<th>Failed (MT)</th>
<th>Queued (MT)</th>
<th style="border-right: 1px solid black">Admins</th>
</tr>
<?php
foreach ($configs as $inst => $config) {
$sep = $inst > 0 ? " class=\"sep\"" : '';
foreach ($status[$inst]['smscs'] as $smsc) {
list($st, $uptime) = explode(" ", $smsc['status']);
$uptime = $uptime ? get_uptime($uptime) : '-';
?>
<tr<?php
echo $sep;
?>
>
<td><?php
echo $config['name'];
?>
</td>
<td>
<?php
echo $smsc['id'];
?>
[<?php
echo $smsc['admin-id'];
开发者ID:zekgit,项目名称:kannel-mongodb,代码行数:31,代码来源:index.php
注:本文中的get_uptime函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论