<?php
// dominoes_block_game.php
// Help out dominoes_block_game.html with SMS messages
// August, 2026

  if (isset($_GET['intnum'])) {
     //file_put_contents('./x.x', '1');
     if (file_exists(dirname(__FILE__) . '/t' . $_GET['intnum'] . '.txt')) {
     //file_put_contents('./x.x2', '1');
       $innards=file_get_contents(dirname(__FILE__) . '/t' . $_GET['intnum'] . '.txt');
     //file_put_contents('./x.x3', '1');
       unlink(dirname(__FILE__) . '/t' . $_GET['intnum'] . '.txt');
     //file_put_contents('./x.x4', "<html><body onload=\" parent.location.href=parent.document.URL.replace('#','&rd=' + Math.floor(Math.random() * 19897675) + '#').replace('%3Ct" . $_GET['intnum'] . "', '" . $innards . "'); \"></body></html>");
       echo "<html><body onload=\" parent.location.href=parent.document.URL.replace('#','&rd=' + Math.floor(Math.random() * 19897675) + '#').replace('%3Ct" . $_GET['intnum'] . "', '" . $innards . "'); \"></body></html>";
     //file_put_contents('./x.x5', '1');
       exit;
     } 
  } else if (isset($_POST['makenum'])) {
     $newnum=rand(123,7876543);
     //file_put_contents(dirname(__FILE__) . '/t' . $newnum . '.txt', str_replace('+','%20',urlencode($_POST['makenum'])));
     echo "<html><body onload=\" parent.document.getElementById('makenum').title='" . $newnum . "'; parent.document.getElementById('asms').href=parent.document.getElementById('asms').href.split('tbody')[0] + 't" . $newnum . "'; \"></body></html>";
     exit;
  } else if (('' . $_SERVER['QUERY_STRING']) != '') {
     header('Location: ./dominoes_block_game.html?' . $_SERVER['QUERY_STRING']);
     exit;
  } else {
     header('Location: ./dominoes_block_game.html');
     exit;
  }
  
?>