Code: Alles auswählen
Time : 0.265s | 28 Queries | GZIP : On
The server last rebooted 12 days, 17 hours, 58 minutes, 1 second ago.
Code: Alles auswählen
Time : 0.265s | 28 Queries | GZIP : On
The server last rebooted 12 days, 17 hours, 58 minutes, 1 second ago.
Code: Alles auswählen
<?php
function uptime() {
//Script zum auslesen der Uptime
if( $fd = @fopen('/proc/uptime', 'r')) {
$ar_buf = split(' ', fgets($fd, 4096));
fclose($fd);
$sys_ticks = trim($ar_buf[0]);
$min = $sys_ticks / 60;
$hours = $min / 60;
$days = floor($hours / 24);
$hours = floor($hours - ($days * 24));
$min = floor($min - ($days * 60 * 24) - ($hours * 60));
if ($days != 0) {
$result = $days."d ";
}
if ($hours != 0) {
$result .= $hours."h ";
}
$result .= $min ."m";
} else {
$result = "n/a";
}
return $result;
}
function loadavg() {
//Funktion zum auslesen der Server
if ($fd = @fopen('/proc/loadavg', 'r')) {
$results = split(' ', fgets($fd, 4096));
fclose($fd);
} else {
$results = array('N.A.','N.A.','N.A.');
}
return $results;
}
$uptime=uptime();
$loadavg=loadavg();
echo("» Uptime: " . $uptime . "<br>");
echo("» Serverauslastung: " . $loadavg[0]. "<br>");
?>
Code: Alles auswählen
<!-- IF DEBUG_OUTPUT --><br />{DEBUG_OUTPUT}<!-- ENDIF -->
Code: Alles auswählen
<!-- IF SCRIPT_NAME == "index" --><div>{L_UPTIME} {UPTIME}</div>
<div>{L_LOADAVERAGE} {LOADAVERAGE}</div><!-- ENDIF -->
Code: Alles auswählen
// Start session management
$user->session_begin();
$auth->acl($user->data);
$user->setup('viewforum');
Code: Alles auswählen
$user->setup('mods/uptime'); // Sprachvariablen aus eigener Sprachdatei laden
Code: Alles auswählen
'U_MCP' => ($auth->acl_get('m_') || $auth->acl_getf_global('m_')) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=main&mode=front', true, $user->session_id) : '')
);
Code: Alles auswählen
//Uptime
function uptime() {
//Script zum auslesen der Uptime
if( $fd = @fopen('/proc/uptime', 'r')) {
$ar_buf = split(' ', fgets($fd, 4096));
fclose($fd);
$sys_ticks = trim($ar_buf[0]);
$min = $sys_ticks / 60;
$hours = $min / 60;
$days = floor($hours / 24);
$hours = floor($hours - ($days * 24));
$min = floor($min - ($days * 60 * 24) - ($hours * 60));
if ($days != 0) {
$result = $days."d ";
}
if ($hours != 0) {
$result .= $hours."h ";
}
$result .= $min ."m";
} else {
$result = "n/a";
}
return $result;
}
function loadavg() {
//Funktion zum auslesen der Server
if ($fd = @fopen('/proc/loadavg', 'r')) {
$results = split(' ', fgets($fd, 4096));
fclose($fd);
} else {
$results = array('N.A.','N.A.','N.A.');
}
return $results;
}
$uptime = uptime();
$loadavg = loadavg();
// Ein typischer Gebrauch um Variablen an das Template zu senden.
$template->assign_vars(array(
'UPTIME' => $uptime,
'LOADAVERAGE' => $loadavg[0],
));
//End Uptime
Code: Alles auswählen
<?php
/**
*
* groups [German]
*
* @author Autor Mahony - http://phpbb3.pytalhost.com
*
* @package language
* @version $Id$
* @copyright (c) 2012 Mahony
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
*/
/**
* DO NOT CHANGE
*/
if (!defined('IN_PHPBB'))
{
exit;
}
if (empty($lang) || !is_array($lang))
{
$lang = array();
}
// DEVELOPERS PLEASE NOTE
//
// All language files should use UTF-8 as their encoding and the files must not contain a BOM.
//
// Placeholders can now contain order information, e.g. instead of
// 'Page %s of %s' you can (and should) write 'Page %1$s of %2$s', this allows
// translators to re-order the output of data while ensuring it remains correct
//
// You do not need this where single placeholders are used, e.g. 'Message %d' is fine
// equally where a string contains only two placeholders which are used to wrap text
// in a url you again do not need to specify an order e.g., 'Click %sHERE%s' is fine
$lang = array_merge($lang, array(
'UPTIME' => 'Betriebszeit:',
'LOADAVERAGE' => 'Serverauslastung:',
));
?>