<!DOCTYPE html> <html> <head> <LINK href="css/main.css" rel=stylesheet> <META charset=utf-8"> <title>Востановление пароля</title> </head> <body> <div> <?php $realtime = mktime(date(H), date(i), date(s), date("m"), date("d"), date("Y")); $login = filter_input(INPUT_GET,'login',FILTER_SANITIZE_SPECIAL_CHARS); $passwd = filter_input(INPUT_GET,'newpass'); $timev = filter_input(INPUT_GET,'timev'); if ($passwd && $login && $timev && $realtime <= $timev) { include("config.php"); $sql = db::c()->query('SELECT * FROM `confirmpasswd` WHERE `login` = "?s" AND `passwd` = "?s" AND `date` = "?s" AND `active` = "?s"', $login, $passwd, $timev, 1); if ($sql->getNumRows() == 0) die("Ссылка устарела!"); $sql = $sql->fetch_assoc(); db::c()->query('UPDATE `users` SET `pass` = "?s" WHERE `login` = "?s"', md5($passwd), $sql['login']); db::c()->query('UPDATE `confirmpasswd` SET `active` = "?s" WHERE `login` = "?s" AND `passwd` = "?s" AND `date` = "?s" AND `active` = "?s"', 0, $login, $passwd, $timev, 1); } else echo "Ссылка устарела."; ?> </div> </body> </html>