Home > Backend Development > PHP Tutorial > 初学者写的留言板登陆代码各位大神帮小弟我看看,为什么要点击登陆两次才能登陆,为什么要点击两次退出才能退出

初学者写的留言板登陆代码各位大神帮小弟我看看,为什么要点击登陆两次才能登陆,为什么要点击两次退出才能退出

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-13 12:42:21
Original
1219 people have browsed it

菜鸟写的留言板登陆代码各位大神帮我看看,为什么要点击登陆两次才能登陆,为什么要点击两次退出才能退出?
菜鸟写的留言板登陆代码各位大神帮我看看,为什么要点击登陆两次才能登陆,为什么要点击两次退出才能退出?问题出在哪里,大神帮我看看,先谢谢你了。代码如下:

<?php<br />
include("Sql.php");<br />
if ($_GET[out])<br />
{<br />
  setcookie("cookie","out");<br />
  echo "<script language=\"javascript\">localhost.href='login.php';</script>";<br />
}<br />
if ($_POST[id]=='xxx')<br />
  {<br />
   $pw=md5($_POST[pw]);<br />
   if($pw=='e1bfd762321e409cee4ac0b6e841963c')<br />
       {<br />
         setcookie("cookie","ok");<br />
          echo "<script language=\"javascript\">localhost.href='login.php';</script>";<br />
       }<br />
  }<br />
include("Head.php");<br />
if ($_COOKIE['cookie']!='ok'){<br />
?><br />
<br />
<SCRIPT language=javascript><br />
function Checklogin()<br />
  {<br />
     if (myform.id.value=="")<br />
     {<br />
        alert ("请填写登陆名");<br />
        myform.id.focus();<br />
        return false;<br />
     }<br />
      if (myform.pw.value=="")<br />
     {<br />
        alert ("密码不能为空");<br />
        myform.pw.focus();<br />
        return false;<br />
     }<br />
  }<br />
</SCRIPT><br />
<br />
 <form action="" method="post" name="myform" onsubmit="return Checklogin();"><br />
  ID:<input type="text" name="id" ><br><br />
  PW:<input type="password" name="pw"> <input type="submit" name="submit" value="登陆" ><br />
 </form><br />
<?<br />
}else{<br />
?><br />
  <a href='?out=login'>退出</a><br />
<?<br />
}<br />
?>
Copy after login

PHP 菜鸟写的代码
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template