1234567891011121314151617181920212223242526272829303132333435363738 |
- <?php
- $host = "provalgk.beget.tech";
- $username = "provalgk_user";
- $password = "Qwer123.";
- $database = "provalgk_user";
- $mysql = new mysqli($host, $username, $password, $database);
- // Проверка соединения
- if ($mysql->connect_error) {
- die("Ошибка подключения: " . $mysql->connect_error);
- }
- $user = $_POST['login'];
- $email = $_POST['email'];
- $quary = "SELECT * FROM Login WHERE login like'$user'";
- $result = mysqli_query($mysql, $quary);
- $row = mysqli_fetch_assoc($result);
- $emaill = $row['email'];
- if($email == $emaill)
- {
- $message = "Ваш пароль: ".$row["password"];
- $to = $email;
- $from = "provalenkoludmila@gmail.com";
- $subject = "Восстановление пароля";
- $subject = "=?utf-8?B?".base64_encode($subject)."?=";
- $headers = "From: $from\r\nReply-to: $from\r\nContent-type: text/html; charset=utf-8\r\n";
- mail($to, $subject, $message, $headers);
- echo "<script>window.location.href = 'Login.html';</script>";
- }
- else
- {
- header('Location: Email.html?message=Неверные+данные');
- echo "<script>window.location.href = 'Email.html';</script>";
- mysqli_close();
- }
- ?>
|