<?php
// function to calculate uptime (copyrighted to phpsysinfo.sf.net)
function calcuptime() {
global $CMD_CAT;
$uptime = '';
$buf = exec("$CMD_CAT /proc/uptime");
$ar_buf = split( ' ', $buf );
$timestamp = trim( $ar_buf[0] );
$min = $timestamp / 60;
$hours = $min / 60;
$days = floor($hours / 24);
$hours = floor($hours - ($days * 24));
$min = floor($min - ($days * 60 * 24) - ($hours * 60));
if ($days != 0) {
$uptime .= $days. " days ";
}
if ($hours != 0) {
$uptime .= $hours . " hours ";
}
$uptime .= $min . " minutes";
return $uptime;
}
?>