<?php
$username = array(
    'name' => 'txtUsername',
    'type' => 'text',
    'value' => '',
    'placeholder' => 'Nhập Username',
    'autocomplete' => 'off',
    'class' => 'form-control'
);
$password = array(
    'name' => 'txtPassword',
    'type' => 'password',
    'value' => '',
    'placeholder' => 'Nhập Password',
    'autocomplete' => 'off',
    'class' => 'form-control'
);
$buttonLogin = array(
    'name' => 'btnLogin',
    'type' => 'submit',
    'class' => 'width-35 pull-right btn btn-sm btn-primary',
    'style' => 'padding:4px 0px; width: 100% !important;',
    'content' => '<i class="ace-icon fa fa-key"></i><span class="bigger-110">Đăng nhập</span>'
);
?>

<!DOCTYPE html>
<html lang="en">
<head>
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
    <meta http-equiv="refresh" content="1800" />
    <meta charset="utf-8"/>
    <title>Đăng nhập CMS</title>
    <link rel="shortcut icon" href="<?php echo base_url('images/favicon.png') ?>" sizes="24x24" type="image/png" />
    <meta name="description" content="User login page"/>
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0"/>
    <!-- bootstrap & fontawesome -->
    <link rel="stylesheet" href="<?php echo base_url('public/assets/css/bootstrap.min.css') ?>"/>
    <link rel="stylesheet" href="<?php echo base_url('public/assets/font-awesome/4.2.0/css/font-awesome.min.css') ?>"/>
    <!-- ace styles -->
    <link rel="stylesheet" href="<?php echo base_url('public/assets/css/ace.min.css') ?>"/>
    <script src="<?php echo base_url('public/assets/js/jquery.2.1.1.min.js') ?>"></script>

</head>

<body class="login-layout">
<div class="main-container">
    <div class="main-content">
        <div class="row">
            <div class="col-sm-10 col-sm-offset-1">
                <div class="login-container">
                    <div class="space-12"></div>
                    <div class="center"></div>
                    <div class="space-6"></div>
                    <div class="position-relative">
                        <div id="login-box" class="login-box visible widget-box no-border">
                            <div class="widget-body">
                                <div class="widget-main">
                                    <h4 class="header blue lighter bigger" style="text-align: center">CMS for ADMIN</h4>
                                    <div class="text-center">
                                        <img src="<?php echo base_url('images/logo.png') ?>" style="height: 45px">
                                    </div>
                                    <div class="space-6"></div>
                                    <?php
                                    if($this->session->flashdata('loginErrorMsg')): ?>
                                    <ul>
                                        <li style="color: red">
                                            <?php echo $this->session->flashdata('loginErrorMsg'); ?>
                                        </li>
                                    </ul>
                                    <?php endif; ?>
                                    <?php
                                    echo validation_errors('<ul style="color: red">', '</ul>');
                                    echo form_open(base_url('backend/account/index'));
                                    ?>
                                    <fieldset>
                                        <div>
                                            <input type="hidden" name="client_ip" id="client_ip" value="">
                                        </div>
                                        <label class="block clearfix">
                                            <span class="block input-icon input-icon-right">
                                                <?php echo form_input($username); ?>                                                    
                                                <i class="ace-icon fa fa-user"></i>
                                            </span>
                                        </label>
                                        <label class="block clearfix">
                                            <span class="block input-icon input-icon-right">
                                                <?php echo form_input($password); ?>                                                    
                                                <i class="ace-icon fa fa-lock"></i>
                                            </span>
                                        </label>
                                        <div class="space" style="clear: both"></div>
                                        <div class="clearfix" style="text-align: center;">
                                            <?php echo form_button($buttonLogin); ?>                                            
                                        </div>
                                        <div class="space-4"></div>
                                    </fieldset>
                                    <?php echo form_close(); ?>
                                </div>
                                <!-- /.widget-main -->
                            </div>
                            <!-- /.widget-body -->
                        </div>
                        <div style="text-align: center"></div>
                        <!-- /.login-box -->
                    </div>
                    <!-- /.position-relative -->
                </div>
            </div>
            <!-- /.col -->
        </div>
        <!-- /.row -->
    </div>
    <!-- /.main-content -->
</div>
<!-- /.main-container -->
<script>
    $.getJSON('https://jsonip.com/?callback=?', function(data) {
        var ip = 'unknow';
        if (data !== null) {
            ip = data.ip;
        }
        $('#client_ip').val(ip);
    });
</script>
</body>
</html>
