Файл: public_html/modules/recovery/recovery.php
Строк: 30
<?php
$root = $_SERVER['DOCUMENT_ROOT'];
include_once ($root.'/core/base.php');
trueauth();
$header = "Восстановление пароля";
include_once ($root.'/core/head.php');
$code = fl($_GET['code']);
$userWithThisCode = $db->query("SELECT * FROM `users` WHERE `recovery_code` = '".$code."'");
if($userWithThisCode->num_rows == 0) redirect('/');
$us = $userWithThisCode->fetch_object();
if(isset($_GET['recovery']))
{
$newpass = fl($_POST['newpass']);
$confpass = fl($_POST['confpass']);
if($newpass != $confpass) redirect('/recovery/'.$code, 'Пароли не совпадают');
$db->query("UPDATE `users` SET `password` = '".md5($confpass)."', `recovery_code` = '' WHERE `id` = '".$us->id."'");
setcookie('login', $us->login, time()+86400*365, '/');
setcookie('password', md5($confpass), time()+86400*365, '/');
redirect('/', 'Пароль восстановлен!');
}
echo '<div class="b">
<center>
<form action="/recovery/'.$code.'/yes" method="post">
Новый пароль:<br>
<input type="password" name="newpass" required><br>
Подтверждение пароля:<br>
<input type="password" name="confpass" required><br>
<input type="submit" name="send" value="Восстановить пароль">
</form>
</center>
</div>';
include_once ($root.'/core/foot.php');