<?php
$host = "provalgk.beget.tech";
$username = "provalgk_user";
$password = "Qwer123.";
$database = "provalgk_user";

$kod = $_POST["check"];

$mysql = new mysqli($host, $username, $password, $database);

// Проверка соединения
if($mysql->connect_error){
    die("Ошибка подключения". $mysql->connect_error);
}

session_start();
$email = $_SESSION['email'];
$login = $_SESSION['login'];
$pass = $_SESSION['password'];
if($kod == $_SESSION['kod'])
{
    $query = "INSERT INTO Login (`role`,`email`,`login`, `password`) VALUES (0,'$email', '$login', '$pass')";
    if($result = $mysql->query($query))
    {
        $_SESSION['login'] = $login;
        $_SESSION['password'] = $pass;
        echo "<script>window.location.href = 'Login.html';</script>";
    }      
}
else
        header('Location: EmailCheck.html?message=Неверный+код');
        echo "<script>window.location.href = 'EmailCheck.html';</script>";
        mysqli_close();
?>