<?php if (!defined('ROOT')){ echo 'Deny ...'; exit; } ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <title>欢迎登录后台管理系统</title>
        <link href="<?php echo Doo::conf()->ADMIN_URL; ?>static/css/style.css" rel="stylesheet" type="text/css" />
        <script language="JavaScript" src="<?php echo Doo::conf()->ADMIN_URL; ?>static/js/jquery.js"></script>
        <script src="<?php echo Doo::conf()->ADMIN_URL; ?>static/js/cloud.js" type="text/javascript"></script>
        <script language="javascript">
            $(function () {
                $('.loginbox').css({'position': 'absolute', 'left': ($(window).width() - 692) / 2});
                $(window).resize(function () {
                    $('.loginbox').css({'position': 'absolute', 'left': ($(window).width() - 692) / 2});
                })
            });
        </script> 
    </head>
    <body style="background-color:#1c77ac; background-image:url(<?php echo Doo::conf()->ADMIN_URL; ?>static/images/light.png); background-repeat:no-repeat; background-position:center top; overflow:hidden;">
        <div id="mainBody">
            <div id="cloud1" class="cloud"></div>
            <div id="cloud2" class="cloud"></div>
        </div>  
        <div class="logintop">    
            <span>欢迎登录后台管理界面平台</span>    
            <ul>
                <li><a href="../">回首页</a></li>
                <li><a href="http://JsonClouds.Com/help/">帮助</a></li>
                <li><a href="http://JsonClouds.Com/about/">关于</a></li>
            </ul>    
        </div>    
        <div class="loginbody">
            <span class="systemlogo"></span>        
            <form method="post" action="" onsubmit="return false" id="loginForm">
                <div class="loginbox">    
                    <ul>
                        <li><input name="username" type="text" class="loginuser" placeholder="帐号" /></li>
                        <li><input name="password" type="password" class="loginpwd" placeholder="密码" /></li>
                        <li>
                            <input name="submit" type="button" class="loginbtn" value="登录" onclick="login();" />
                        </li>
                    </ul>        
                </div> 
            </form>
        </div>    
        <div class="loginbm">版权所有  <?php echo date('Y'); ?>  <a href="http://JsonClouds.Com">JsonClouds.Com</a></div>
        <script>
            var t;
            var i = 0;
            function timer() {
                i++;
                if (i === 4) {
                    i = 1;
                }
                var str = ['', '.', '..', '...'];
                $('.loginbtn').val('登录中 ' + str[i]);
            }
            function login() {
                $('.loginbtn').attr('disabled', 'disabled');
                $('.loginbtn').val('登录中');
                t = setInterval(timer, 1000);
                $.post('<?php echo Doo::conf()->ADMIN_URL; ?>index.php?c=main&m=login', $('#loginForm').serializeArray(), function (ret) {
                    console.log(ret);
                    if (ret.indexOf('hash_') >= 0) {
                        $('.loginbtn').val('登录成功');
                        setTimeout(function () {
                            <?php
                            $url = Doo::conf()->APP_URL.'index.php?c=frame&';
                            $jump = service::do_action('login_jump_url', array(1, $url), 1);
                            ?>
                            location.href = '<?php echo $jump; ?>' + ret;
                        }, 500);
                    } else {
                        alert(ret);
                        $('.loginbtn').val('登录');
                        $('.loginbtn').removeAttr('disabled');
                    }
                    clearInterval(t);
                });
            }
            $(function () {
                $('.loginuser').focus();
            });
        </script>
        <script type="text/javascript">  
        if(top.location !== self.location){  
            top.location = self.location;
        }  
        </script>
    </body>
</html>