About form and php data exchange issues
haha
haha 2019-04-26 21:43:29
0
0
988

This large piece of code was able to run normally in 2013, when I was using Windows XP. Now I take out this code and want to modify it before using it. This code is to stay on the current login page when the id and password are not entered. When the id and password are entered in the form, the id and password are checked from the database. If they are correct, the code enters the main page. But now after reinstalling the new version of appserv, the system is win10. I found that when the id and password are not set, I can enter the part where the if(!isset($id)&&!isset($password)) condition is established, but even if I enter the id and password It is also impossible to enter the else part of if(!isset($id)&&!isset($password)).

Please help me find out whether the system or PHP has been upgraded or whether it is caused by other problems. Thank you.

<?php
//Login interface
if(!isset($id)&&!isset($password))
{
? >
<body>
<!-- start page -->
<div id="page">
<!-- start content -->
<div id="content">
<div class="post">
<h1 class="title">ITT 866 barcode link</h1>
<div class="entry">
; <p></p>
; <div class="password"><p></div></p>
        <div class="list">
                                                                                                >
                                                                 div>
</div>
 <!-- end content -->
 <!-- start sidebar -->

 <div id="sidebar">
  <ul>
   <li id="search">
    <h2>Login</h2>
    <form method="post" action="login.php">
     <fieldset>
     <p>ID:</font></p><input type="text" id="s" name="id" maxlength="10"/>
     <p>Password:</p><input type="password" id="s" name="password" maxlength="8"/>
     <input type="submit" id="x" value="Login" />
     </fieldset>
    </form>
    <table><tr>
    </tr></table>
   </li>
  </ul>
 </div>
 <!-- end sidebar -->
 <div style="clear: both;"> </div>
</div>
<!-- end page -->
<?php
}
else
{
 //帐号不为5位时
  if(strlen($id)<5)
 {
  echo "<script language=\"javascript\">\r\n";
  echo "alert(\"Invalid ID length!\");\r\n";
  echo "history.back();\r\n";
  echo "</script>"; 
 }   
 else 
 {
  require ("mysql.php");
  $query="select * from login where id='$id' and password='$password'";
  $result=$mysql->query($query);
  if($myrow = mysqli_fetch_array($result))
  {
   //定义全局变量:valid为中文姓名及判断是否为登录用户;pur为用户权限等级1,2,3
   $_SESSION['valid'] =$myrow["name"];
   $_SESSION['pur']=$myrow["purview"];
   //跳转到主页
   echo '<meta http-equiv="refresh" content="0;URL=index.php">'; 
   //echo '<meta http-equiv="refresh" content="0;URL=select_process.php">'; 
  }
 }
}


haha
haha

reply all(0)
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template