远程关机,在MM面前显摆一次的机会,别错过 To Phper

文章是开了开源中国社区的一个兄弟写的,觉得他的思路很巧妙,利用wifi链接自己的PC的web服务器,然后提交表单,之后执行关机。

原文:手机远程关机

代码如下:

 1 <!DOCTYPE html>
 2 <html lang="zh-CN">
 3 <head>
 4     <title>computer-manager</title>
 5 </head>
 6 
 7 <body>
 8     <p>
 9 
10     <?php
11     if($_POST){
12         $shutdown = array(
13             'shutdown' =>'shutdown -s -t 0',
14             'restart' => 'shutdown -r',
15             'logout' => 'shutdown -l',
16         );
17 
18         $cmdk = $_POST['cmd'];
19         echo $cmd = $shutdown[$cmdk];
20         system($cmd); // 执行操作
21     }
22     ?>
23 
24     </p>
25 
26     <form action="#top" method="post">
27         <p>choose you want.</p>
28         <select name="cmd">
29             <option value="shutdown" selected="selected">shutdown/ go to sleep.</option>
30             <option value="restart">restart computer/ ok, if no password.</option>
31             <option value="logout">logout/ you don't want this.</option>
32         </select>
33         <input type="submit" name="submit" value="submit" />
34     </form>
35 </body>
36 </html>

 

posted @ 2013-04-16 20:46  Anleb  阅读(507)  评论(0编辑  收藏  举报