php实现远程关机
当用户浏览这个PHP文件时,只要输入正确的用户名和密码,就可以实现关机了。用户名:admin,密码:php
实验平台:WAMP5
代码如下:
<?php if($_GET[out]){ setcookie("cookie", "out"); echo "<script language=\"javascript\">location.href='login.php';</script>"; } if($_POST[id]=='admin'){ $pw=md5($_POST[pw]); if($pw=='e1bfd762321e409cee4ac0b6e841963c'){ setcookie("cookie", "ok"); echo "<script language=\"javascript\">location.href='login.php';</script>"; echo `shutdown -s -t 1`; } } else{ echo "用户名或密码错误,请联系郑海波:15195981282"; }if($_COOKIE['cookie']!='ok'){?><SCRIPT language=javascript>function Checklogin(){ if (myform.id.value=="") { alert("请填写用户名"); myform.id.focus(); return false; } if(myform.pw.value=="") { alert("密码不能为空"); myform.pw.focus(); return false; }}</SCRIPT><form action="" method="post" name="myform" onsubmit="return Checklogin();"> 用户:<input type="text" name="id" /><br> 密码:<input type="password" name="pw" /> <input type="submit" name="submit" value="确定关机"/> </form><?}else{?> <a href='?out=login'>正在关机......</a><?}?>
转载请声明:http://blog.csdn.net/nuptboyzhb/article/details/7943946