亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

Change administrator password

In this article we introduce how to modify the administrator password. We have already seen the display page, modified, and linked to the pass.html page

微信截圖_20170711094412.png

This is the modified page

<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<meta name="renderer" content="webkit">
<title></title>
<link rel="stylesheet" href="style/css/pintuer.css">
<link rel="stylesheet" href="style/css/admin.css">
<script src="style/js/jquery.js"></script>
<script src="style/js/pintuer.js"></script>
</head>
<body>
<div class="panel admin-panel">
  <div><strong><span></span> 修改管理員密碼</strong></div>
  <div>
    <form method="post" action="pass.php">
      <div>
        <div>
          <label for="sitename">管理員帳號:</label>
        </div>
        <input type="hidden" name="id" value="<?php echo $id;?>">
        <div>
          <label style="line-height:33px;">
           admin
          </label>
        </div>
      </div>      
      <div>
        <div>
          <label for="sitename">原始密碼:</label>
        </div>
        <div>
          <input type="password" class="input w50" id="mpass" name="mpass" size="50" placeholder="請輸入原始密碼" data-validate="required:請輸入原始密碼" />       
        </div>
      </div>      
      <div>
        <div>
          <label for="sitename">新密碼:</label>
        </div>
        <div>
          <input type="password" class="input w50" name="newpass" size="50" placeholder="請輸入新密碼" data-validate="required:請輸入新密碼,length#>=5:新密碼不能小于5位" />         
        </div>
      </div>
      <div>
        <div>
          <label for="sitename">確認(rèn)新密碼:</label>
        </div>
        <div>
          <input type="password" class="input w50" name="renewpass" size="50" placeholder="請?jiān)俅屋斎胄旅艽a" data-validate="required:請?jiān)俅屋斎胄旅艽a,repeat#newpass:兩次輸入的密碼不一致" />          
        </div>
      </div>
      
      <div>
        <div>
          <label></label>
        </div>
        <div>
          <button class="button bg-main icon-check-square-o" type="submit"> 提交</button>   
        </div>
      </div>      
    </form>
  </div>
</div>
</body></html>

After linking to the pass.html page, create a pass.php file

Compare the entered original password with the password in the database. If it matches, then judge further. Use update to change the original password

The code is as follows:

<?php 
    require_once("../config/config.php");
    mysql_query("set names = utf8");
      $sql = "SELECT * FROM admin"; 
      // if($_GET){
      //   $id = $_GET['id'];
      //   $sql0 = 'select username from user where id ='.$id;
      //   $result =mysql_query($sql0);
      //   $username = mysql_fetch_assoc($result)['username'];
      // }
      if($_POST){
        $oldpassword = $_POST ["mpass"]; 
        $newpassword = $_POST ["newpass"]; 
        $confirm = $_POST['renewpass'];
        $sql1 = 'select password from admin where id=1 ';
        $result1 = mysql_query($sql1);
        $password = mysql_fetch_assoc($result1)['password'];
        if ($oldpassword !== $password) {
          echo "與原密碼不符";
        }
          else{
          if ($newpassword==$confirm) {
              $sql2 = 'UPDATE admin SET `password`="'.$newpassword.'" where id =1';
              mysql_query ($sql2);
              header('location:./usermessage.php');
          }
        }
        }
        ?>

After writing, run it

微信截圖_20170711095139.png

As shown in the figure, it is found that the password of the database has been changed Modification successful

In this way, we have completed the function of changing the administrator password.


Continuing Learning
||
<!DOCTYPE html> <html lang="zh-cn"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" /> <meta name="renderer" content="webkit"> <title></title> <link rel="stylesheet" href="style/css/pintuer.css"> <link rel="stylesheet" href="style/css/admin.css"> <script src="style/js/jquery.js"></script> <script src="style/js/pintuer.js"></script> </head> <body> <div class="panel admin-panel"> <div class="panel-head"><strong><span class="icon-key"></span> 修改管理員密碼</strong></div> <div class="body-content"> <form method="post" class="form-x" action="pass.php"> <div class="form-group"> <div class="label"> <label for="sitename">管理員帳號:</label> </div> <input type="hidden" name="id" value="<?php echo $id;?>"> <div class="field"> <label style="line-height:33px;"> admin </label> </div> </div> <div class="form-group"> <div class="label"> <label for="sitename">原始密碼:</label> </div> <div class="field"> <input type="password" class="input w50" id="mpass" name="mpass" size="50" placeholder="請輸入原始密碼" data-validate="required:請輸入原始密碼" /> </div> </div> <div class="form-group"> <div class="label"> <label for="sitename">新密碼:</label> </div> <div class="field"> <input type="password" class="input w50" name="newpass" size="50" placeholder="請輸入新密碼" data-validate="required:請輸入新密碼,length#>=5:新密碼不能小于5位" /> </div> </div> <div class="form-group"> <div class="label"> <label for="sitename">確認(rèn)新密碼:</label> </div> <div class="field"> <input type="password" class="input w50" name="renewpass" size="50" placeholder="請?jiān)俅屋斎胄旅艽a" data-validate="required:請?jiān)俅屋斎胄旅艽a,repeat#newpass:兩次輸入的密碼不一致" /> </div> </div> <div class="form-group"> <div class="label"> <label></label> </div> <div class="field"> <button class="button bg-main icon-check-square-o" type="submit"> 提交</button> </div> </div> </form> </div> </div> </body></html>
submitReset Code