alert('Semua field harus diisi'); window.history.back();"; exit; } if (!filter_var($email, FILTER_VALIDATE_EMAIL)) { echo ""; exit; } if ($password !== $confirmPassword) { echo ""; exit; } if (strlen($password) < 6) { echo ""; exit; } $stmt = mysqli_prepare($conn, "SELECT id FROM user WHERE username=? OR email=?"); mysqli_stmt_bind_param($stmt, "ss", $username, $email); mysqli_stmt_execute($stmt); mysqli_stmt_store_result($stmt); if (mysqli_stmt_num_rows($stmt) > 0) { echo ""; exit; } $stmt = mysqli_prepare($conn, "INSERT INTO user (username, email, password, role) VALUES (?, ?, ?, 'player')"); mysqli_stmt_bind_param($stmt, "sss", $username, $email, $hash); mysqli_stmt_execute($stmt); echo ""; exit; } ?>