şu sayfada örnek uygulama var

http://www.4webhelp.net/scripts/php/uptime.php


###########################################################################
# #
# Copyright © http://www.4webhelp.net/ #
# Neither http://www.4webhelp.net/ nor its members accept any #
# responsibility, either expressed or implied, for any damage caused by #
# using this script or the misuse of this script. #
# #
# #
# INSTRUCTIONS #
# #
# 1) Copy this code to an editor such as Notepad and save it with a #
# .php extension. #
# 2) FTP this file to a folder on your site in ASCII mode #
# 3) Call up this file in your web browser to see your server's uptime #
# #
###########################################################################

$data = shell_exec('uptime');
$uptime = explode(' up ', $data);
$uptime = explode(',', $uptime[1]);
$uptime = $uptime[0].', '.$uptime[1];

echo ('Current server uptime: '.$uptime.'
');

?>

This script courtesy of 4WebHelp.


Latest comments
Max
thanks guys
hehehe
here is mine for Windows Server 2003, tested and works just fine, its based on another comment here Smile

i had to download the uptime.exe from ms, just search for it on their site..


Uptime.php:
$server = $_POST['server'];

// only digits
$pattern = '/[^0-9]/';
?>


Uptime




$uptime = `c:\windows\system32\uptime2.bat $server`;
$uptime = explode(": ", $uptime);
$uptime = explode(", ", $uptime[1]);

$uptime_days = preg_replace($pattern, '', $uptime[0]);
$uptime_hours = preg_replace($pattern, '', $uptime[1]);
$uptime_minutes = preg_replace($pattern, '', $uptime[2]);
$uptime_seconds = preg_replace($pattern, '', $uptime[3]);



echo 'Uptime:

';

echo 'Days: '.$uptime_days.'
';
echo 'Hours: '.$uptime_hours.'
';
echo 'Minutes: '.$uptime_minutes.'
';
echo 'Seconds: '.$uptime_seconds.'
';
?>