- <!DOCTYPE html>
- <html lang="zh-CN">
- <head>
- <title>computer-manager</title>
- </head>
- <body>
- <p>
- <?php
- if($_POST){
- $shutdown = array(
- 'shutdown' =>'shutdown -s -t 0',
- 'restart' => 'shutdown -r',
- 'logout' => 'shutdown -l',
- );
- $cmdk = $_POST['cmd'];
- echo $cmd = $shutdown[$cmdk];
- system($cmd); // 执行操作
- }
- ?>
- </p>
- <form action="#top" method="post">
- <p>choose you want.</p>
- <select name="cmd">
- <option value="shutdown" selected="selected">shutdown/ go to sleep.</option>
- <option value="restart">restart computer/ ok, if no password.</option>
- <option value="logout">logout/ you don't want this.</option>
- </select>
- <input type="submit" name="submit" value="submit" />
- </form>
- </body>
- </html>
- //该片段来自于http://www.codesnippet.cn/detail/301020136810.html
来源: http://www.codesnippet.cn/detail/301020136810.html