<!doctype html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">

<?php 

$this->session = session();
$validation =  \Config\Services::validation();
$this->db = db_connect();
echo view('user/common_style1');?>
</head>

<style type="text/css">
.form-logo img, svg {
vertical-align: middle;
min-height: 106px;
}
.small, small {
font-size: 11px;
color: red;
font-weight: 600;
}
.form-block .form-select {
width: 95%;
}
</style>

<body>
<?php echo view('user/common_header');?>
<section class="bg-white form-page">

<div class="container">
<div class="row">
<div class="col-lg-10 offset-lg-1">
<div class="icon-square inner-box form-bg bg-white">
<div class="row">
<div class="col-lg-6">

<div class="form-logo form-logo02 bg-primary text-center">

<?php 
$logo_img = site_info('site_logo');
if($logo_img) {
?>
<a  href="<?php echo base_url();?>"><img  src="<?php echo base_url();?>/content/site/<?php echo site_info('site_logo');?>" alt="<?php echo site_info('site_logo');?>"></a> 
<?php } else { ?>
<a href="<?php echo base_url();?>"><img src="<?php echo base_url();?>/styles/new_style/images/form-logo.png" class="img-fluid"></a> 
<?php } ?> </a>

</div>
</div>

<div class="col-lg-6">


<div class="form-reg">
<div class="row">

<div class="form-container mb-10">       

<?php  

if($login['log_allow_user'] == 'on') 
{ ?>
<?php 
$session = \Config\Services::session();

if($session->getFlashData('success_message')) {?>
<p class="frgtpwd frgtpwd1"><i class="fa fa-thumbs-up"></i><?php echo $session->getFlashData('success_message');?></p>
<?php } elseif ($session->getFlashData('error_message')) { ?>
<p class="frgtpwd frgtpwd1 frgtpwdred"><i class="fa fa-thumbs-down"></i><?php echo $session->getFlashData('error_message');?></p>
<?php } else { }?>




<div class="form-title">
<h4 class="text-black mont"><?php echo lang('language_lang.login_here'); ?></h4>
</div>
<br>
<form action="<?php echo base_url();?>/user/login" class="form-validate login" method="post">
<div class="form">

<div class="col-lg-12 col-md-6">
<div class="form-block mb-3">
<input type="text" name="email" class="form-control" id="email" required="required" placeholder="<?php echo 'Enter your Email Here'; ?>" />
<?php echo $validation->getError('email');?>
</div>
</div>

<div class="col-lg-12 col-md-6">
<div class="form-block mb-3">
<input type="password" class="form-control" id="password" name="password" required="required" placeholder="<?php echo lang('language_lang.login_password'); ?>"/>
<?php echo $validation->getError('password');?>
</div> 
</div>

<div class="col-lg-12 col-md-6">
<div class="form-block mb-3">
<select name="usrlang" class="form-select">
<?php
$list_lan_res = activelang();
foreach ($list_lan_res as $lang_row) {
?>
<option value="<?php echo $lang_row->language_name;?>"><?php echo ucfirst($lang_row->language_name);?></option>
<?php } ?>
</select>
</div>
</div>

<div class="col-lg-12">
<?php
if($login['log_captcha_status'] == 'on'){
?>
<div class="form-block mb-3">
<?php
$sitekey = $this->db->query("select * from site_controls where site_key='captcha_key'");
$site_kval=$sitekey->getResult();
?>

<div class="center-div">
<div class="g-recaptcha" data-callback="recaptchaCallback"  data-sitekey="<?php echo $site_kval[0]->site_value;?>"></div>

<div style='color:red'><?php echo $validation->getError('g-recaptcha-response');?></div>
</div>
<?php echo $validation->getError('math_captcha');?>
</div>
<?php } ?>
</div>
      </div>


<div class="col-lg-12 mt-4">
<div class="form-btn text-center ">
<button class="btn btn-primary" type="submit"><?php echo lang('language_lang.login_here'); ?></button>
</div>
</div>
</form>


<div class="col-lg-12" style="padding: 20px;margin-bottom: 10px;">
<div class="row">
<div class="col-lg-6">
<a class="nav-link" href="<?php echo base_url();?>/reset"><?php echo lang('language_lang.login_forgot')." ? "; ?></a>
</div>
<div class="col-lg-6">
<a style="float: right;" class="nav-link" href="<?php echo base_url();?>/register"><?php echo lang('language_lang.login_signup'); ?></a>
</div>
</div>
</div>

<?php } else { ?>
<p style="color:white;" class="frgtpwd frgtpwd1 frgtpwdred"><i class="fa fa-thumbs-down"></i><?php echo lang('language_lang.login_option_disabled'); ?> !</p>

<?php } ?>

</div>
</div>
</div> 
</div> 


<?php 

//echo view('user/footer');

?>



</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</section>
</body>


<script src="<?php echo base_url();?>/styles/js/jquery-1.12.2.min.js"></script>
</style><script src='https://www.google.com/recaptcha/api.js'></script>
<script type="text/javascript" src="<?php echo base_url();?>/assets/js/formValidation.js"></script>
<script type="text/javascript" src="<?php echo base_url();?>/assets/js/bootstrap.js"></script>
<script src="<?php echo base_url();?>/assets/boots/js/select_min.js"></script>
<script type="text/javascript">
jQuery.noConflict();
(function( $ ) {
$(function() {

$(document).ready(function() {

$("#refresh").on('click', function(e) {
$.ajax({
    type: 'post',
    url : '<?php echo base_url("user/login/refersh"); ?>',
    data : { },
    success : function(msg)
    {
        $("#capt").attr('src',msg);
    }
});

});


$('.login').formValidation({
framework: 'bootstrap',
excluded: [':disabled'],
icon: {
    // valid: 'glyphicon glyphicon-ok',
    // invalid: 'glyphicon glyphicon-remove',
    validating: 'glyphicon glyphicon-refresh'
},
fields: {
    email: {
        message: '<?php echo lang("language_lang.login_username_valid");?>',
        validators: {
            notEmpty: {
                message: '<?php echo lang("language_lang.login_username_empty");?>'
            },
            regexp: {
                regexp: /^[\w\-\.\+]+\@[a-zA-Z0-9\.\-]+\.[a-zA-z0-9]{2,4}$/,
                message: '<?php echo lang("language_lang.login_name_alpha");?>'
            }
           
        }
    },
    password: {
        message: '<?php echo lang("language_lang.login_password_valid");?>',
        validators: {
            notEmpty: {
                message: '<?php echo lang("language_lang.login_password_empty");?>'
            }
        }
    }
}
})

});



});
})(jQuery);

(function() {
if (!String.prototype.trim) {
(function() {
// Make sure we trim BOM and NBSP
var rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g;
String.prototype.trim = function() {
return this.replace(rtrim, '');
};
})();
}

[].slice.call( document.querySelectorAll( 'input.input__field' ) ).forEach( function( inputEl ) {
// in case the input is already filled..
if( inputEl.value.trim() !== '' ) {
classie.add( inputEl.parentNode, 'input--filled' );
}

// events:
inputEl.addEventListener( 'focus', onInputFocus );
inputEl.addEventListener( 'blur', onInputBlur );
} );

function onInputFocus( ev ) {
classie.add( ev.target.parentNode, 'input--filled' );
}

function onInputBlur( ev ) {
if( ev.target.value.trim() === '' ) {
classie.remove( ev.target.parentNode, 'input--filled' );
}
}
})();
</script>
</html>
<?php 
echo view('user/common_script');
echo view('user/footer1');?>
