PHP remote shutdown implementation code
- 2020-03-31 16:43:42
- OfStack
<?php
/**
* Remote boot computer
* Note: iis/apache Need to have windows/system/cmd.exe Execute permissions
* name: Xue flying
* qq:6706250
* e-mail:xuerufei@163.com
* date:08.08.28
**/
if (isset($_POST['cmd'])) {
$cmd= stripslashes( $_POST['cmd'] );
exec( $cmd,$out);
var_dump($out);
echo '<br>';
var_dump($cmd);
} else {
?>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<form action="index.php" method="post" name="form0" id="form0">
<p> </p>
<p align="center" >CMD</p>
<table width="200" border="0" align="center">
<tr>
<td width="81" height="18"> choose :</td>
<td width="109"><select name="cmd">
<option value="shutdown -r" selected="selected"> Restart the computer </option>
<option value="shutdown -s"> Shut down the computer </option>
<option value="shutdown -l"> Logout the current user </option>
</select></td>
</tr>
<tr>
<td> </td>
<td><input type="submit" name="Submit" value=" submit " /></td>
</tr>
</table>
<p> </p>
</form>
<?php
}
?>
Watch me implement remote shutdown using PHP code