connect_error){ die("Ошибка подключения". $mysql->connect_error); } $quary = "SELECT * FROM Users WHERE login like'$login'"; $result = mysqli_query($mysql, $quary); if(mysqli_num_rows($result) > 0) { header('Location: index.html?message=Логин+существует'); echo ""; mysqli_close(); } $quary = "SELECT * FROM Users WHERE Email like '$Email'"; $result1 = mysqli_query($mysql, $quary); if(mysqli_num_rows($result1) > 0) { header('Location: index.html?message=Почта+существует'); echo ""; mysqli_close(); } if(mysqli_num_rows($result) == 0 && mysqli_num_rows($result1) == 0) { $permitted_chars = '0123456789'; $kod = substr(str_shuffle($permitted_chars), 0, 5); $message = "Проверочный код: ".$kod; $to = $Email; $from = "Kurlek665@gmail.com"; $subject = "Проверочный код для ".$login; $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); session_start(); $_SESSION['login'] = $login; $_SESSION['password'] = $passwor; $_SESSION['Email'] = $Email; $_SESSION['region'] = $region; $_SESSION['FIO'] =$FIO; $_SESSION['kod'] = $kod; echo ""; } ?>