Example #1
0
        unset($name);
    }
}
if (empty($login) or empty($password) or empty($email) or empty($name)) {
    exit("You entered no all info!");
}
$login = stripslashes($login);
$login = htmlspecialchars($login);
$name = stripslashes($name);
$name = htmlspecialchars($name);
$email = stripslashes($email);
$email = htmlspecialchars($email);
$password = stripslashes($password);
$password = htmlspecialchars($password);
$login = trim($login);
$email = trim($email);
$name = trim($name);
$password = trim($password);
if (User::check_user_by_login($login)) {
    exit("Login is used somebody.");
} else {
    if (User::check_user_by_email($email)) {
        exit("Email is used somebody.");
    } else {
        User::add_new_user($login, $password, $name, $email);
        $_SESSION['login_user'] = $login;
        $_SESSION['hash_user'] = User::getHash($login);
        header("Location: ../index.php");
        exit;
    }
}