1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556 |
- <?php
- $host = "blueris.beget.tech";
- $username = "blueris_base";
- $password = "Qwer123.";
- $database = "blueris_base";
- $mysql = new mysqli($host, $username, $password, $database);
- if($mysql->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 "<script>window.location.href = 'Registration.php';</script>";
- 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 "<script>window.location.href = 'Registration.php';</script>";
- 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 "<script>window.location.href = 'EmailCheck.php';</script>";
- }
- ?>
|