How can the back button be prevented from functioning in a PHP-based online game with a Flash movie?

To prevent the back button from functioning in a PHP-based online game with a Flash movie, you can use JavaScript to detect when the user navigates away from the page and redirect them back to the game. This can be achieved by adding a script that listens for the 'beforeunload' event and redirects the user back to the game page.

<script>
window.addEventListener('beforeunload', function (e) {
  e.preventDefault();
  window.location.href = 'game.php';
});
</script>