<!doctype html>
<html lang="en">

<head>
<title>LaktusDev | Login</title>
<meta charset="utf-8">
<meta name="robots" content="nofollow">
<meta http-equiv="X-UA-Compatible" content="IE=edge, chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
<meta name="description" content="">
<meta name="author" content="LaktusDev, design by: laktusdev.com">

<link rel="icon" href="favicon.ico" type="image/x-icon">
<!-- VENDOR CSS -->
<link rel="stylesheet" href="assets/vendor/bootstrap/css/bootstrap.min.css">
<link rel="stylesheet" href="assets/vendor/font-awesome/css/font-awesome.min.css">
<link rel="stylesheet" href="assets/vendor/animate-css/vivify.min.css">
<link rel="stylesheet" href="assets/vendor/toastr/toastr.min.css">

<!-- MAIN CSS -->
<link rel="stylesheet" href="assets/css/luxury.min.css">

</head>

<body>
    
<div id="body" class="theme-green">

    <!-- Theme Setting -->
    <div class="themesetting">
        <a href="javascript:void(0);" class="theme_btn"><i class="fa fa-gear fa-spin"></i></a>
        <ul class="list-group">
            <li class="list-group-item">
                <ul class="choose-skin list-unstyled mb-0">
                    <li data-theme="green" class="active"><div class="green"></div></li>
                    <li data-theme="orange"><div class="orange"></div></li>
                    <li data-theme="blush"><div class="blush"></div></li>
                    <li data-theme="cyan"><div class="cyan"></div></li>
                    <li data-theme="timber"><div class="timber"></div></li>
                    <li data-theme="blue"><div class="blue"></div></li>
                    <li data-theme="amethyst"><div class="amethyst"></div></li>
                </ul>
            </li>
            <li class="list-group-item d-flex align-items-center justify-content-between">
                <span>Dark Mode</span>
                <label class="switch dark_mode">
                    <input type="checkbox">
                    <span class="slider round"></span>
                </label>
            </li>
        </ul>
        <hr>
        <div>
            
        </div>
    </div>

    <div class="auth-main">
        <div class="auth_div vivify fadeIn">
            <div class="auth_brand">
                <a class="navbar-brand" href="./"><img src="assets/logo.png" width="50" class="d-inline-block align-top mr-2" alt="">LaktusDev</a>                                                
            </div>
            <div class="card">
<?php
require('xwaf.php'); // Before all your code starts.
$xWAF = new xWAF();
$xWAF->start();

require('veza/le.php');

// If form submitted, insert values into the database.
if (isset($_POST['email'])){
	
	$username = stripslashes($_REQUEST['email']); // removes backslashes
	$username = mysqli_real_escape_string($leld,$username); //escapes special characters in a string
	$password = stripslashes($_REQUEST['lozinka']);
	$password = mysqli_real_escape_string($leld,$password);
	
//Checking is user existing in the database or not
	$query = "SELECT * FROM `le_users` WHERE email='$username' and lozinka='$password'";
	$result = mysqli_query($leld,$query) or die(mysqli_error());
	$row_result = mysqli_fetch_array($result);
	$rows = mysqli_num_rows($result);
	if($rows==1){
		$_SESSION['username'] = $username;
		header("Location: lea/"); // Redirect user to index.php
		}else{
			echo "<div id='toast-container' class='toast-top-center'><div class='toast toast-error' aria-live='assertive' style=''><div class='toast-message'><b>Username/password</b> is incorrect.</div></div></div>";
			echo "<script>setTimeout(\"location.href = 'login.php';\",1500);</script>";
			}
}else{
?>
                <div class="header">
                    <p class="lead">Login to your account</p>
                </div>
                <div class="body">

                    <form class="form-auth-small" action="" method="post" id="login" name="login">
                        <div class="form-group c_form_group">
                            <label>Email</label>
                            <input type="email" name="email" id="email" class="form-control" placeholder="Enter your email address">
                        </div>
                        <div class="form-group c_form_group">
                            <label>Password</label>
                            <input type="password" name="lozinka" id="lozinka" class="form-control" placeholder="Enter your password">
                        </div>
                        <div class="form-group clearfix">
                            <label class="fancy-checkbox element-left">
                                
                            </label>								
                        </div>
                        <button type="submit" class="btn btn-dark btn-lg btn-block">LOGIN</button>
                        <div class="bottom">
                            <span class="helper-text m-b-10"></span>
                            <span>&copy;<?php 
$copyYear = 2023; 
$curYear = date('Y'); 
echo $copyYear . (($copyYear != $curYear) ? '-' . $curYear : '');
?> Designed & Powered by <a href="https://www.laktusdev.com" target="new">LaktusDev</a></span>
                        </div>
                    </form>

                </div>
<?php } ?>
            </div>
        </div>
        <div class="animate_lines">
            <div class="line"></div>
            <div class="line"></div>
            <div class="line"></div>
            <div class="line"></div>
            <div class="line"></div>
            <div class="line"></div>
        </div>
    </div>

</div>
    
<script src="assets/bundles/libscripts.bundle.js"></script>    
<script src="assets/bundles/vendorscripts.bundle.js"></script>

<!-- Vedor js file and create bundle with grunt  --> 
<script>
    $('.choose-skin li').on('click', function() {
	    var $body = $('body');
	    var $this = $(this);
  
	    var existTheme = $('.choose-skin li.active').data('theme');

	    $('.choose-skin li').removeClass('active');
	    $body.removeClass('theme-' + existTheme);
	    $this.addClass('active');
	    var newTheme = $('.choose-skin li.active').data('theme');
	    $body.addClass('theme-' + $this.data('theme'));
	});

	// Theme Setting 
	$('.themesetting .theme_btn').on('click', function() {
		$('.themesetting').toggleClass('open');
	});
	// dark version
    $(".dark_mode input").on('change',function() {
        if(this.checked) {
            $("body").addClass('dark_active');
        }else{
            $("body").removeClass('dark_active');
        }
	});
</script>
</body>
</html>