<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html>
<html lang="en">
    <head>
        <title>Unicorn Admin</title>
		<meta charset="UTF-8" />
        <meta name="viewport" content="width=device-width, initial-scale=1.0" />
        <link rel="stylesheet" type="text/css" href="<?php echo (THEME_PATH_ABS); ?>/css/bootstrap.min.css" />
        <link rel="stylesheet" type="text/css" href="<?php echo (THEME_PATH_ABS); ?>/css/bootstrap-responsive.min.css" />
        <link rel="stylesheet" type="text/css" href="<?php echo (THEME_PATH_ABS); ?>/css/unicorn.login.css" />
         <script type="text/javascript" src="<?php echo (THEME_PATH_ABS); ?>/js/jquery.min.js"></script>
        <script type="text/javascript" src="<?php echo (THEME_PATH_ABS); ?>/js/unicorn.login.js"></script>
        <script type="text/javascript" src="<?php echo (THEME_PATH_ABS); ?>/js/bootstrap.min.js"></script>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /></head>
    <body>
        <div id="logo">
            <img src="<?php echo (THEME_PATH_ABS); ?>/img/logo.png" alt="" />
        </div>
        <div id="loginbox">            
            <form id="loginform" class="form-vertical" method="post" action="#" />
				<p>Enter username and password to continue.</p>
                <div class="control-group">
                    <div class="controls">
                        <div class="input-prepend">
                            <span class="add-on"><i class="icon-user"></i></span><input type="text" placeholder="Username" name="username" />
                        </div>
                    </div>
                </div>
                <div class="control-group">
                    <div class="controls">
                        <div class="input-prepend">
                            <span class="add-on"><i class="icon-lock"></i></span><input type="password" placeholder="Password" name="password" />
                        </div>
                    </div>
                </div>
                <div class="form-actions">
                    <span class="pull-left"><a href="#" class="flip-link" id="to-recover">Lost password?</a></span>
                    <span class="pull-right"><input type="button" class="btn btn-inverse" value="Login" onclick="ajaxLogin()" /></span>
                </div>
            </form>
            <form id="recoverform" action="#" class="form-vertical" />
				<p>Enter your e-mail address below and we will send you instructions how to recover a password.</p>
				<div class="control-group">
                    <div class="controls">
                        <div class="input-prepend">
                            <span class="add-on"><i class="icon-envelope"></i></span><input type="text" placeholder="E-mail address" />
                        </div>
                    </div>
                </div>
                <div class="form-actions">
                    <span class="pull-left"><a href="#" class="flip-link" id="to-login">&lt; Back to login</a></span>
                    <span class="pull-right"><input type="submit" class="btn btn-inverse" value="Recover" /></span>
                </div>
            </form>
        </div>

<div id="myAlert" class="modal hide">
<div class="modal-header">
<button data-dismiss="modal" class="close" type="button">×</button>
<span>登录错误</span>
</div>
<div class="modal-body">
<p>密码或用户名错误</p>
</div>
<div class="modal-footer">
<a data-dismiss="modal" class="btn btn-danger" href="#">确认</a>
</div>
</div>
<script type="text/javascript">
    function ajaxLogin()
    {
        $.ajax({
        type:'post',
        url:'/wublog/index.php/Admin/Login/do_login/',
        datatype:'json',
        data:$('#loginform').serialize(),
        success:function(data)
        {
            var obj = eval('(' + data + ')'); 
            if(obj.status=='fail')
            {
                $("#myAlert").modal();
            }
            else if(obj.status=='success')
            {

                window.location.href="/wublog/index.php/Admin/Index/index";  
            }
        },
        error:function(){
        }
        });

    }
</script>
    </body>
</html>