<?php
$thisLink = "/" . $thisPage;
profile :: is_user(false);
if (isset($_GET['key']))
{
require('inc/key.php');
exit;
}
if (isset($_POST['cfms']))
{
$email = system :: check($_POST['email']);
$__user = DB :: $dbh -> queryFetch("SELECT `id` FROM `users` WHERE `email` = ? LIMIT 1;", array($email));
if (!filter_var($email, FILTER_VALIDATE_EMAIL))
{
$e = 'Неверный формат e-mail.';
}
elseif (empty($__user))
{
$e = 'Пользователь с таким e-mail не найден.';
}
else
{
$key = rand(11513,95658).rand(434,898);
DB :: $dbh -> query("UPDATE `users` SET `restore` = ? WHERE `id` = ? LIMIT 1", array($key, $__user['id']));
system :: restoreMail($email, $key);
$_SESSION['restoreMail'] = true;
}
}
$title = "Восстановление пароля";
require (CORE."head.php");
echo "<div class=\"app-block\"><div class=\"list\"><div class=\"app-block-w\">";
if(isset($e))
{
system :: show($e);
}
if (isset($_SESSION['restoreMail']))
{
system :: show('На Ваш email выслана инструкция для продолжения продецуры восстаноления.', 1);
}
else
{
?>
<style>
.vsetime
{
text-align: center;
position: relative;
margin-bottom: 20px;
}
.vsetime:before
{
border-top: solid 1px #ddd;
content: '';
position: absolute;
top: 50%;
left: 0;
right: 0;
}
.vsetime .vsetitext
{
background: #fff;
padding: 0px 10px;
line-height: 0;
position: relative;
}
</style>
<div class="_lh-n" style="margin-top: 20px;">
<div class="vsetime">
<span class="vsetitext"><span class="_gray">Забыли пароль?</span></span>
</div></div>
<form method="post" action="" data-noajax="">
<label class="_gray _dbl" for="index-email">E-mail:</label>
<input type="text" class="main-input _w-100" name="email" value="<?=$email?>" id="index-email" placeholder="name@domain.com">
<div class="_center _btn-up">
<input type="submit" class="main-btn_b _w-100" name="cfms" value="Отправить">
</div>
</form></div></div>
<?php
}
require (CORE."foot.php");