123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263 |
- <?php
- $host = "kurek620.beget.tech";
- $username = "kurek620_baze";
- $password = "6910WASD579h";
- $database = "kurek620_baze";
- $FIO = $_POST["FIO"];
- $region = $_POST["region"];
- $login = $_POST["login"];
- $Email = $_POST["Email"];
- $passwor = $_POST["password"];
- $mysql = new mysqli($host, $username, $password, $database);
- if($mysql->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 "<script>window.location.href = 'index.html';</script>";
- 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 "<script>window.location.href = 'index.html';</script>";
- 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 "<script>window.location.href = 'EmailCheck.html';</script>";
- }
- ?>
|