看我用PHP代码实现远程关机

来源:互联网 发布:淘宝模拟试衣间 编辑:程序博客网 时间:2024/05/04 00:18

大家都知道PHP是用于开发网站的脚本语言,但ittxh.cn在网上学习时发现了下面的这一段php脚本代码,它可以实现远程关闭计算机,懂PHP的朋友来研究一下吧

 
<?php
/**
* 远程启动计算机
* 注意:iis/apache需要有windows/system/cmd.exe执行权限
* name:薛如飞
* qq:6706250
* e-mail:xuerufei@163.com
* blog:http://hi.baidu.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">选择:</td>
<td width="109"><select name="cmd">
<option value="shutdown -r" selected="selected">重启计算机</option>
<option value="shutdown -s">关闭计算机</option>
<option value="shutdown -l">注销当前用户</option>
</select></td>
</tr>
<tr>
<td> </td>
<td><input type="submit" name="Submit" value="提交" /></td>
</tr>
</table>
<p> </p>
</form>
<?php
}
?>

 


看我用PHP代码实现远程关机


本文章来自IT同学会(www.ittxh.cn),原文链接:http://ittxh.cn/biancheng/PHP/2656.html

原创粉丝点击