connect_error){ die("Ошибка подключения". $mysql->connect_error); } $name = $_POST["name"]; $surname = $_POST["surname"]; $email = $_POST["email"]; $login = $_POST["login"]; $pass = $_POST["password"]; $quary = "SELECT * FROM login WHERE login like'$login'"; $result = mysqli_query($mysql, $quary); if(mysqli_num_rows($result) > 0) { header('Location: Registration.php?message=Логин+существует'); echo ""; mysqli_close(); } $quary = "SELECT * FROM login WHERE email like '$email'"; $result1 = mysqli_query($mysql, $quary); if(mysqli_num_rows($result1) > 0) { header('Location: Registration.php?message=Почта+существует'); echo ""; mysqli_close(); } if(mysqli_num_rows($result) == 0 && mysqli_num_rows($result1) == 0) { $permitted_chars = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; $kod = substr(str_shuffle($permitted_chars), 0, 10); $message = "Проверочный код: ".$kod; $to = $email; $from = "provalenkoludmila@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['name'] = $name; $_SESSION['surname'] = $surname; $_SESSION['login'] = $login; $_SESSION['password'] = $pass; $_SESSION['email'] = $email; $_SESSION['kod'] = $kod; echo ""; } ?>