Email.php 1.1 KB

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