Quote:
Originally posted by Sebastian
doesn't work... still get the redeclare error.
Fatal error: Cannot redeclare serveruptime() in /home/www/html/forum/admin/functions.php on line 518
|
Aha, you probably have my admin hack installed.
Code:
function uptime() {
$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 != 1 ) {
$value = $days . ' days, ';
} else {
$value = $days . ' day, ';
}
if ( $hours != 1 ) {
$value .= $hours . ' hours and ';
} else {
$value .= $hours . ' hour and ';
}
if ( $min != 1 ) {
$value .= $min . ' minutes';
} else {
$value .= $min . ' minute';
}
return $value;
}
if ( $stats = @exec( 'uptime' ) ) {
preg_match( '/averages?: ([0-9\.]+),[\s]+([0-9\.]+) , [\s]+([0-9\.]+)/' , $stats , $regs );
$serveruptime = uptime();
$serverload = ' [Server Load: '.$regs[1].' : '.$regs[2].' : '.$regs[3].'][Server Uptime: ' . $serveruptime . ']';
} else {
$serverload = '';
}