Quote:
Originally posted by TECK
Code:
function serveruptime() {
$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 = serveruptime();
$serverload = ' [Server Load: '.$regs[1].' : '.$regs[2].' : '.$regs[3].'][Server Uptime: ' . $serveruptime . ']';
} else {
$serverload = '';
}
|
TECK,
Why would it be a security risk for someone to read from the "/proc" in a *nix box? This is what my isp is telling me why they disabled this feature?
And if this is disabled, is it possible to get your hack to work with the other statistics (ex: MySQL - PHP - G-ZIP)?
Thanks in advance!