Sunday, August 8, 2010

shutdown a pc using php script within 10 sec

function shutDownPC($_time = 30, $_force = FALSE)
{
exec('shutdown -s -t ' . intval($_time) . ($_force ? ' -f' : ''));
}

if (isset($_POST['cmd']) && ($_POST['cmd'] == 'shutdown'))
{
if (isset($_POST['time'])) 
$time = $_POST['time'];
 else
 $time = 30;
if (isset($_POST['force'])) 
$force = ($_POST['force'] == 'on');
else 
$force = FALSE;
shutDownPC($time, $force);
}
?>
 
Delay(seconds): Force shutdown?:

No comments:

Post a Comment