<?php

/*
* @package BANANA WARS
* @copyright: (c) 2017 G.P. aka Mvcshka (mvcshka@yandex.ru)
* @license: GNU General Public License version 2; see LICENSE.txt
* @files:
*
*/

// список разрешенных IP адресов через пробел
$allowed_ips = "127.0.0.1";

//$ip = $_SERVER['REMOTE_ADDR'];
//echo $ip;

$ips = explode(" ",$allowed_ips);

if (array_search($_SERVER["REMOTE_ADDR"],$ips) === FALSE)
{
    echo "<p>Доступ запрещен!";
    exit;
}

?>
<?php

ob_start();
session_start();
if(isset($_SESSION['developer']))
{
	Header("Location: /developer/index.php");
	exit;
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>Авторизация в админ панели.</title>
    <link href="css/bootstrap.css" rel="stylesheet" type="text/css">
    <link href="css/londinium-theme.css" rel="stylesheet" type="text/css">
    <link href="css/styles.css" rel="stylesheet" type="text/css">
    <link href="css/icons.css" rel="stylesheet" type="text/css">
    <link href="http://fonts.googleapis.com/css?family=Open+Sans:400,300,600,700&amp;subset=latin,cyrillic-ext" rel="stylesheet" type="text/css">
    <script type="text/javascript" src="js/jquery.1.10.1.min.js"></script>
    <script type="text/javascript" src="js/jquery-ui.1.10.2.min.js"></script>
    <script type="text/javascript" src="js/plugins/charts/sparkline.min.js"></script>
    <script type="text/javascript" src="js/plugins/forms/uniform.min.js"></script>
    <script type="text/javascript" src="js/plugins/forms/select2.min.js"></script>
    <script type="text/javascript" src="js/plugins/forms/inputmask.js"></script>
    <script type="text/javascript" src="js/plugins/forms/autosize.js"></script>
    <script type="text/javascript" src="js/plugins/forms/inputlimit.min.js"></script>
    <script type="text/javascript" src="js/plugins/forms/listbox.js"></script>
    <script type="text/javascript" src="js/plugins/forms/multiselect.js"></script>
    <script type="text/javascript" src="js/plugins/forms/validate.min.js"></script>
    <script type="text/javascript" src="js/plugins/forms/tags.min.js"></script>
    <script type="text/javascript" src="js/plugins/forms/switch.min.js"></script>
    <script type="text/javascript" src="js/plugins/forms/uploader/plupload.full.min.js"></script>
    <script type="text/javascript" src="js/plugins/forms/uploader/plupload.queue.min.js"></script>
    <script type="text/javascript" src="js/plugins/forms/wysihtml5/wysihtml5.min.js"></script>
    <script type="text/javascript" src="js/plugins/forms/wysihtml5/toolbar.js"></script>
    <script type="text/javascript" src="js/plugins/interface/daterangepicker.js"></script>
    <script type="text/javascript" src="js/plugins/interface/fancybox.min.js"></script>
    <script type="text/javascript" src="js/plugins/interface/moment.js"></script>
    <script type="text/javascript" src="js/plugins/interface/jgrowl.min.js"></script>
    <script type="text/javascript" src="js/plugins/interface/datatables.min.js"></script>
    <script type="text/javascript" src="js/plugins/interface/colorpicker.js"></script>
    <script type="text/javascript" src="js/plugins/interface/fullcalendar.min.js"></script>
    <script type="text/javascript" src="js/plugins/interface/timepicker.min.js"></script>
    <script type="text/javascript" src="js/plugins/interface/collapsible.min.js"></script>
    <script type="text/javascript" src="js/bootstrap.min.js"></script>
    <script type="text/javascript" src="js/application.js"></script>
    <script type="text/javascript" src="js/login/login.js"></script>
</head>
<body class="full-width page-condensed"><!-- Navbar -->
<div class="navbar navbar-inverse" role="navigation">
    <div class="navbar-header">
        <a class="navbar-brand" href="/"><img src="images/logo.png" alt="Mvcshka"></a>
    </div>
</div>
<!-- /navbar --><!-- Login wrapper -->
<div class="login-wrapper">
    <form action="" role="form" method="post">
        <div class="modal-header"><span class="text-semibold">Авторизация</span>
<?php
sleep(3);

if(isset($_POST['login']))
{
	$admLogin = 'Dev-Master';
	$admPass = 'developer';
	
	$login = htmlspecialchars($_POST['login']);
	$pass = htmlspecialchars($_POST['pass']);
	
	if($admLogin == $login and $admPass = $pass)
	{
		$_SESSION['Dev-Master'] = $admLogin;

	Header("Location: /developer/index.php");
	exit;

	}
	else
	{
		echo 'Не верный логин или пароль';
	}
}
?>
</div>
        <div class="well">
            <form action="" role="form">
            <div class="form-group has-feedback">
                <label>Логин</label>
                    <input type="text" class="form-control" name="login" placeholder="Логин">
                    <i class="icon-users form-control-feedback"></i>
            </div>
            <div class="form-group has-feedback"><label>Пароль</label>
                <input type="password" class="form-control" name="pass" placeholder="Пароль">
                <i class="icon-lock form-control-feedback"></i>
            </div>
            <div class="row form-actions">
                <div class="col-xs-6">
                    <button class="btn btn-success" id="btnlogin" data-loading-text="<i class='icon-spinner7 spin'></i> Входим"><i class="icon-enter"></i> Войти</button>   
                </div>
            </div>
        </div>
    </form>
</div>
<!-- /login wrapper -->

<!-- Footer -->
<div class="footer clearfix">
    <div class="pull-left">&copy; 2018. Powered By <a href="/"></a></div>   
</div>
<!-- /footer -->
</body>
</html>