<div class="big_topics bor_top round3 FFF hr">

<?php

session_start();

set_time_limit( 0 );

define( 'ROOT', 'http://'.$_SERVER['HTTP_HOST'] );
define( 'ROOT_DIR', $_SERVER['DOCUMENT_ROOT'] );

include_once ROOT_DIR . '/engine/config.php';

$login = $_POST['login'];
$password = $_POST['pass'];
$passmd5 = pass_hash($password);

if (isset($_POST["login"]))
{

$time = time();

if (empty($login)) { echo "<font color='red'>Не заполнено поле логин!</font><br /><br />"; exit(); }

if (empty($password)) { echo "<font color='red'>Не заполнено поле пароль!</font><br /><br />"; exit(); }

$load = $pdo->Query("SELECT * FROM `php_user` WHERE `login` = '$login' LIMIT 1");
if($load->RowCount() == 0) { echo "<font color='red'>Пользователь не найден в базе данных!</font><br /><br />"; exit(); }
$us = $load->Fetch();
if($us['pass'] != $passmd5) { echo "<font color='red'>Пара логин/пароль имеет неверно значение!</font><br /><br />"; exit(); }

$_SESSION['id'] = intval($us['id']);

$pdo->Query("UPDATE `php_user` SET `authtime` = '$time', `auth_ip` = '" . real_IP() . "' WHERE `login` = '$login'");

echo "<br /><div align='center'><font color='green'>Вы авторизованы.</font></div>";
?><script>  setTimeout( "location='/profile';", 1000 ); </script><?

exit();
 }
?>
<style>
.form-group {margin-bottom: 15px;}
.form-group label {display: inline-block;color: #555;padding: 0;max-width: 100%;margin-bottom: 5px;font-weight: 700;}
.form-group label:hover {color: #555;background: none;cursor: auto;}
.input input {position: relative; left: 0px;}
.input input[disabled] {cursor: not-allowed;background-color: #eee;}
.input-addon {
	padding: 6px 12px;
	font-size: 14px;
	font-weight: 400;
	line-height: 1;
	color: #555;
	text-align: center;
	background-color: #eee;
	border: 1px solid #ccc;
	border-radius: 2px 0 0 2px;
	display: table-cell; width: 1%;
	white-space: nowrap;
	vertical-align: middle;
	border-right: 0;
}
.input {
    position: relative;
    display: table;
    border-collapse: separate;
}
.form-control {
	color: #555; position: relative; left: none;
	display: block;
	width: 95%;
	height: 34px;
	padding: 3px 12px;
	font-size: 14px;
	line-height: 1.42857143;
	background-color: #fff;
	background-image: none;
	border: 1px solid #ccc;
	border-radius: 0 2px 2px 0;
	box-shadow: inset 0 1px 1px rgba(0,0,0,.075);
}
</style>

      <div class="main_top hr_menu"><h1>Вход в кабинет торговой площадки I-ESHOP</h1></div>
  
  <div style="width: 500px;margin: 50px auto;">
<form method="post">
	<div class="form-group">
	<label>Введите свой логин:</label>
		<div class="input">
			<div class="input-addon"><span class="fa fa-envelope"></span></div>
			<input name="login" placeholder="Введите свой логин" class="form-control" type="text">
		</div>
	</div>
	<div class="form-group">
	<label>Введите пароль:</label>
		<div class="input">
			<div class="input-addon"><span class="fa fa-key"></span></div>
			<input name="pass" placeholder="Введите пароль" class="form-control" type="password">
		</div>
	</div>
		<input type="submit" class="btn-input input-green" value="Войти в аккаунт">
		<a href="/restore" class="input-link">Забыли пароль?</a>
	    
<br><br>

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