国产av日韩一区二区三区精品,成人性爱视频在线观看,国产,欧美,日韩,一区,www.成色av久久成人,2222eeee成人天堂

PHP開發(fā)簡單圖書後臺管理系統(tǒng)修改密碼功能完整程式碼

設(shè)定一個判斷管理員是否登陸的頁面ly_check.php檔案

<?php
require_once("config.php");  //引入數(shù)據(jù)庫文件
if($_SESSION["admin"]=="")
{
   echo "<script language=javascript>alert('請重新登陸!');window.location='login.php'</script>";
}
?>

require_once?語句和?require?語句完全相同,唯一差異是PHP 會檢查該檔案是否已經(jīng)被包含過,如果是則不會再次包含。

把CSS樣式放入一個css.CSS檔案中,以後再在文件中呼叫即可。

<style>
.table{
   border: 1px solid #CAF2FF;/*邊框顏色*/
   margin-top: 5px;
   margin-bottom: 5px;
   background:#a8c7ce;
}
.td_bgf {
   background:#d3eaef;
   color:#000000;
}
.td_bg {
   background:#ffffff;
   color:#344b50;
}
.ACT_btn {
   height:26px;
   width:94px;
   cursor:hand;
   border:solid 0 #111;
   font-size: 12px;
}
.bg_tr {
   font-family: "微軟雅黑,Verdana, 新宋體";
   color:#e1e2e3;/*標(biāo)題字體色*/
   font-size:12px;
   font-weight:bolder;
   background:#353c44;/*標(biāo)題背景色*/
   line-height: 22px;
}
td {
    color:#1E5494;
    font-size:12px;
    line-height: 18px;
}
.tdbg1 {
   background:#F9F9F9;
}
.tdbg {
   BACKGROUND: #ffffff;
}
.top_link{text-decoration:none;font-size:14px;color:#FFDED2;height:0;filter:dropshadow(offX=1,offY=1,color=BD3400);}
A.top_link:link{text-decoration:none;font-size:14px;color:#FFDED2;height:0;filter:dropshadow(offX=1,offY=1,color=BD3400);}
A.top_link:visited{text-decoration:none;font-size:14px;color:#FFDED2;height:0;filter:dropshadow(offX=1,offY=1,color=BD3400);}
A.top_link:active{text-decoration:underline;font-size:14px;color:#fff;height:0;filter:dropshadow(offX=1,offY=1,color=BD3400);}
A.top_link:hover{text-decoration:underline;font-size:14px;color:#fff;height:0;filter:dropshadow(offX=1,offY=1,color=BD3400);}

.topbar {color:#ffffff}
.topbar a:link,.topbar a:visited{color:#ffffff;}
.topbar a:hover{background:#ccffcc; display:block; height:26px; padding-top:6px; color:#000000; text-decoration:none}

#table2 {
   width:100%;
   height:30px;
   border-bottom : 1px solid #fff;
   background-color: #6E4000;
}
.titledaohang {
   FONT-SIZE: 12px;
   COLOR: #551C02;
   font-weight:bolder;
   FONT-FAMILY: '微軟雅黑,宋體'
}
.Leftback {
   background:#865802;
}
.leftframetable{
   border: 1px solid #4C3500;
   margin-top: 3px;
   margin-bottom: 3px;
   background:#FDF6E6;
}
</style>

下方展示管理員修改登入密碼ly_pwd.php頁面完整程式碼

<?php require_once('ly_check.php'); 
   //引入判斷管理員是否登錄文件
?>  
<html>
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  <title>管理員密碼修改</title>
  <!-- 引入CSS樣式文件 -->
  <link href="css.css" rel="stylesheet" type="text/css">
</head>
<body>
<?php
$password = $_SESSION["pwd"];
$SQL = "SELECT * FROM admin where password='$password'";
$rs = mysqli_query($link,$sql);
$rows = mysqli_fetch_assoc($rs);
$submit = isset($_POST["Submit"])?$_POST["Submit"]:"";
if($submit)
{
  if($rows["password"]==$_POST["password"])
  {
    $password2=$_POST["password2"];
    $SQL = "UPDATE admin SET password='$password2' where id=1";
    mysqli_query($link,$sql);
    echo "<script>alert('修改成功,請重新進(jìn)行登陸!');window.location='login.php'</script>";
    exit();
  }
  else
    ?>
    <?php
  {
    ?>
    <script>
      alert("原始密碼不正確,請重新輸入")
      //location.href="li_pwd.php";
    </script>
    <?php
  }
}
?>

<table cellpadding="3" cellspacing="1" border="0" width="100%" class="table" align=center>
  <form name="renpassword" method="post" action="">
    <tr>
      <th height=25 colspan=4 align="center" class="bg_tr">更改管理密碼</th>
    </tr>
    <tr>
      <td width="40%" align="right" class="td_bg">用戶名:</td>
      <td width="60%" class="td_bg"><?php echo $rows["username"] ?></td>
    </tr>
    <tr>
      <td align="right" class="td_bg">原密碼:</td>
      <td class="td_bg"><input name="password" type="password" id="password" size="20"></td>
    </tr>
    <tr>
      <td align="right" class="td_bg">新密碼:</td>
      <td class="td_bg"><input name="password1" type="password" id="password1" size="20"></td>
    </tr>
    <tr>
      <td align="right" class="td_bg">確認(rèn)密碼:</td>
      <td class="td_bg"><input  name="password2" type="password" id="password2" size="20"></td>
    </tr>
    <tr>
      <td colspan="2" align="center" class="td_bg">
        <input class="button" onClick="return check();" type="submit" name="Submit" value="確定更改">
      </td>
    </tr>
  </form>
</table>
</body>
</html>
<script type="text/javascript">
  <!--
  function checkspace(checkstr) {
    var str = '';
    for(i = 0; i < checkstr.length; i++) {
      str = str + ' ';
    }
    return (str == checkstr);
  }
  function check()
  {
    if(checkspace(document.renpassword.password.value)) {
      document.renpassword.password.focus();
      alert("原密碼不能為空!");
      return false;
    }
    if(checkspace(document.renpassword.password1.value)) {
      document.renpassword.password1.focus();
      alert("新密碼不能為空!");
      return false;
    }
    if(checkspace(document.renpassword.password2.value)) {
      document.renpassword.password2.focus();
      alert("確認(rèn)密碼不能為空!");
      return false;
    }
    if(document.renpassword.password1.value != document.renpassword.password2.value) {
      document.renpassword.password1.focus();
      document.renpassword.password1.value = '';
      document.renpassword.password2.value = '';
      alert("新密碼和確認(rèn)密碼不相同,請重新輸入");
      return false;
    }
    document.admininfo.submit();
  }
  //-->
</script>


繼續(xù)學(xué)習(xí)
||
<?php require_once('ly_check.php'); //引入ly_check.php文件 ?> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>管理員密碼修改</title> <!-- 引入CSS樣式 --> <link href="css.css" rel="stylesheet" type="text/css"> </head> <body> <?php $password=$_SESSION["pwd"]; $sql="select * from admin where password='$password'"; $rs=mysqli_query($link,$sql); $rows=mysqli_fetch_assoc($rs); $submit = isset($_POST["Submit"])?$_POST["Submit"]:""; if($submit) { if($rows["password"]==$_POST["password"]) { $password2=$_POST["password2"]; $sql="update admin set password='$password2' where id=1"; mysqli_query($link,$sql); echo "<script>alert('修改成功,請重新進(jìn)行登陸!');window.location='login.php'</script>"; exit(); } else ?> <?php { ?> <script> alert("原始密碼不正確,請重新輸入") //location.href="li_pwd.php"; </script> <?php } } ?> <table cellpadding="3" cellspacing="1" border="0" width="100%" class="table" align=center> <form name="renpassword" method="post" action=""> <tr> <th height=25 colspan=4 align="center" class="bg_tr">更改管理密碼</th> </tr> <tr> <td width="40%" align="right" class="td_bg">用戶名:</td> <td width="60%" class="td_bg"><?php echo $rows["username"] ?></td> </tr> <tr> <td align="right" class="td_bg">原密碼:</td> <td class="td_bg"><input name="password" type="password" id="password" size="20"></td> </tr> <tr> <td align="right" class="td_bg">新密碼:</td> <td class="td_bg"><input name="password1" type="password" id="password1" size="20"></td> </tr> <tr> <td align="right" class="td_bg">確認(rèn)密碼:</td> <td class="td_bg"><input name="password2" type="password" id="password2" size="20"></td> </tr> <tr> <td colspan="2" align="center" class="td_bg"> <input class="button" onClick="return check();" type="submit" name="Submit" value="確定更改"> </td> </tr> </form> </table> </body> </html> <script type="text/javascript"> <!-- function checkspace(checkstr) { var str = ''; for(i = 0; i < checkstr.length; i++) { str = str + ' '; } return (str == checkstr); } function check() { if(checkspace(document.renpassword.password.value)) { document.renpassword.password.focus(); alert("原密碼不能為空!"); return false; } if(checkspace(document.renpassword.password1.value)) { document.renpassword.password1.focus(); alert("新密碼不能為空!"); return false; } if(checkspace(document.renpassword.password2.value)) { document.renpassword.password2.focus(); alert("確認(rèn)密碼不能為空!"); return false; } if(document.renpassword.password1.value != document.renpassword.password2.value) { document.renpassword.password1.focus(); document.renpassword.password1.value = ''; document.renpassword.password2.value = ''; alert("新密碼和確認(rèn)密碼不相同,請重新輸入"); return false; } document.admininfo.submit(); } //--> </script>