EmailCheck.php 985 B

12345678910111213141516171819202122232425262728293031323334
  1. <?php
  2. $host = "provalgk.beget.tech";
  3. $username = "provalgk_user";
  4. $password = "Qwer123.";
  5. $database = "provalgk_user";
  6. $kod = $_POST["check"];
  7. $mysql = new mysqli($host, $username, $password, $database);
  8. // Проверка соединения
  9. if($mysql->connect_error){
  10. die("Ошибка подключения". $mysql->connect_error);
  11. }
  12. session_start();
  13. $email = $_SESSION['email'];
  14. $login = $_SESSION['login'];
  15. $pass = $_SESSION['password'];
  16. if($kod == $_SESSION['kod'])
  17. {
  18. $query = "INSERT INTO Login (`role`,`email`,`login`, `password`) VALUES (0,'$email', '$login', '$pass')";
  19. if($result = $mysql->query($query))
  20. {
  21. $_SESSION['login'] = $login;
  22. $_SESSION['password'] = $pass;
  23. echo "<script>window.location.href = 'Login.html';</script>";
  24. }
  25. }
  26. else
  27. header('Location: EmailCheck.html?message=Неверный+код');
  28. echo "<script>window.location.href = 'EmailCheck.html';</script>";
  29. mysqli_close();
  30. ?>