1. <?php
2. /**
3. * 遠程啟動計算機
4. * 注意:iis/apache需要有windows/system/cmd.exe執行權限
5. *
6. **/
7. if (isset($_POST['cmd'])) {
8. $cmd= stripslashes( $_POST['cmd'] );
9. exec( $cmd,$out);
10. var_dump($out);
11. echo '<br>';
12. var_dump($cmd);
13. } else {
14. ?>
15. <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
16. <form action="index.php" method="post" name="form0" id="form0">
17. <p> </p>
18. <p align="center" >CMD</p>
19. <table width="200" border="0" align="center">
20. <tr>
21. <td width="81" height="18">選擇:</td>
22. <td width="109"><select name="cmd">
23. <option value="shutdown -r" selected="selected">重啟計算機</option>
24. <option value="shutdown -s">關閉計算機</option>
25. <option value="shutdown -l">注銷當前用戶</option>
26. </select></td>
27. </tr>
28. <tr>
29. <td> </td>
30. <td><input type="submit" name="Submit" value="提交" /></td>
31. </tr>
32. </table>
33. <p> </p>
34. </form> www.2cto.com
35. <?php
36. }
37. ?>