<?php
// +----------------------------------------------------------------------
// | Quotes [未来可期]
// +----------------------------------------------------------------------
// +----------------------------------------------------------------------
// | Author: 自助建站系统 https://www.kancloud.cn/btwcms-com/btwcms/2265967 作者QQ：1617643
// +----------------------------------------------------------------------
// | Date: 2020年2月5日
// +----------------------------------------------------------------------
include '../app/common.php';
if($islogin==1) exit("<script language='javascript'>window.location.href='./index.php';</script>");


?>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8"/>
    <title><?php echo $conf['web_name'] ?></title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="shortcut icon" href="../assets/img/favicon.ico?r=<?php echo rand(10000,99999)?>">
    <!-- App css -->
    <link href="../assets/css/bootstrap.min.css" rel="stylesheet" type="text/css"/>
    <link href="../assets/css/icons.css" rel="stylesheet" type="text/css"/>
    <link href="../assets/css/metisMenu.min.css" rel="stylesheet" type="text/css"/>
    <link href="../assets/css/style.css" rel="stylesheet" type="text/css"/>
</head>
<body class="account-body accountbg" onkeydown="keyLogin();">
<!-- Log In page -->
<div class="row vh-100 ">
    <div class="col-12 align-self-center">
        <div class="auth-page">
            <div class="card auth-card shadow-lg">
                <div class="card-body">
                    <div class="px-3">
                        <div class="auth-logo-box">
                            <a href="#" class="logo logo-admin"><img src="../assets/images/logo-sm.png" height="55"
                                                                     alt="logo" class="auth-logo"></a>
                        </div><!--end auth-logo-box-->
                        <div class="text-center auth-logo-text">
                            <h4 class="mt-0 mb-3 mt-5">后台管理登录</h4>
                            <p class="text-muted mb-0">体验极速建站的乐趣.</p>
                        </div> <!--end auth-logo-text-->

                        <form class="form-horizontal auth-form my-4" action="#" method="post">
                            <div class="form-group">
                                <label for="username">管理员账号</label>
                                <div class="input-group mb-3">
                                            <span class="auth-form-icon">
                                                <i class="dripicons-user"></i> 
                                            </span>
                                    <input type="text" class="form-control" id="username" placeholder="请输入管理员用户名">
                                </div>
                            </div><!--end form-group-->

                            <div class="form-group">
                                <label for="userpassword">管理员密码</label>
                                <div class="input-group mb-3">
                                            <span class="auth-form-icon">
                                                <i class="dripicons-lock"></i> 
                                            </span>
                                    <input type="password" class="form-control" id="userpassword" placeholder="请输入管理员密码">
                                </div>
                            </div><!--end form-group-->

                            <div class="form-group row mt-4">
                                <div class="col-sm-6">
                                    <div class="custom-control custom-switch switch-success">
                                        <input type="checkbox" class="custom-control-input" id="customSwitchSuccess">
                                        <label class="custom-control-label text-muted"
                                               for="customSwitchSuccess">30天免登录</label>
                                    </div>
                                </div><!--end col-->
                                <div class="col-sm-6 text-right">
                                    <a href="javascript:void(0);" id="manageRecoverPass" class="text-muted font-13"><i class="dripicons-lock"></i>
                                        忘记密码?</a>
                                </div><!--end col-->
                            </div><!--end form-group-->

                            <div class="form-group mb-0 row">
                                <div class="col-12 mt-2">
                                    <button class="btn btn-primary btn-round btn-block waves-effect waves-light"
                                            id="userLogin" type="button">登录 <i class="fas fa-sign-in-alt ml-1"></i>
                                    </button>
                                </div><!--end col-->
                            </div> <!--end form-group-->
                        </form><!--end form-->
                    </div><!--end /div-->

                </div><!--end card-body-->
            </div><!--end card-->
            <!--
            <div class="account-social text-center mt-4">
                <h6 class="my-4">第三方平台登录</h6>
                <ul class="list-inline mb-4">
                    <li class="list-inline-item">
                        <a href="" class="">
                            <i class="fab fa-facebook-f facebook"></i>
                        </a>
                    </li>
                    <li class="list-inline-item">
                        <a href="" class="">
                            <i class="fab fa-twitter twitter"></i>
                        </a>
                    </li>
                    <li class="list-inline-item">
                        <a href="" class="">
                            <i class="fab fa-google google"></i>
                        </a>
                    </li>
                </ul>
            </div>end account-social-->

        </div><!--end auth-page-->
    </div><!--end col-->
</div><!--end row-->
<!-- End Log In page -->


<!-- jQuery  -->
<script src="../assets/js/jquery.min.js"></script>
<script src="../assets/js/bootstrap.bundle.min.js"></script>
<script src="../assets/js/metisMenu.min.js"></script>
<script src="../assets/js/waves.min.js"></script>
<script src="../assets/js/jquery.slimscroll.min.js"></script>
<!-- App js -->
<script src="../assets/js/app.js"></script>
<!--引入layer-->
<script src="../assets/js/layer/layer.js"></script>
<script>
    $("#manageRecoverPass").click(function () {
       layer.alert("如果网站设置了邮箱，请在用户页面通过邮箱找回，如未设置请联系开发人员手动找回密码");
       return false;
    });
    $("#userLogin").click(function () {
        var isNologin;
        if ($('#customSwitchSuccess').is(':checked')) {
            isNologin = 1;
        } else {
            isNologin = 0;
        }
        var ii = layer.load(0, {shade: false,time: 35000}); //0代表加载的风格，支持0-2
        $.ajax({
            type: "post",
            url: "auth.php?act=login",
            dataType: "json",
            data: { user: $("#username").val(), pass: $("#userpassword").val(), isNologin: isNologin},
            success: function (data) {
                layer.close(ii);
                if (data.code == 1) {
                    layer.msg(data.msg, {icon: 1, time: 2000, shade: 0.4}, function () {
                        location.href = 'index.php';
                    });
                } else {
                    layer.msg(data.msg, {icon: 2, time: 2000, shade: 0.4});
                }
            }
        });
    });
    function keyLogin(){
        if (event.keyCode==13)  //回车键的键值为13
            $("#userLogin").click();
    }
</script>
</body>
</html>