<?php
require_once("../check.php");
require_once("../../core/setting.php");
?>
<!DOCTYPE HTML>
<html>
<head>
<title>修改密码</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<script src="../js/jquery-1.11.1.min.js"></script>
<script>
$(function(){
    $("#form").click(function(){
        var yuanmima = $("#yuanmima").val();
        var xinmimaa = $("#xinmimaa").val();
        var xinmimab = $("#xinmimab").val();
        var adminname= $("#adminname").val();
        if((yuanmima==false) || (xinmimaa==false) || (xinmimab==false)){
        alert('请正确输入表单后再进行修改操作!');
        return false;
        }
        if(xinmimaa != xinmimab){
            alert('两次新密码不一致,请重新输入!');
            return false;
        }
        
        $.post("../core/password.php",{
        adminname:adminname,
        yuanmima:yuanmima,
        xinmimaa:xinmimaa,
        xinmimab:xinmimaa
        },function(fabuok,fabuzt){
        if(fabuok=="ok"){
            alert('修改成功,请牢记新密码!');
            location.href='password.php';
            return false;
        }
        if(fabuok=="0"){
            $("#error").text("原密码出错!");
            setTimeout(function(){
            $("#error").text("");
            },2000);
            return false;
        }
        });
        
        
        
    });
    
    
});

</script>
<body>
<style>
#table{
    margin-top:10px;
    width:650px;
    min-height:40px;
    max-height:120px;
    height:auto;
    display: table;
    line-height:40px;
    text-align:right;
    color: #5F5F5F;
}
#table label{
    float:left;
    width:150px;
    text-align:right;
    color: #5F5F5F;
    font-size:16px;
    height:25px;
    line-height:25px;
    margin-right:5px;
}
#table input{
    border:1px solid #D8D8D8;
    border-radius:3px;
    line-height:25px;
    height:25px;
    float:left;
    color: #5F5F5F;
    font-size:14px; 
}
#table input.text{
    width:180px;  
}

#table span{
    margin-left:10px;
    float:left;
    width:auto;
    height:40px;
    line-height:40px;
    font-size:14px;
    color: #FF0000;
    letter-spacing: 1px;
}
#table .form{
    margin-left:155px;
    height:35px;
    line-height:35px;
    width:150px;
    float:left;
    color: #FFFFFF;
    font-size:16px; 
    background-color:#08246B;
    border:1px solid #08246B;
    border-radius:5px;
    box-shadow:0px 0px 5px 5px #C2C2C2;   
}
</style>
<div id="table">
<input type="hidden" id="adminname" value="<?php echo $adminname;?>" />
<label>原始密码:</label><input type="password" id="yuanmima"  class="text" /><span id="error"></span>
</div>

<div id="table">
<label>修改密码:</label><input type="password" id="xinmimaa" class="text" />
</div>

<div id="table">
<label>重复密码:</label><input type="password" id="xinmimab" class="text" /><span id="passerror"></span>
</div>

<div id="table">
<input class="form" id="form" type="button" value="修改密码" />
</div>

</body>