0) { $uptimeString .= $days; $uptimeString .= (($days == 1) ? " day" : " days"); } if ($hours > 0) { $uptimeString .= (($days > 0) ? ", " : "") . $hours; $uptimeString .= ((hours == 1) ? " hour" : " hours"); } if ($mins > 0) { $uptimeString .= (($days > 0 || $hours > 0) ? ", " : "") . $mins; $uptimeString .= (($mins == 1) ? " minute" : " minutes"); } if ($secs > 0) { $uptimeString .= (($days > 0 || $hours > 0 || $mins > 0) ? ", " : "") . $secs; $uptimeString .= (($secs == 1) ? " second" : " seconds"); } return $uptimeString; } // get the server statistics with "net statistics server" by shell_exec $winstats = shell_exec("net statistics server"); // grab the date & time the server started up preg_match("(\d{1,2}/\d{1,2}/\d{4}\s+\d{1,2}\:\d{2}\s+\w{2})", $winstats, $matches); // convert the readable date & time to a timestamp and deduct it from the current timestamp // thus giving us the total uptime in seconds $uptimeSecs = time() - strtotime($matches[0]); // get the static uptime $staticUptime = "Server Uptime: ".format_uptime($uptimeSecs); ?>