<?php
// index.php
// in /Games/Sudoku/
// RJM Programming - December, 2022

 $wel='';
 $amt='';
 $cuda=date('D, d M Y');
 $weare='' . server_remote_addr();

 $allcontenta=file_get_contents(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'index.php');
 if (strpos($allcontenta, '/' . '*') !== false && strpos($allcontenta, '*' . '/') === false) {
   $allcontenta.="\n" . '*' . '/' . "\n" . '?' . '>';
   file_put_contents(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'index.php', $allcontenta);
 }

 if (isset($_GET['noaction'])) {
 if (file_exists('./sudoku.htm')) {
   echo file_get_contents('./sudoku.htm');
 } else if (file_exists('./sudoku.html')) {
   echo file_get_contents('./sudoku.html');
 }
 exit;
 } else if (isset($_GET['thegame']) && isset($_GET['namecheck'])) {
 $doaloop=true;
 $renamebits='';
 $vsarrs="-1";
 if (isset($_GET['vsarrs'])) { $vsarrs='' . str_replace('+',' ',urldecode($_GET['vsarrs']));  }
 $thatset='' . str_replace('+',' ',urldecode($_GET['thegame']));
 $thisset='' . str_replace('(','9',str_replace('*','8',str_replace('&','7',str_replace('^','6',str_replace('$','4',str_replace('#','3',str_replace('@','2',str_replace('!','1',str_replace('1','(',str_replace('2','*',str_replace('3','&',str_replace('4','^',str_replace('6','$',str_replace('7','#',str_replace('8','@',str_replace('9','!',str_replace('+',' ',urldecode($_GET['thegame']))))))))))))))))));
 while ($doaloop) {
   $allcontentw=file_get_contents(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'index.php');
 if (strpos($allcontentw, '/' . '*') !== false && strpos($allcontentw, '*' . '/') === false) {
   $allcontentw.="\n" . '*' . '/' . "\n" . '?' . '>';
 }
   $relr=explode((';' . $thisset . ';'), $allcontentw);
   if (('' . sizeof($relr)) == '0' || ('' . sizeof($relr)) == '1') {
     $relr=explode((';' . $thatset . ';'), $allcontentw);
   }
   //file_put_contents('x.x', '' . sizeof($relr) . ' for ;' . $thisset . ";\n" . $allcontentw);
   if (('' . sizeof($relr)) != ('' . $vsarrs)) {
     $vsarrs='' . sizeof($relr);
     $doaloop=false;
     for ($iwr=1; $iwr<sizeof($relr); $iwr++) {
       $lfld=str_replace('+',' ',urldecode(explode("\n", $relr[$iwr])[0]));
       if (strpos($lfld, ':') !== false) {
         $renamebits.=" parent.mapfromto('" . explode(';',$relr[-1 + $iwr])[-1 + sizeof(explode(';',$relr[-1 + $iwr]))]  . "','" . explode(':', $lfld)[0] . "'); ";
       }
     }
     if ($renamebits != '') { $renamebit.=' parent.domaps(); '; }
     echo '<html><body onload=" parent.document.getElementById(' . "'vsarrs'" . ').value=' . "'" . $vsarrs . "'" . '; ' . $renamebits . ' "></body></html>';
   } else {
     sleep(5);
   }
 }
 exit;
 } else if (isset($_GET['thegame']) && isset($_GET['askingforafriend'])) {
// while (file_exists('./sudoku.pleasewait')) {
//   sleep(1);
// }
//   file_put_contents('./sudoku.pleasewait', $thisset);
 $thatset='' . str_replace('+',' ',urldecode($_GET['thegame']));
 $thisset='' . str_replace('(','9',str_replace('*','8',str_replace('&','7',str_replace('^','6',str_replace('$','4',str_replace('#','3',str_replace('@','2',str_replace('!','1',str_replace('1','(',str_replace('2','*',str_replace('3','&',str_replace('4','^',str_replace('6','$',str_replace('7','#',str_replace('8','@',str_replace('9','!',str_replace('+',' ',urldecode($_GET['thegame']))))))))))))))))));
 $lhref='';
 if (isset($_GET['yourname']) || 1 == 1) {
   $gy="somebody";
   if (isset($_GET['yourname'])) {
     $gy=str_replace('+',' ',urldecode($_GET['yourname']));
   }
 if (file_exists('./sudoku_' . $thisset . '.html')) {
   if (filesize('./sudoku_' . $thisset . '.html') == 0) {
     unlink('./sudoku_' . $thisset . '.html');
   } //else {
   //  $lhref=" location.href='./sudoku" . $thisset . ".html'; ";
   //}
   if (filesize('./sudoku' . $thisset . '.html') == 0) {
     unlink('./sudoku' . $thisset . '.html');
   }
 }
   if (file_exists('./sudoku_' . $thisset . '.html')) {
     $huhadd="'(' + '" . $weare . " '";
     if (strpos(file_get_contents('./sudoku_' . $thisset . '.html'), $huhadd) === false) {
     if (isset($_GET['yourname'])) {
     file_put_contents('./sudoku_' . $thisset . '.html', str_replace("{ ",  "{ parent.document.getElementById('sudokui').placeholder=parent.document.getElementById('sudokui').placeholder.replace('(' + '" . $weare . " ','(" . $gy . " ').replace(' ' + '" . $weare . " ',' " . $gy . " ');  parent.document.getElementById('ibb').value=parent.document.getElementById('ibb').value.replace('(' + '" . $weare . " ','(" . $gy . " ').replace(' ' + '" . $weare . " ',' " . $gy . " '); ", file_get_contents('./suduko_' . $thisset . '.html')));
     } else {
     file_put_contents('./sudoku_' . $thisset . '.html', str_replace(" }",  " parent.document.getElementById('sudokui').placeholder=parent.document.getElementById('sudokui').placeholder.replace('(' + '" . $weare . " ','(" . $gy . " ').replace(' ' + '" . $weare . " ',' " . $gy . " ');  parent.document.getElementById('ibb').value=parent.document.getElementById('ibb').value.replace('(' + '" . $weare . " ','(" . $gy . " ').replace(' ' + '" . $weare . " ',' " . $gy . " '); }", file_get_contents('./suduko_' . $thisset . '.html')));
     }
     }
   } else if (1 == 6) {
     if (isset($_GET['yourname'])) {
     file_put_contents('./sudoku_' . $thisset . '.html', "<html><head><scri" . "pt type=text/javascript> function dorenames() {   parent.document.getElementById('sudokui').placeholder=parent.document.getElementById('sudokui').placeholder.replace('(' + '" . $weare . " ','(" . $gy . " ').replace(' " . $weare . " ',' " . $gy . " ');  parent.document.getElementById('ibb').value=parent.document.getElementById('ibb').value.replace('(' + '" . $weare . " ','(" . $gy . " ').replace(' ' + '" . $weare . " ',' " . $gy . " ');   } </scr" . "ipt></head><body onload=dorenames();></body></html>");
     } else {
     file_put_contents('./sudoku_' . $thisset . '.html', "<html><head><scri" . "pt type=text/javascript> function dorenames() {   parent.document.getElementById('sudokui').placeholder=parent.document.getElementById('sudokui').placeholder.replace('(' + '" . $weare . " ','(" . $gy . " ').replace(' " . $weare . " ',' " . $gy . " ');   parent.document.getElementById('ibb').value=parent.document.getElementById('ibb').value.replace('(' + '" . $weare . " ','(" . $gy . " ').replace(' ' + '" . $weare . " ',' " . $gy . " ');  } </scr" . "ipt></head><body onload=dorenames();></body></html>");
     }
   }
 } 
 if (file_exists('./sudoku_' . $thisset . '.html')) {
   if (filesize('./sudoku_' . $thisset . '.html') == 0) {
     unlink('./sudoku_' . $thisset . '.html');
   } //else {
   //  $lhref=" location.href='./sudoku_" . $thisset . ".html'; ";
   //}
   if (filesize('./sudoku' . $thisset . '.html') == 0) {
     unlink('./sudoku' . $thisset . '.html');
   }
 }
 $allcontentw=file_get_contents(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'index.php');
 if (strpos($allcontentw, '/' . '*') !== false && strpos($allcontentw, '*' . '/') === false) {
   $allcontentw.="\n" . '*' . '/' . "\n" . '?' . '>';
 }
 $rell=explode(';' . $thisset . ';', $allcontentw);
 $vsarrs='' . sizeof($rell);
 if (sizeof($rell) == 1) {  $rell=explode(';' . $thatset . ';', $allcontentw);  } 
 $info="";
 $aline="";
 $otherstyping=false;
 $iamtyping=false;
 $oip="others";
 $aswell='';
 $funnyrec='';
 if (file_exists('./sudoku.firstpleasewait')) {
   if (strpos(file_get_contents('./sudoku.firstpleasewait'), ';' . $thisset . ';') !== false) {
   if (strpos(file_get_contents('./sudoku.firstpleasewait'), ';' . $weare . ';' . $thisset . ';') === false) {
     if (sizeof($rell) == 1) {
       $funnyrec=file_get_contents('./sudoku.firstpleasewait') . "\n";
       file_put_contents('./sudoku.found', $funnyrec);
   //$aswell.=" if (parent.document.title.substring(0,1) >= '0' && parent.document.title.substring(0,1) <= '9') { alert('" . $funnyrec . "');  } ";
     } //else {
      // file_put_contents('./sudoku.f1', '' . sizeof($rell) . ' ' . ';' . $weare . ';' . $thisset . ';');
    // }
   }
   } else if (strpos(file_get_contents('./sudoku.firstpleasewait'), ';' . $thatset . ';') !== false) {
   if (strpos(file_get_contents('./sudoku.firstpleasewait'), ';' . $weare . ';' . $thatset . ';') === false) {
     if (sizeof($rell) == 1) {
       $funnyrec=file_get_contents('./sudoku.firstpleasewait') . "\n";
       file_put_contents('./sudoku.found', $funnyrec);
   //$aswell.=" if (parent.document.title.substring(0,1) >= '0' && parent.document.title.substring(0,1) <= '9') { alert('" . $funnyrec . "');  } ";
     } //else {
      // file_put_contents('./sudoku.f2',  '' . sizeof($rell) . ' ' . ';' . $weare . ';' . $thatset . ';');
     //}
   }
   }
 }
 if (sizeof($rell) > 1 || $funnyrec != '') {
   $aline.=$funnyrec;
   if (sizeof($rell) > 1) {
   $aline.=$cuda . explode($cuda, $rell[0])[-1 + sizeof(explode($cuda, $rell[0]))] . ';' . $thisset . ';' . explode("\n", $rell[1])[0];
   }
   //$aswell.=" if (parent.document.title.substring(0,1) >= '0' && parent.document.title.substring(0,1) <= '9') { parent.document.title='" . $aline . "';  } ";
   if (strpos($aline, ($cuda . ' ')) !== false && strpos($aline, ';' . $weare . ';') === false) {
     $otherstyping=true;
     $oip=explode(';', $aline)[1];
   } else if (strpos($aline, ($cuda . ' ')) !== false && strpos($aline, ';' . $weare . ';') !== false) {
     $iamtyping=true;
   }
   $info=$aline;
   for ($ikj=1; $ikj<(-1 + sizeof($rell)); $ikj++) {
    $aline=$cuda . explode($cuda, $rell[$ikj])[-1 + sizeof(explode($cuda, $rell[$ikj]))] . ';' . $thisset . ';' . explode("\n", $rell[1 + $ikj])[0];
    if (strpos($aline, ($cuda . ' ')) !== false && strpos($aline, ';' . $weare . ';') === false) {
     $otherstyping=true;
     if (str_replace('others','',$oip) == '') {
     $oip=explode(';', $aline)[1];
     } else if (strpos(' ' . $oip . ' ', ' ' . explode(';', $aline)[1] . ' ') === false && strpos('(' . $oip . ' ', '(' . explode(';', $aline)[1] . ' ') === false) {
     $oip=((str_replace('^','',str_replace('^others^','',('^' . $oip . '^'))) . ' and ')) . explode(';', $aline)[1];
     }
    } else if (strpos($aline, ($cuda . ' ')) !== false && strpos($aline, ';' . $weare . ';') !== false) {
     $iamtyping=true;
    } 
    $info.="\n" . $aline;
   }
 }
 if ($iamtyping) {
   $aswell.=' parent.document.getElementById(' . "'tam'" . ').title=' . "'I'" . '; ';
 } else if (!$otherstyping) {
   $aswell.=' parent.document.getElementById(' . "'tam'" . ').title=' . "''" . '; ';
 } else {
   $aswell.=' parent.document.getElementById(' . "'tam'" . ').title=' . "'" . str_replace('^','',str_replace('^others^','',('^' . $oip . '^'))) . "'" . '; ';
 }
 if ($info == "") {
   if (strlen($_GET['askingforafriend']) != 0) {
     //$aswell.=' parent.document.getElementById(' . "'sudokui'" . ').placeholder=parent.document.getElementById(' . "'sudokui'" . ').placeholder.replace(' . "'(bit before a colon is your name)','(others typing)'" . '); ';
     $aswell.=' parent.document.getElementById(' . "'sudokui'" . ').placeholder=parent.document.getElementById(' . "'sudokui'" . ').placeholder.replace(' . "/\([^\)]*\)/g,'(" . $oip . " typing)'" . '); ';
     //$aswell.=' parent.document.getElementById(' . "'ibb'" . ').value=parent.document.getElementById(' . "'ibb'" . ').value.replace(' . "'(bit before a colon is your name)','(others typing)'" . '); ';
     $aswell.=' parent.document.getElementById(' . "'ibb'" . ').value=parent.document.getElementById(' . "'ibb'" . ').value.replace(' . "/\([^\)]*\)/g,'(others typing)'" . '); ';
 if (file_exists('./sudoku_' . $thisset . '.html')) {
   $conthref=file_get_contents('./sudoku_' . $thisset . '.html');
   $reltwo=explode("}", $conthref);
   if (sizeof($reltwo) > 1) {
    $aswell.=' ' . explode('{', $reltwo[0])[-1 + sizeof(explode('{', $reltwo[0]))] . ' ';
   }
   $lhref='';
 }
 if (file_exists('./sudoku_' . $thatset . '.html')) {
   $conthref=file_get_contents('./sudoku_' . $thatset . '.html');
   $reltwo=explode("}", $conthref);
   if (sizeof($reltwo) > 1) {
    $aswell.=' ' . explode('{', $reltwo[0])[-1 + sizeof(explode('{', $reltwo[0]))] . ' ';
   }
   $lhref='';
 }
// file_put_contents('./sudoku.5', '<html><body onload=" parent.document.getElementById(' . "'tam'" . ').value=' . "''" . '; ' . $aswell . ' ' . $lhref . '"></body></html>');
  $aswell.=' parent.document.getElementById(' . "'vsarrs'" . ').value=' . "'" . $vsarrs . "'" . '; ';
     echo '<html><body onload=" parent.document.getElementById(' . "'tam'" . ').value=' . "''" . '; ' . $aswell . ' ' . $lhref . '"></body></html>'; 
   }
 } else {
   if (strlen($_GET['askingforafriend']) != 0 && !$otherstyping) {
     //$aswell.=' parent.document.getElementById(' . "'sudokui'" . ').placeholder=parent.document.getElementById(' . "'sudokui'" . ').placeholder.replace(' . "'(others typing)','(bit before a colon is your name)'" . '); ';
     $aswell.=' parent.document.getElementById(' . "'sudokui'" . ').placeholder=parent.document.getElementById(' . "'sudokui'" . ').placeholder.replace(' . "/\([^\)]*\)/g,'(bit before a colon is ' + ((parent.pargyn().length > 0) ? parent.pargyn() + ')' : 'your name)')" . '); ';
     //$aswell.=' parent.document.getElementById(' . "'ibb'" . ').value=parent.document.getElementById(' . "'ibb'" . ').value.replace(' . "'(others typing)','(bit before a colon is your name)'" . '); ';
     $aswell.=' parent.document.getElementById(' . "'ibb'" . ').value=parent.document.getElementById(' . "'ibb'" . ').value.replace(' . "/\([^\)]*\)/g,'(bit before a colon is ' + ((parent.pargyn().length > 0) ? parent.pargyn() + ')' : 'your name)')" . '); ';
 if (file_exists('./sudoku_' . $thisset . '.html')) {
   $conthref=file_get_contents('./sudoku_' . $thisset . '.html');
   $reltwo=explode("}", $conthref);
   if (sizeof($reltwo) > 1) {
    $aswell.=' ' . explode('{', $reltwo[0])[-1 + sizeof(explode('{', $reltwo[0]))] . ' ';
   }
   $lhref='';
 }
 if (file_exists('./sudoku_' . $thatset . '.html')) {
   $conthref=file_get_contents('./sudoku_' . $thatset . '.html');
   $reltwo=explode("}", $conthref);
   if (sizeof($reltwo) > 1) {
    $aswell.=' ' . explode('{', $reltwo[0])[-1 + sizeof(explode('{', $reltwo[0]))] . ' ';
   }
   $lhref='';
 }
// file_put_contents('./sudoku.6', '<html><body onload=" parent.document.getElementById(' . "'tam'" . ').value=' . "''" . '; ' . $aswell . ' ' . $lhref . '"></body></html>');
  $aswell.=' parent.document.getElementById(' . "'vsarrs'" . ').value=' . "'" . $vsarrs . "'" . '; ';
     echo '<html><body onload=" parent.document.getElementById(' . "'tam'" . ').value=' . "''" . '; ' . $aswell . ' ' . $lhref . '"></body></html>'; 
   } else if (strlen($_GET['askingforafriend']) == 0 && $otherstyping) {
     //$aswell.=' parent.document.getElementById(' . "'sudokui'" . ').placeholder=parent.document.getElementById(' . "'sudokui'" . ').placeholder.replace(' . "'(bit before a colon is your name)','(others typing)'" . '); ';
     $aswell.=' parent.document.getElementById(' . "'sudokui'" . ').placeholder=parent.document.getElementById(' . "'sudokui'" . ').placeholder.replace(' . "/\([^\)]*\)/g,'(" . $oip . " typing)'" . '); ';
     //$aswell.=' parent.document.getElementById(' . "'ibb'" . ').value=parent.document.getElementById(' . "'ibb'" . ').value.replace(' . "'(bit before a colon is your name)','(others typing)'" . '); ';
     $aswell.=' parent.document.getElementById(' . "'ibb'" . ').value=parent.document.getElementById(' . "'ibb'" . ').value.replace(' . "/\([^\)]*\)/g,'(others typing)'" . '); ';
 if (file_exists('./sudoku_' . $thisset . '.html')) {
   $conthref=file_get_contents('./sudoku_' . $thisset . '.html');
   $reltwo=explode("}", $conthref);
   if (sizeof($reltwo) > 1) {
 //file_put_contents('./sudoku.8', ' ' . explode('{', $reltwo[0])[-1 + sizeof(explode('{', $reltwo[0]))] . ' ');
     $aswell.=' ' . explode('{', $reltwo[0])[-1 + sizeof(explode('{', $reltwo[0]))] . ' ';
   }
   $lhref='';
 }
 if (file_exists('./sudoku_' . $thatset . '.html')) {
   $conthref=file_get_contents('./sudoku_' . $thatset . '.html');
   $reltwo=explode("}", $conthref);
   if (sizeof($reltwo) > 1) {
//file_put_contents('./sudoku.9', ' ' . explode('{', $reltwo[0])[-1 + sizeof(explode('{', $reltwo[0]))] . ' ');
    $aswell.=' ' . explode('{', $reltwo[0])[-1 + sizeof(explode('{', $reltwo[0]))] . ' ';
   }
   $lhref='';
 }
// file_put_contents('./sudoku.7', '<html><body onload=" parent.document.getElementById(' . "'tam'" . ').value=' . "''" . '; ' . $aswell . ' ' . $lhref . '"></body></html>');
  $aswell.=' parent.document.getElementById(' . "'vsarrs'" . ').value=' . "'" . $vsarrs . "'" . '; ';
     echo '<html><body onload=" parent.document.getElementById(' . "'tam'" . ').value=' . "'x'" . '; ' . $aswell . ' ' . $lhref . '"></body></html>'; 
   }
 }
// if (file_exists('./sudoku.pleasewait')) {
//   unlink('./sudoku.pleasewait');
// }
 if (file_exists('./sudoku.firstpleasewait')) {
   if (strpos(file_get_contents('./sudoku.firstpleasewait'), ';' . $weare . ';' . $thisset . ';') !== false) {
     sleep(4);
     unlink('./sudoku.firstpleasewait');
   }
 }
 exit;
 } else if (isset($_GET['thegame']) && isset($_GET['settyping'])) {
 $thisset='' . str_replace('(','9',str_replace('*','8',str_replace('&','7',str_replace('^','6',str_replace('$','4',str_replace('#','3',str_replace('@','2',str_replace('!','1',str_replace('1','(',str_replace('2','*',str_replace('3','&',str_replace('4','^',str_replace('6','$',str_replace('7','#',str_replace('8','@',str_replace('9','!',str_replace('+',' ',urldecode($_GET['thegame']))))))))))))))))));
   //file_put_contents('./sudoku.x', $cuda . ' ;' . $weare . ';' . $thisset . ';');
   file_put_contents('./sudoku.firstpleasewait', $cuda . ' ;' . $weare . ';' . $thisset . ';');
 while (file_exists('./sudoku.pleasewait')) {
   sleep(1);
 }
   file_put_contents('./sudoku.pleasewait', $cuda . ' ;' . $weare . ';' . $thisset . ';');
 $allcontenty=file_get_contents(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'index.php');
 if (strpos($allcontenty, '/' . '*') !== false && strpos($allcontenty, '*' . '/') === false) {
   $allcontenty.="\n" . '*' . '/' . "\n" . '?' . '>';
 }
 if (strpos($allcontenty, $cuda . ';' . $weare . ';' . $thisset . ';') !== false) {
//file_put_contents('./x.1', $allcontenty);
  $allcontenty=str_replace($cuda . ';' . $weare . ';' . $thisset . ';', $cuda . ' ;' . $weare . ';' . $thisset . ';', $allcontenty);
  file_put_contents(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'index.php', $allcontenty);
 } else if (strpos($allcontenty, ';' . $thisset . ';') !== false && strpos($allcontenty, $cuda . ' ;' . $weare . ';' . $thisset . ';') === false) { // && strpos($allcontenty, ';' . $thisset . ';') !== false) {
//file_put_contents('./x.2', $allcontenty);
  $allcontenty=str_replace('*' . '/', $cuda . ' ;' . $weare . ';' . $thisset . ';' . "\n" . '*' . '/', $allcontenty);
  file_put_contents(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'index.php', $allcontenty);
 } //else {
//file_put_contents('./x.3', $allcontenty);
  //$allcontenty=str_replace('*' . '/', $cuda . ' ;' . $weare . ';' . $thisset . ';' . "\n" . '*' . '/', $allcontenty);
  //file_put_contents(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'index.php', $allcontenty);
 //}
 if (file_exists('./sudoku.pleasewait')) {
   unlink('./sudoku.pleasewait');
 }
 exit;
 } else if (isset($_GET['thegame']) && isset($_GET['typingunset'])) {
 $thisset='' . str_replace('(','9',str_replace('*','8',str_replace('&','7',str_replace('^','6',str_replace('$','4',str_replace('#','3',str_replace('@','2',str_replace('!','1',str_replace('1','(',str_replace('2','*',str_replace('3','&',str_replace('4','^',str_replace('6','$',str_replace('7','#',str_replace('8','@',str_replace('9','!',str_replace('+',' ',urldecode($_GET['thegame']))))))))))))))))));
 while (file_exists('./sudoku.pleasewait')) {
   sleep(1);
 }
   file_put_contents('./sudoku.pleasewait', $thisset);
 $allcontentz=file_get_contents(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'index.php');
 if (strpos($allcontentz, '/' . '*') !== false && strpos($allcontentz, '*' . '/') === false) {
   $allcontentz.="\n" . '*' . '/' . "\n" . '?' . '>';
 }
 if (strpos($allcontentz, $cuda . ' ;' . $weare . ';' . $thisset . ';') !== false) {
  $allcontentz=str_replace($cuda . ' ;' . $weare . ';' . $thisset . ';', $cuda . ';' . $weare . ';' . $thisset . ';', $allcontentz);
  file_put_contents(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'index.php', $allcontentz);
 }
 if (file_exists('./sudoku.pleasewait')) {
   unlink('./sudoku.pleasewait');
 }
// if (file_exists('./sudoku.firstpleasewait')) {
//   if (strpos(file_get_contents('./sudoku.firstpleasewait'), ';' . $weare . ';' . $thisset . ';') !== false) {
//     sleep(4);
//     unlink('./sudoku.firstpleasewait');
//   }
// }
 exit;
 } else if (isset($_GET['thegame']) && isset($_GET['random'])) {
 $thisset='' . str_replace('(','9',str_replace('*','8',str_replace('&','7',str_replace('^','6',str_replace('$','4',str_replace('#','3',str_replace('@','2',str_replace('!','1',str_replace('1','(',str_replace('2','*',str_replace('3','&',str_replace('4','^',str_replace('6','$',str_replace('7','#',str_replace('8','@',str_replace('9','!',str_replace('+',' ',urldecode($_GET['thegame']))))))))))))))))));
 $sofarx=";";
 $thisb="";
 $maxb="";
 $allcontentx=file_get_contents(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'index.php');
 if (strpos($allcontentx, '/' . '*') !== false && strpos($allcontentx, '*' . '/') === false) {
   $allcontentx.="\n" . '*' . '/' . "\n" . '?' . '>';
 }
 $lcsx=explode('/' . '*', $allcontentx);
 //file_put_contents('azx.azx', '' . sizeof($lcs) . ' ' . $cuda . ';' . $thisset);
 if (sizeof($lcsx) > 1) {
   $collabx=explode('*' . '/', $lcsx[1])[0];
   $linesx=explode("\n", $collabx);
   $thisxset=str_replace('+',' ',urldecode($_GET['thegame'])); //'' . str_replace('(','9',str_replace('*','8',str_replace('&','7',str_replace('^','6',str_replace('$','4',str_replace('#','3',str_replace('@','2',str_replace('!','1',str_replace('1','(',str_replace('2','*',str_replace('3','&',str_replace('4','^',str_replace('6','$',str_replace('7','#',str_replace('8','@',str_replace('9','!',str_replace('+',' ',urldecode($_GET['thegame']))))))))))))))))));
   //$thisxset='' . str_replace('(','9',str_replace('*','8',str_replace('&','7',str_replace('^','6',str_replace('$','4',str_replace('#','3',str_replace('@','2',str_replace('!','1',str_replace('1','(',str_replace('2','*',str_replace('3','&',str_replace('4','^',str_replace('6','$',str_replace('7','#',str_replace('8','@',str_replace('9','!',str_replace('+',' ',urldecode($_GET['thegame']))))))))))))))))));
   $taxbit="";
   for ($ilx=0; $ilx<sizeof($linesx); $ilx++) {
     if ($sofarx == ";") {
       $sofarx.=str_replace('   ',' + ',str_replace('+',' ',urldecode(explode(';', $linesx[$ilx])[1]))) . ';';
     } else if (sizeof(explode(';' . explode(';', $linesx[$ilx])[1] . ';', $sofarx)) == 1) {
       $maxb.=" ";
       $thisb=$maxb;
       $sofarx.=str_replace('   ',' + ',str_replace('+',' ',urldecode(explode(';', $linesx[$ilx])[1]))) . ';';
     } else {
       $rest=explode(';' . explode(';', $linesx[$ilx])[1] . ';', $sofarx)[0];
       $thisb="";
       if ($rest != "") {
         for ($iop=1; $iop<sizeof(explode(';', $rest)); $iop++) {
           $thisb.=" ";
         }
       }
     }
     $parts=explode('' . $thisxset . ';', $linesx[$ilx]);
     if (sizeof($parts) == 2) {
       if ($thisb . str_replace('   ',' + ',str_replace('+',' ',urldecode($parts[1]))) != '') {
         $taxbit=$thisb . str_replace('   ',' + ',str_replace('+',' ',urldecode($parts[1]))) . "\n" . $taxbit;
       }
     }
   }
   $lhref='';
   if ($taxbit != "") {
     echo '<html><body onload=" parent.document.getElementById(' . "'toright'" . ').style.display=' . "'table-cell'" . '; parent.document.getElementById(' . "'tais'" . ').value=' . "'" . str_replace("\n","' + String.fromCharCode(10) + '",str_replace("\n\n","\n",$taxbit)) . "'" . '; ' . $lhref . ' "></body></html>'; 
   }
 }
 exit;
 } else if (isset($_GET['thegame']) && 1 == 11) {
 $thisset='' . str_replace('(','9',str_replace('*','8',str_replace('&','7',str_replace('^','6',str_replace('$','4',str_replace('#','3',str_replace('@','2',str_replace('!','1',str_replace('1','(',str_replace('2','*',str_replace('3','&',str_replace('4','^',str_replace('6','$',str_replace('7','#',str_replace('8','@',str_replace('9','!',str_replace('+',' ',urldecode($_GET['thegame']))))))))))))))))));
 echo '<html><body onload="document.getElementById(' . "'mys'" . ').click();"><form method=POST action=./index.php target=_self><input type=hidden name=thegame value="' . $thisset . '"></input><input id=mys type=submit style=display:none; value=Submit></input></form></body></html>';
 exit;
 } else if (isset($_POST['thegame']) && 1 == 1) {
 $_GET['thegame']=$_POST['thegame'];
 } else if (isset($_GET['startgame'])) {
 $wel="Last chat you contributed was ... Welcome to our Sudoku game!";
 }
 
 $initiator='0';
 if (isset($_GET['startgame'])) {
   $initiator='1';
 } else if (strpos($_SERVER['QUERY_STRING'], 'startgame=') !== false) {
   $initiator='1';
 }
 $changes=false;
 $totallyrellinenum=-1;
 $starth='';
 $jsis="\n<scr" . "ipt type='text/javascript'>
   var prevvs='-1';
   var tabit='';
   var thenums='';
   var yourname='';
   var amhost=false;
   var lastbofyours='';
   var ioffis=eval(-1 * eval(Math.floor(Math.random() * 16) + 17));
   var amtyping=false, theytyping=false;
   var prevamtyping=false, prevtheytyping=false;
   var mapfrom=[];
   var mapto=[];
   var mapft='';
   
   function domaps() {
     if (mapfrom.length > 0) {
       for (var ii=0; ii<mapfrom.length; ii++) {
         document.getElementById('sudokui').placeholder=document.getElementById('sudokui').placeholder.replace('(' + mapfrom[ii] + ' ', '(' + mapto[ii] + ' ').replace(' ' + mapfrom[ii] + ' ', ' ' + mapto[ii] + ' ');
       }
     }
   }
   
   function mapfromto(ifrom, ito) {
    if (mapft.indexOf(' ' + ifrom + ' ' + ito + ' ') == -1) {
     if (mapft.indexOf(' ' + ifrom + ' ') != -1) {
     for (var ik=0; ik<mapfrom.length; ik++) {
     if (mapfrom[ik] == ifrom) { mapto[ik] = ito; }
     }
     } else {
     mapfrom.push(ifrom);
     mapto.push(ito);
     }
     mapft+=' ' + ifrom + ' ' + ito + ' ';
    }
   }
   
   function pargyn() {
     return yourname;
   }
   
   function settyping() {
     var ejj=0;
     if (!amtyping) {
      amtyping=true;
     thenums='';
    var esels=document.getElementsByTagName('select');
    for (ejj=0; ejj<esels.length; ejj++) {
      if (('' + esels[ejj].id) != 'smode') {
        thenums+=retcn(esels[ejj].getAttribute('data-answer'));
      }
    }
      document.getElementById('znotif').src='./index.php?thegame=' + tenminus(thenums.substring(0,81)) + '&settyping=&rdm=' + Math.floor(Math.random() * 19876756);
     //} else if (1 == 1) {
     //  ejj=ejj; //document.getElementById('znotif').src='./sudoku_' + tenminus(thenums.substring(0,81)) + '.html';
     } else if (document.getElementById('tam').title != 'I') {
      amtyping=true;
    var xesels=document.getElementsByTagName('select');
    for (ejj=0; ejj<xesels.length; ejj++) {
      if (('' + xesels[ejj].id) != 'smode') {
        thenums+=retcn(xesels[ejj].getAttribute('data-answer'));
      }
    }
      document.getElementById('znotif').src='./index.php?thegame=' + tenminus(thenums.substring(0,81)) + '&settyping=&rdm=' + Math.floor(Math.random() * 19876756);
     } //else {
      //console.log('tamt=' + document.getElementById('tam').title);
     //}
   }
   
   function typingunset() {
     var ejj=0;
     if (amtyping || 1 == 1) {
      amtyping=false;
     thenums='';
    var esels=document.getElementsByTagName('select');
    for (ejj=0; ejj<esels.length; ejj++) {
      if (('' + esels[ejj].id) != 'smode') {
        thenums+=retcn(esels[ejj].getAttribute('data-answer'));
      }
    }
      document.getElementById('znotif').src='./index.php?thegame=' + tenminus(thenums.substring(0,81)) + '&typingunset=&rdm=' + Math.floor(Math.random() * 19876756);
     } else if (document.getElementById('tam').title == 'I') {
      amtyping=false;
     thenums='';
    var xesels=document.getElementsByTagName('select');
    for (ejj=0; ejj<xesels.length; ejj++) {
      if (('' + xesels[ejj].id) != 'smode') {
        thenums+=retcn(xesels[ejj].getAttribute('data-answer'));
      }
    }
      document.getElementById('znotif').src='./index.php?thegame=' + tenminus(thenums.substring(0,81)) + '&typingunset=';
     }
   }
   
   function zit(inz) {
    var xblk='000000000';
    var outz='';
    var inzs=inz.split('');
    for (var jin=0; jin<inzs.length; jin++) {
      outz+=xblk.substring(0,eval(Math.floor(Math.random() * 5) + 1));
      outz+=inzs[jin];
    }
    outz+=xblk.substring(0,eval(Math.floor(Math.random() * 5) + 1));
    return outz;
   }
   
   function tenminus(instg) {
     var outstg='';
     for (var ih=0; ih<instg.length; ih++) {
       if (instg.substring(ih).substring(0,1) != '0') {
         outstg+='' + eval(10 - eval('' + instg.substring(ih).substring(0,1)));
       }
     }
     return outstg;
   }
      
   function aeclick(athis) {
     var orighref=athis.href;
     var onex='youllneverfindthis';
     var twox='youllneverfindthis';
     var threex='youllneverfindthis';
     var fourx='youllneverfindthis';
     var aeto=prompt('Please enter email address to invite regarding this Sudoku game collaboration and sharing.  Optionally prefix by your Sudoku playing name and a : colon character.', '');
     if (aeto == null) { aeto=''; }
     if (aeto.indexOf('@') != -1) {
     aeto=aeto.replace(/\;/g,',').replace(/\ /g,'');
     if (aeto.indexOf(':') != -1) {
       yourname=aeto.split(':')[0];
       mapfromto('" . $weare . "', yourname);
       document.getElementById('ibb').value=document.getElementById('ibb').value.replace(' your name', ' ' + yourname);
       aeto=aeto.replace(yourname + ':', '');
     }
     if (yourname != '') {
       onex='?subject=';
       twox='?subject=' + encodeURIComponent(yourname + ' here playing Sudoku online. ');
       threex='?startgame=';
       fourx='?yourname=' + encodeURIComponent(yourname) + '&startgame=';
     }
    var esels=document.getElementsByTagName('select');
    thenums='';
    for (var ejj=0; ejj<esels.length; ejj++) {
      if (('' + esels[ejj].id) != 'smode') {
        thenums+=retcn(esels[ejj].getAttribute('data-answer'));
      }
    }
      amhost=true;
      document.getElementById('sudokuif').src=('./index.php?startgame=' + thenums.substring(0,81)).replace(threex,fourx);
      athis.href=(athis.href.replace(onex,twox) + encodeURIComponent(document.URL.replace('httJUNKps:','http:').split('?')[0].split('#')[0] + '?thegame=' + zit(tenminus(thenums.substring(0,81))))).replace('mailto:?', 'mailto:' + aeto + '?');
      athis.click();
      athis.href=orighref;
     }
   }
   
   function asclick(athis) {
     var orighref=athis.href;
     var onex='youllneverfindthis';
     var twox='youllneverfindthis';
     var threex='youllneverfindthis';
     var fourx='youllneverfindthis';
     var aeto=prompt('Please enter SMS number to invite regarding this Sudoku game collaboration and sharing.   Optionally prefix by your Sudoku playing name and a : colon character.', '');
     if (aeto == null) { aeto=''; }
     aeto=aeto.replace(/\;/g,',').replace(/\ /g,'');
     if (aeto.indexOf(':') != -1) {
       yourname=aeto.split(':')[0];
       mapfromto('" . $weare . "', yourname);
       document.getElementById('ibb').value=document.getElementById('ibb').value.replace(' your name', ' ' + yourname);
       aeto=aeto.replace(yourname + ':', '');
     }
     //if (aeto.indexOf('@') != -1) {
     if (yourname != '') {
       onex='&body=';
       twox='&body=' + encodeURIComponent(yourname + ' here playing Sudoku online. ');
       threex='?startgame=';
       fourx='?yourname=' + encodeURIComponent(yourname) + '&startgame=';
     }
    var esels=document.getElementsByTagName('select');
    thenums='';
    for (var ejj=0; ejj<esels.length; ejj++) {
      if (('' + esels[ejj].id) != 'smode') {
        thenums+=retcn(esels[ejj].getAttribute('data-answer'));
      }
    }
      amhost=true;
      document.getElementById('sudokuif').src=('./index.php?startgame=' + thenums.substring(0,81)).replace(threex,fourx);
      athis.href=(athis.href.replace(onex,twox) + encodeURIComponent(document.URL.replace('httJUNKps:','http:').split('?')[0].split('#')[0] + '?thegame=' + zit(tenminus(thenums.substring(0,81))))).replace('sms:&', 'sms:' + aeto + '&');
      athis.click();
      athis.href=orighref;
     //}
   }
   
   function iblur(ithis) {
    thenums='';
    var esels=document.getElementsByTagName('select');
    for (var ejj=0; ejj<esels.length; ejj++) {
      if (('' + esels[ejj].id) != 'smode') {
        thenums+=retcn(esels[ejj].getAttribute('data-answer'));
      }
    }
     if (ithis.value.trim() != '' && eval('' + thenums.length) >= 81) {
      if (yourname == '' && ithis.value.indexOf(':') != -1) {
        yourname=ithis.value.split(':')[0];
        mapfromto('" . $weare . "', yourname);
        document.getElementById('ibb').value=document.getElementById('ibb').value.replace(' your name', ' ' + yourname);
      } else if (ithis.value.indexOf(':') != -1) {
        if (ithis.value.split(':')[0].indexOf(' ') == -1) {
          document.getElementById('ibb').value=document.getElementById('ibb').value.replace(' ' + yourname, ' ' + ithis.value.split(':')[0]).replace(' your name', ' ' + ithis.value.split(':')[0]);
          yourname=ithis.value.split(':')[0];
          mapfromto('" . $weare . "', yourname);
        }
      }
     //alert('yes');
      ithis.value=ithis.value.replace(/\//g,' ').replace('*',' ').replace('*',' ').replace('*',' ').replace('*',' ').replace('*',' ').replace('*',' ').replace('*',' ').replace('*',' ').replace('*',' ').replace(/\;/g,' ').replace(/\\\"/g,' ').replace(/\'/g,' ').replace(/\(/g,'{').replace(/\)/g,'}');
      if (yourname.trim() != '' && ithis.value.indexOf(':') == -1) {
        ithis.value=yourname + ': ' + ithis.value;
      }
      lastbofyours=ithis.value;
      document.getElementById('sudokuif').src='./index.php?thegame=' + tenminus(thenums.substring(0,81)) + '&newmsg=' + encodeURIComponent(ithis.value);
      var hdate=new Date();
      ithis.title='Last chat you contributed at ' + hdate + ' was ... ' + ithis.value.replace(String.fromCharCode(34),String.fromCharCode(39)).replace(String.fromCharCode(34),String.fromCharCode(39)); 
      ithis.value='';
      ithis.placeholder='Optionally chat here' + document.getElementById('ibb').value + ' ... last chat was at ' + hdate;
     } //else {
     //alert('no');
     //}
   }
   
   function retnc(sv) {
     //if (sv >= '0' && sv <= '9') {
     //  return sv;
     //}
     return String.fromCharCode(eval(sv.charCodeAt(0) + Math.abs(ioffis)));
   }
   
   function retcn(sv) {
     if (sv >= '0' && sv <= '9') {
       if (sv == '0') { return ''; }
       return sv;
     }
     return String.fromCharCode(eval(sv.charCodeAt(0) - Math.abs(ioffis)));
   }
   
   function tacheck() {
    var esels=document.getElementsByTagName('select');
    var onechar=' ', twochar=' ';
    thenums='';
    for (var ejj=0; ejj<esels.length; ejj++) {
      if (('' + esels[ejj].id) != 'smode') {
        thenums+=retcn(esels[ejj].getAttribute('data-answer'));
      }
    }
    if (eval('' + thenums.length) < 81) {
      thenums='';
      setTimeout(tacheck, 3000);
    } else if (ioffis != 0) {
    xn();
    for (var iejj=0; iejj<esels.length; iejj++) {
      if (('' + esels[iejj].id) != 'smode') {
        twochar=esels[iejj].getAttribute('data-answer');
        onechar=String.fromCharCode(eval(Math.abs(ioffis) + twochar.charCodeAt(0)));
        //alert(esels[iejj].getAttribute('data-answer') + ' vs twochar=' + twochar + ' vs onechar=' + onechar + ' ioffis=' + ioffis + ' twochar.charCodeAt(0)=' + twochar.charCodeAt(0));
        esels[iejj].setAttribute('data-answer', onechar);
      }
    }
    ioffis=Math.abs(ioffis);
    }     
   }
   
   function ifcheck() {
    var isclear=true;
    if (eval('' + thenums.length) >= 81) {
      document.getElementById('sudokuif').src='./index.php?thegame=' + thenums.substring(0,81) + '&random=' + encodeURIComponent(Math.floor(Math.random() * 19878654));
     var vstabit=tabit;
     if (document.getElementById('tais')) {
       vstabit=document.getElementById('tais').value;
       if (vstabit != tabit) {
         document.getElementById('tais').rows='' + vstabit.split(String.fromCharCode(10)).length;
         tabit=vstabit;
         var hhdate=new Date();
         document.getElementById('sudokui').placeholder='Optionally chat here' + document.getElementById('ibb').value + ' ... last chat was at ' + hhdate;
         document.getElementById('sudokui').focus();
         if (document.getElementById('tais').value.split(String.fromCharCode(10))[0].trim() != '') {
         if ((lastbofyours.indexOf(document.getElementById('tais').value.split(String.fromCharCode(10))[0].trim()) != -1 && document.getElementById('tais').value.split(String.fromCharCode(10))[0].trim() != '' && lastbofyours != '') || (amhost && document.getElementById('tais').value.split(String.fromCharCode(10))[0].indexOf('Welcome to our Sudoku game') != -1)) {
         tabit=tabit;
         } else {
         if (yourname.trim() != '' && document.getElementById('tais').value.split(String.fromCharCode(10))[0].indexOf(':') == -1) {
         isclear=false;
         document.getElementById('notif').src='/HTMLCSS/notifications_ideas.php?scheduledblurb=' + encodeURIComponent(document.getElementById('tais').value.split(String.fromCharCode(10))[0] + ' (' + yourname + ')');
         } else {
         isclear=false;
         document.getElementById('notif').src='/HTMLCSS/notifications_ideas.php?scheduledblurb=' + encodeURIComponent(document.getElementById('tais').value.split(String.fromCharCode(10))[0]);
         }
         }
         }
       }
     }
     if (1 == 1 || isclear) { // || amhost) {
     thenums='';
    var esels=document.getElementsByTagName('select');
    for (var ejj=0; ejj<esels.length; ejj++) {
      if (('' + esels[ejj].id) != 'smode') {
        thenums+=retcn(esels[ejj].getAttribute('data-answer'));
      }
    }
      //document.title=tenminus(thenums.substring(0,81));
      if (yourname != '') {
      if (!amhost) {
      document.getElementById('znotif').src='./index.php?thegame=' + tenminus(thenums.substring(0,81)) + '&yourname=' + encodeURIComponent(yourname) + '&askingforafriend=' + encodeURIComponent(document.getElementById('tam').value);
      } else {
      document.getElementById('znotif').src='./index.php?thegame=' + tenminus(thenums.substring(0,81)) + '&yourname=' + encodeURIComponent(yourname) + '&askingforafriend=' + encodeURIComponent(document.getElementById('tam').value);
      }
      } else if (!amhost) {
      document.getElementById('znotif').src='./index.php?thegame=' + tenminus(thenums.substring(0,81)) + '&askingforafriend=' + encodeURIComponent(document.getElementById('tam').value);
      } else {
      document.getElementById('znotif').src='./index.php?thegame=' + tenminus(thenums.substring(0,81)) + '&askingforafriend=' + encodeURIComponent(document.getElementById('tam').value);
      }
     }
    }
   }
   
   function aftervn() {
     if (prevvs != document.getElementById('vsarrs').value) {
     thenums='';
     var esels=document.getElementsByTagName('select');
     for (var ejj=0; ejj<esels.length; ejj++) {
      if (('' + esels[ejj].id) != 'smode') {
        thenums+=retcn(esels[ejj].getAttribute('data-answer'));
      }
     }
       prevvs=document.getElementById('vsarrs').value;
       document.getElementById('xnotif').src='./index.php?vsarrs=' + encodeURIComponent(prevvs) + '&namecheck=y&myname=' + encodeURIComponent(yourname) + '&ipme=" . urlencode($weare) . "' + '&thegame=' + (thenums.substring(0,81)) + '&rnd=' + Math.floor(Math.random() * 198765643);
     }
     domaps();
   }
   
   function xn() {
     if (1 == 1) {
     thenums='';
     var esels=document.getElementsByTagName('select');
     for (var ejj=0; ejj<esels.length; ejj++) {
      if (('' + esels[ejj].id) != 'smode') {
        thenums+=retcn(esels[ejj].getAttribute('data-answer'));
      }
     }
     prevvs=document.getElementById('vsarrs').value;
     document.getElementById('xnotif').src='./index.php?vsarrs=' + encodeURIComponent(prevvs) + '&namecheck=y&myname=' + encodeURIComponent(yourname) + '&ipme=" . urlencode($weare) . "' + '&thegame=' + (thenums.substring(0,81)) + '&rnd=' + Math.floor(Math.random() * 198765643);
     setInterval(aftervn, 3000);
     }
   }
      
   setTimeout(tacheck, 3000);
   setInterval(ifcheck, 3000);
</scr" . "ipt>\n";

 function server_remote_addr() {
    global $stfle;
    $rma = $_SERVER['REMOTE_ADDR'];
    $ua = strtolower($_SERVER['HTTP_USER_AGENT']);
    // you can add different browsers with the same way ..
    //file_put_contents('xx.xx', $ua);
    if(preg_match('/(opr)[ \/]([\w.]+)/', $ua))
            $rma = '000'.$rma;
    elseif(preg_match('/(chromium)[ \/]([\w.]+)/', $ua))
            $rma = '000000'.$rma;
    elseif(preg_match('/(chrome)[ \/]([\w.]+)/', $ua))
            $rma = '00000'.$rma;
    elseif(preg_match('/(safari)[ \/]([\w.]+)/', $ua))
            $rma = '0000'.$rma;
    elseif(preg_match('/(opera)[ \/]([\w.]+)/', $ua))
            $rma = '000'.$rma;
    elseif(preg_match('/(msie)[ \/]([\w.]+)/', $ua))
            $rma = '00'.$rma;
    elseif(preg_match('/(mozilla)[ \/]([\w.]+)/', $ua))
            $rma = '0'.$rma;
    return str_replace(":", "_", $rma);
 }

 while (file_exists('./sudoku.pleasewait')) {
   sleep(1);
 }
 $thisset='youllneverfind' . 'this';
// // file_put_contents('azxpp.azxpp', '' . $_SERVER['QUERY_STRING']);
 if (isset($_GET['thegame']) || isset($_POST['thegame'])) {
   if (isset($_GET['thegame'])) {
   $thisset='' . str_replace('0','',str_replace('(','9',str_replace('*','8',str_replace('&','7',str_replace('^','6',str_replace('$','4',str_replace('#','3',str_replace('@','2',str_replace('!','1',str_replace('1','(',str_replace('2','*',str_replace('3','&',str_replace('4','^',str_replace('6','$',str_replace('7','#',str_replace('8','@',str_replace('9','!',str_replace('+',' ',urldecode($_GET['thegame'])))))))))))))))))));
   } else {
   $thisset='' . str_replace('0','',str_replace('(','9',str_replace('*','8',str_replace('&','7',str_replace('^','6',str_replace('$','4',str_replace('#','3',str_replace('@','2',str_replace('!','1',str_replace('1','(',str_replace('2','*',str_replace('3','&',str_replace('4','^',str_replace('6','$',str_replace('7','#',str_replace('8','@',str_replace('9','!',str_replace('+',' ',urldecode($_POST['thegame'])))))))))))))))))));
   }
   file_put_contents('./sudoku.pleasewait', $thisset);
 } else if (isset($_GET['startgame'])) {
// //  file_put_contents('azxppp.azxppp', '');
   $initiator='1';
   $thisset='' . str_replace('+',' ',urldecode($_GET['startgame']));
   file_put_contents('./sudoku.pleasewait', $thisset);
   $changes=true;
 } else {
   file_put_contents('./sudoku.pleasewait', 'y');
 }
 $allcontent=file_get_contents(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'index.php');
 if (strpos($allcontent, '/' . '*') !== false && strpos($allcontent, '*' . '/') === false) {
   $allcontent.="\n" . '*' . '/' . "\n" . '?' . '>';
 }
 $collab='';
 $tabit='';
 $lines=[];
 $rellines=[];
 $leavelines=[];
 $cuda=date('D, d M Y');
 $amt="";
 $weare='' . server_remote_addr();
 $lcs=explode('/' . '*', $allcontent);
 //file_put_contents('azx.azx', '' . sizeof($lcs) . ' ' . $cuda . ';' . $thisset);
 if (sizeof($lcs) > 1) {
   $collab=explode('*' . '/', $lcs[1])[0];
   $lines=explode("\n", $collab);
// //  file_put_contents('azxp.azxp', '' . sizeof($lines) . ' ' . $cuda . "\n" . substr($thisset,0,81) . "\n" . $lines[0] . "\n" . $lines[1]);
   for ($il=0; $il<sizeof($lines); $il++) {
     if (trim($lines[$il]) == '') {
       $collab=$collab;
     } else if (strpos($lines[$il], ';' . substr($thisset,0,81) . ';') !== false) {
// //  file_put_contents('azxv.azxv', '' . sizeof($lcs));
       if ($initiator == '0' || (isset($_GET['newmsg']) && strlen($_GET['newmsg']) == 0)) {
// //  file_put_contents('azxw.azxw', '' . sizeof($lcs));
        if (explode(';' . substr($thisset,0,81) . ';', $lines[$il])[1] != '') {
          $tabit=str_replace('   ',' + ',str_replace('+',' ',urldecode(explode(';' . substr($thisset,0,81) . ';', $lines[$il])[1]))) . "\n" . $tabit;
        }
        array_push($leavelines, $lines[$il] . "\n");
        array_push($rellines, $lines[$il] . "\n");
        if (strpos($lines[$il], ';' . $weare . ';') !== false && isset($_GET['newmsg'])) {
         $totallyrellinenum=(-1 + sizeof($leavelines));
         $changes=true;
        } else {
         $changes=true; // new
        }
        //$changes=true; // new
       } else {
// //  file_put_contents('azxx.azxx', '' . sizeof($lcs));
        array_push($leavelines, $lines[$il] . "\n");
        $changes=true;
       }
       // $changes=true; // new
     } else if (strpos($lines[$il], ($cuda . ';')) !== false || strpos($lines[$il], ($cuda . ' ;')) !== false) {
// //  file_put_contents('azxy.azxy', '' . sizeof($lcs));
       array_push($leavelines, $lines[$il] . "\n");
     } else {
// //  file_put_contents('azxz.azxz', '' . $cuda . ';');
       $changes=true;
     }
   }
 }
 
 if (isset($_GET['newmsg'])) { 
  $changes=true;         
  if (strlen($_GET['newmsg']) > 0) {
    $tabit=str_replace('   ',' + ',str_replace('+',' ',urldecode($_GET['newmsg']))) . "\n" . $tabit; 
  }
 }

 //if (file_exists('./sudoku.htm')) {
 //  echo file_get_contents('./sudoku.htm');
 //} else if (file_exists('./sudoku.html')) {
 //  echo file_get_contents('./sudoku.html');
 //}
 
 if ($changes && sizeof($lcs) > 1) {
   if (file_exists('./sudoku.htm')) {
     $starth=file_get_contents(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'sudoku.htm');
   } else if (file_exists('./sudoku.html')) {
     $starth=file_get_contents(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'sudoku.html');
   }
   $starth=str_replace("<scr" . "ipt type='text/javascript'>", explode("</scr" . "ipt>", $jsis)[0], $starth);
   $jsis="";
   $starth=str_replace('</bo' . 'dy>', '<input type=hidden title="' . $weare . '" value="' . $weare . '" id=iam></input><input type=hidden title="" value="" id=tam></input><input type=hidden value="" id=iat></input><input type=hidden value=" (bit before a colon is your name)" id=ibb></input><iframe id=notif src="./index.php?noaction=y" style="display:none;"></iframe><input type=hidden id=vsarrs value="-1"></input><iframe id=znotif src="./index.php?noaction=y" style="display:none;"></iframe><iframe id=xnotif src="./index.php?noaction=y" style="display:none;"></iframe><iframe id=sudokuif src="./index.php?noaction=y" style="display:none;"></iframe><a id=aemail style=display:none; target=_blank href="mailto:?subject=Sudoku%20game%20share%20invitation%20link%20&body=">Email</a><a id=asms style=display:none; target=_blank href="sms:&body=Sudoku%20game%20share%20invitation%20link%20">SMS</a>' . $jsis . '</bo' . 'dy>', $starth);
   $starth=str_replace('</t' . 'h><t' . '', '&nbsp;<button title="Email collaboration and sharing" onclick="aeclick(document.getElementById(' . "'" . 'aemail' . "'" . '));">&#128231;</button>&nbsp;<button title="SMS collaboration and sharing" onclick="asclick(document.getElementById(' . "'" . 'asms' . "'" . '));">&#128223;</button>&nbsp;<button style=background-color:yellow; onclick=checksels();>Check My Answers</button>&nbsp;<button style=background-color:orange; onclick="location.href=document.URL;">New Game</button></t' . 'h><t' . '', $starth);
   if (isset($_POST['thegame'])) {
    $starth=str_replace("'485719362937264815612583794269456173378126549154937628543672981896341257721895436')]", "'" . str_replace('0','',$_POST['thegame']) . "')]", $starth);
   }
   $starth=str_replace("location.search.split('thegame=')[1] ? decodeURIComponent(", "location.search.split('thegame=')[1] ? tenminus(", $starth);
   if (sizeof($rellines) > 0 || isset($_GET['newmsg'])) {
 //file_put_contents('azxww.azxww', '' . $starth);
     $starth=str_replace('</t' . 'h></t' . 'r', '</t' . 'h><t' . 'h id=toright><input onkeydown="settyping();" onblur="typingunset(); iblur(this);" type=text placeholder="Optionally chat here (bit before a colon is your name) ..." id=sudokui value=""></input><br><br><textarea id=tais rows=3 cols=80 value="">' . str_replace("<br><br>","<br>",str_replace("\n\n","\n",$tabit)) . '</textarea></t' . 'h></t' . 'r', $starth);
   }
   $sofar=$lcs[0] . '/' . '*' . "\n";
   for ($jl=0; $jl<sizeof($leavelines); $jl++) {
     $sofar.=$leavelines[$jl];
   }
 $initiator='0';
 if (isset($_GET['startgame']) || isset($_GET['newmsg'])) {
   $initiator='1';
// //  file_put_contents('azxxa.azxxa', '' . $totallyrellinenum . ' ... ' . $initiator);
 } else if (strpos($_SERVER['QUERY_STRING'], 'startgame=') !== false) {
   $initiator='1';
 file_put_contents('azxxb.azxxb', '' . $totallyrellinenum . ' ... ' . $initiator);
 }
 //file_put_contents('azxx.azxx', '' . $totallyrellinenum . ' ... ' . $initiator);
   if (isset($_GET['newmsg']) && strlen($_GET['newmsg']) > 0) {
     if (strlen($_GET['newmsg']) > 0) {
     $sofar.=$cuda . $amt . ';' . $weare . ';' . substr($thisset,0,81) . ';' . urlencode(str_replace('+',' ',urldecode($_GET['newmsg']))) . "\n" . '*' . '/' . "\n" . '?' . '>';
     }
// //  file_put_contents('azxxf.azxxf', '' . $sofar);
   } else if ($totallyrellinenum >= 0) {
     $sofar.=$cuda . $amt . ';' . $weare . ';' . substr($thisset,0,81) . ';' . urlencode(str_replace('+',' ',urldecode($_GET['newmsg']))) . "\n" . '*' . '/' . "\n" . '?' . '>';
        } else if ($initiator != '0' || isset($_GET['startgame'])) {
// //  file_put_contents('azxxcc.azxxcc', '' . $totallyrellinenum . ' ... ' . $initiator);
     if (isset($_GET['yourname'])) {
     $sofar.=$cuda . $amt . ';' . $weare . ';' . substr($thisset,0,81) . ';' . urlencode(str_replace('+',' ',urldecode($_GET['yourname'])) . ': Welcome to our Sudoku game!') . "\n" . '*' . '/' . "\n" . '?' . '>';
     } else {
     $sofar.=$cuda . $amt . ';' . $weare . ';' . substr($thisset,0,81) . ';' . urlencode('Welcome to our Sudoku game!') . "\n" . '*' . '/' . "\n" . '?' . '>';
     }
// //  file_put_contents('azxxe.azxxe', '' . $sofar);
   } else if (isset($_GET['newmsg'])) {
     if (strlen($_GET['newmsg']) > 0) {
     $sofar.=$cuda . $amt . ';' . $weare . ';' . substr($thisset,0,81) . ';' . urlencode(str_replace('+',' ',urldecode($_GET['newmsg']))) . "\n" . '*' . '/' . "\n" . '?' . '>';
     }
// //  file_put_contents('azxxf.azxxf', '' . $sofar);
   } else {
// //  file_put_contents('azxxff.azxxff', '' . $sofar);
   if (strpos($sofar, '?' . '>') === false) { $sofar.='*' . '/' . "\n" . '?' . '>'; }
   }
   $sofar=str_replace('sudokuif src="./index.php?noaction=y"', 'sudokuif src="./index.php?noaction=y"', $sofar);
// //  file_put_contents('azxxd.azxxd', '' . $sofar);
 if (strpos($sofar, '/' . '*') !== false && strpos($sofar, '*' . '/') === false) {
   $sofar.="\n" . '*' . '/' . "\n" . '?' . '>';
 }
   $iw=file_put_contents(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'index.php', $sofar);
// //    if ($iw == 0) { file_put_contents('azxxddd.azxxddd', '' . dirname(__FILE__) . DIRECTORY_SEPARATOR . 'index.php');  } else {  file_put_contents('azxxddd.azxxddd', '' . $ix);  }
 } else if (sizeof($lcs) > 1) {
   if (file_exists('./sudoku.htm')) {
     $starth=file_get_contents(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'sudoku.htm');
   } else if (file_exists('./sudoku.html')) {
     $starth=file_get_contents(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'sudoku.html');
   }
   $starth=str_replace("<scr" . "ipt type='text/javascript'>", explode("</scr" . "ipt>", $jsis)[0], $starth);
   $jsis="";
   $starth=str_replace('</bo' . 'dy>', '<input type=hidden title="' . $weare . '" value="' . $weare . '" id=iam></input><input type=hidden value="" id=tam></input><input type=hidden value=" (bit before a colon is your name)" id=ibb></input><input type=hidden value="" id=iat></input><iframe id=notif src="./index.php?noaction=y" style="display:none;"></iframe><iframe id=xnotif src="./index.php?noaction=y" style="display:none;"></iframe><input type=hidden id=vsarrs value="-1"></input><iframe id=znotif src="./index.php?noaction=y" style="display:none;"></iframe><iframe id=sudokuif src="./index.php?noaction=y" style="display:none;"></iframe><a id=aemail style=display:none; target=_blank href="mailto:?subject=Sudoku%20game%20share%20invitation%20link%20&body=">Email</a><a id=asms style=display:none; target=_blank href="sms:&body=Sudoku%20game%20share%20invitation%20link%20">SMS</a>' . $jsis . '</bo' . 'dy>', $starth);
   $starth=str_replace('</t' . 'h><t' . '', '&nbsp;<button title="Email collaboration and sharing" onclick="aeclick(document.getElementById(' . "'" . 'aemail' . "'" . '));">&#128231;</button>&nbsp;<button title="SMS collaboration and sharing" onclick="asclick(document.getElementById(' . "'" . 'asms' . "'" . '));">&#128223;</button>&nbsp;<button style=background-color:yellow; onclick=checksels();>Check My Answers</button>&nbsp;<button style=background-color:orange; onclick="location.href=document.URL;">New Game</button></t' . 'h><t' . '', $starth);
   if (isset($_POST['thegame'])) {
    $starth=str_replace("'485719362937264815612583794269456173378126549154937628543672981896341257721895436')]", "'" . str_replace('0','',$_POST['thegame']) . "')]", $starth);
   }
   $starth=str_replace("location.search.split('thegame=')[1] ? decodeURIComponent(", "location.search.split('thegame=')[1] ? tenminus(", $starth);
   if (sizeof($rellines) > 0) {
 //file_put_contents('azxw.azxw', '' . $starth);
     $starth=str_replace('</t' . 'h></t' . 'r', '</t' . 'h><t' . 'h id=toright><input onkeydown="settyping();" onblur="typingunset(); iblur(this);" type=text title="' . $wel . '" placeholder="Optionally chat here (bit before a colon is your name) ..." id=sudokui value=""></input><br><br><textarea id=tais rows=3 cols=50 value=""></textarea></t' . 'h></t' . 'r', $starth);
   }
 }

 if ($starth != '') {
   if (isset($_GET['newmsg'])) {
    if (strlen($_GET['newmsg']) > 0) {
     $starth=str_replace('y onload="', 'y onload=" parent.document.getElementById(' . "'tais'" . ').value=' . "'" . str_replace('+',' ',urldecode($_GET['newmsg'])) . "'" . ' + String.fromCharCode(10) + parent.document.getElementById(' . "'tais'" . ').value; ', $starth); 
    } else {
     $starth=str_replace('y onload="', 'y onload=" parent.document.getElementById(' . "'tais'" . ').value=' . "'" . str_replace("\n","' + String.fromCharCode(10) + '",str_replace("\n\n","\n",$tabit)) . "'" . '; ', $starth); 
    }
   }
   echo $starth;
 } else if (file_exists('./sudoku.htm')) {
   echo file_get_contents('./sudoku.htm');
 } else if (file_exists('./sudoku.html')) {
   echo file_get_contents('./sudoku.html');
 } else {
?>
<html>
<head>
<title>Sudoku - RJM Programming - December 2022 - Sudoku</title>
<style>
 .bright { border-right: 5px solid black; }
 .bbottom { border-bottom: 5px solid black; }
 td { font-size: 24px; width: 11%; height: 9%; text-align: center; vertical-align: middle; }
 select { font-size: 24px; }
 th { text-align: left; vertical-align: top; }
 textarea { width: 95%; background-image: linear-gradient(rgba(255,255,0,0.5) 18px, white 8%); }
 input { width: 95%; }
</style>
<script type='text/javascript'>
  var hrecs=['','','','','','','','',''];
  var lines=['','','','','','','','',''];
  var squares=['','','','','','','','',''];
  var mustbeguessed=location.search.split('mustbeguessed=')[1] ? decodeURIComponent(location.search.split('mustbeguessed=')[1].split('&')[0]) : '';
  var mustnotbeguessed=location.search.split('mustnotbeguessed=')[1] ? decodeURIComponent(location.search.split('mustnotbeguessed=')[1].split('&')[0]) : '';
  var gls=getls();
  var stemp="<select data-answer=\" \" id=xxx><option value=\" \"> </option><option value='1'>1</option><option value='2'>2</option><option value='3'>3</option><option value='4'>4</option><option value='5'>5</option><option value='6'>6</option><option value='7'>7</option><option value='8'>8</option><option value='9'>9</option></select>";
  var okay=false;
  var goes=0;
  var easyarr=',3,4,7,10,12,14,15,19,20,27,28,29,30,32,34,39,41,44,45,49,51,52,55,57,59,61,67,68,70,71,74,75,76,80,';
  var hardarr=',1,5,8,9,13,19,21,28,33,36,37,39,43,49,52,54,61,62,63,67,69,70,72,80,';
  var ipuzzle=-1;
  var puzzles=[
  '684159732751832946923674185192365874845217693367498251239746518516983427478521369',
  '436128759951746283872359416785914362213675894694283571528491637167532948349867125',
  '647538192953261478281497653865729314394185267712643985128974536576312849439856721',
  '974613528583427691612598734135976842867142953249385167351864279428759316796231485',
  '271456893856139724349827156638294517925371468417685239183942675592768341764513982',
  '842359761137684952956271384679138425523467198481592673795813246364725819218946537',
  '765293481124786359839514267257138946916425738348679125681347592492851673573962814',
  '167534289589712463324896571892367154471925836635148927748651392253479618916283745',
  '731265894645983172829471536417639258263854719598127463354792681982516347176348925',
  '253947168967831254481562937749653821625418379138279645512786493876394512394125786',
  '615927438478563291293184765136452879957318624842796153729831546361245987584679312',
  (location.search.split('thegame=')[1] ? decodeURIComponent(location.search.split('thegame=')[1].split('&')[0]) : '485719362937264815612583794269456173378126549154937628543672981896341257721895436')];

  if (puzzles[eval(-1 + puzzles.length)] != '485719362937264815612583794269456173378126549154937628543672981896341257721895436') {
    ipuzzle=eval(-1 + puzzles.length); //Math.floor(Math.random() * puzzles.length);
  }
  
  function dependingdo(ans, iqs) {
    var jqs=eval(1 + eval('' + iqs));
    if (document.URL.indexOf('hard=') != -1) { // hard
      document.getElementById('smode').value='hard';
      if (hardarr.indexOf(',' + iqs + ',') != -1 || document.URL.indexOf('extremelyeasy=') != -1) {
        return ans + stemp.replace('xxx','s' + iqs).replace(' value=" "',' value="' + ans + '"').replace(' data-answer=" "',' style=display:none; data-answer="' + ans + '"').replace('>' + ans + '<',' selected>' + ans + '<').replace('>', ' disabled>');
      } else {
        return stemp.replace('xxx','s' + iqs).replace(' data-answer=" "',' data-answer="' + ans + '"'); //.replace('>' + ans + '<',' selected>' + ans + '<').replace('>', ' disabled>');
      }
    } else if (mustbeguessed.trim() != '' && mustnotbeguessed.trim() != '') {
      document.getElementById('smode').value='tailored';
      if (((',' + mustbeguessed.trim() + ',').indexOf(',' + jqs + ',') == -1 || (',' + mustnotbeguessed.trim() + ',').indexOf(',' + jqs + ',') != -1) || document.URL.indexOf('extremelyeasy=') != -1) {
        return ans + stemp.replace('xxx','s' + iqs).replace(' value=" "',' value="' + ans + '"').replace(' data-answer=" "',' style=display:none; data-answer="' + ans + '"').replace('>' + ans + '<',' selected>' + ans + '<').replace('>', ' disabled>');
      } else {
        return stemp.replace('xxx','s' + iqs).replace(' data-answer=" "',' data-answer="' + ans + '"'); //.replace('>' + ans + '<',' selected>' + ans + '<').replace('>', ' disabled>');
      }
    } else if (mustbeguessed.trim() != '' && mustnotbeguessed.trim() == '') {
      document.getElementById('smode').value='tailored';
      if ((',' + mustbeguessed.trim() + ',').indexOf(',' + jqs + ',') == -1 || document.URL.indexOf('extremelyeasy=') != -1) {
        return ans + stemp.replace('xxx','s' + iqs).replace(' value=" "',' value="' + ans + '"').replace(' data-answer=" "',' style=display:none; data-answer="' + ans + '"').replace('>' + ans + '<',' selected>' + ans + '<').replace('>', ' disabled>');
      } else {
        return stemp.replace('xxx','s' + iqs).replace(' data-answer=" "',' data-answer="' + ans + '"'); //.replace('>' + ans + '<',' selected>' + ans + '<').replace('>', ' disabled>');
      }
    } else if (mustbeguessed.trim() == '' && mustnotbeguessed.trim() != '') {
      document.getElementById('smode').value='tailored';
      if ((',' + mustnotbeguessed.trim() + ',').indexOf(',' + jqs + ',') != -1 || document.URL.indexOf('extremelyeasy=') != -1) {
        return ans + stemp.replace('xxx','s' + iqs).replace(' value=" "',' value="' + ans + '"').replace(' data-answer=" "',' style=display:none; data-answer="' + ans + '"').replace('>' + ans + '<',' selected>' + ans + '<').replace('>', ' disabled>');
      } else {
        return stemp.replace('xxx','s' + iqs).replace(' data-answer=" "',' data-answer="' + ans + '"'); //.replace('>' + ans + '<',' selected>' + ans + '<').replace('>', ' disabled>');
      }
    } else { // easy
      if (easyarr.indexOf(',' + iqs + ',') != -1 || document.URL.indexOf('extremelyeasy=') != -1) {
        return ans + stemp.replace('xxx','s' + iqs).replace(' value=" "',' value="' + ans + '"').replace(' data-answer=" "',' style=display:none; data-answer="' + ans + '"').replace('>' + ans + '<',' selected>' + ans + '<').replace('>', ' disabled>');
      } else {
        return stemp.replace('xxx','s' + iqs).replace(' data-answer=" "',' data-answer="' + ans + '"'); //.replace('>' + ans + '<',' selected>' + ans + '<').replace('>', ' disabled>');
      }
    }
  }
  
  function newgame() {
    var j, k, tds=document.getElementsByTagName('td'), m=-1, isq=-1;
    hrecs=['','','','','','','','',''];
    lines=['','','','','','','','',''];
    squares=['','','','','','','','',''];
    for (var i=0; i<tds.length; i++) {
      if (eval(i % 9) == 0) { m++; }
      if (eval(i % 3) == 0) { isq++; }
      if (eval(i % 9) == 0) { isq=eval(Math.floor(eval(i / 27)) * 3); }
      //console.log('i=' + i + ' leads to isq=' + isq);
      hrecs[i]='';
      if (eval('' + ipuzzle) >= 0) { 
      j=eval(puzzles[ipuzzle].substring(i).substring(0,1));
      } else {
      j=Math.min(9,eval(Math.floor(Math.random() * 9) + 1));
      }
      k=0;
      while (hrecs[m].indexOf('' + j) != -1 || lines[eval(i % 9)].indexOf('' + j) != -1 || squares[isq].indexOf('' + j) != -1) {
        j=Math.min(9,eval(Math.floor(Math.random() * 9) + 1));
        k++;
        if (eval('' + k) > 30) { goes++; if (1 == 2) { document.title+='' + goes; } if (1 == 11) { console.log(goes + ' at i=' + i + ' hrecs[0]=' + hrecs[0] + ' hrecs[1]=' + hrecs[1] + ' hrecs[2]=' + hrecs[2]); } return false; }
      }
      tds[i].title='Square number ' + eval(1 + eval('' + i));
      tds[i].innerHTML=dependingdo('' + j, i);
      hrecs[m]+='' + j;
      lines[eval(i % 9)]+='' + j;
      squares[isq]+='' + j;
    }
    //alert(squares[0] + ' ... ' + squares[1]);
    document.getElementById('mytable').style.cursor='pointer';
    return true;
  }
  
  function checksels() {
    var isok=true;
    var sels=document.getElementsByTagName('select');
    for (var jj=0; jj<sels.length; jj++) {
      if (('' + sels[jj].id) != 'smode') {
      if (sels[jj].value.trim() == '') { alert('Not solved yet'); return false;  }
      if (typeof retnc === 'function') {
      if (sels[jj].outerHTML.indexOf(' data-answer="' + retnc(sels[jj].value) + '"') == -1) {  alert('Not solved yet'); return false;   }
      } else {
      if (sels[jj].outerHTML.indexOf(' data-answer="' + sels[jj].value + '"') == -1) {  alert('Not solved yet'); return false;   }
      }
      }
    }
    alert('Congratulations!'); 
    return true;
  }
  
  function askmaybe(indef) {
    var tans='';
    var tpars='';
    if (indef.indexOf('tailored=') == 0) {
      tans=prompt('Using square numbers of 9x9 grid from 1 to 81, specify in comma separated list, where prefixed by minus would be pre-answered else represents squares to be answered, for Sudoku game to follow. To remember for the future involve leading or trailing spaces.  Involve an x to delete any pre-existing saved tailored Sudoku game configurations.', '');
      if (tans == null) { tans=''; }
      var atansarr=tans.replace(/x/g,'').replace(/X/g,'').split(',');
      if (gls!= '' && tans.toLowerCase().indexOf('x') != -1) {
            window.localStorage.removeItem('sudokudefs');
            gls='';
      }
      for (var it=0; it<atansarr.length; it++) {
       if (('' + atansarr[it]).trim() != '') {
        if (('' + atansarr[it] + ' ').indexOf('-') == 0) {
          if (tpars.indexOf('mustnotbeguessed=') == -1) { tpars+='&mustnotbeguessed=' + atansarr[it].trim().substring(1);  } else {  tpars=tpars.replace('&mustnotbeguessed=', '&mustnotbeguessed=' + atansarr[it].trim().substring(1) + ','); }
        } else {
          if (tpars.indexOf('mustbeguessed=') == -1) { tpars+='&mustbeguessed=' + atansarr[it].trim();  } else {  tpars=tpars.replace('&mustbeguessed=', '&mustbeguessed=' + atansarr[it].trim() + ','); }
        }
       }
      }
      if (tpars != '') {
        if (tans.trim() != tans) {
          if (getls() != '') {
            window.localStorage.removeItem('sudokudefs');
          }
          window.localStorage.setItem('sudokudefs', encodeURIComponent(tpars.substring(1)));
        }
        return tpars.substring(1);
      }
    }
    return indef;
  }
  
  function getls() {
    return decodeURIComponent(('' + window.localStorage.getItem('sudokudefs')).replace(/^undefined/g,'').replace(/^null/g,''));
  }
  
  function checkls() {
    if (gls != '' && document.URL.indexOf('?') == -1) {
      location.href=document.URL.split('#')[0].split('?')[0] + '?' + gls;
    } 
    if (document.URL.indexOf('/sudoku.htm') == -1) {
      document.getElementById('ares').style.textDecoration='none';
    }
  }
</script>
</head>
<body onload="checkls(); while (!okay) { okay=newgame(); }">
<table style="width:95%;"><tr id="ourrow"><th id="onleft">
<h1>Sudoku <select id="smode" onchange="location.href=document.URL.split('?')[0].split('#')[0] + '?' + askmaybe(this.value + '=' + this.value);"><option value='easy'>Easy</option><option value=hard>Hard</option><option value='tailored'>Tailored</option></select></h1>
<h3>RJM Programming <a id=ares href='./index.php' title='Collaboration and sharing'>-</a> December, 2022 <span id="semojis"></span></h3>
</th><tH id=toright style=display:none;><input onkeydown="if (typeof settyping === 'function') { settyping(); }" onblur="if (typeof typingunset === 'function') { typingunset(); }  iblur(this);" type=text placeholder="Optionally chat here ..." id=sudokui value=""></input><br><br><textarea id=tais rows=3 cols=80 value=""></textarea></tH></tr></table>

<table id=mytable style='width:95%;height:81%;cursor:progress;background-color:#f0f9f2;' border=5>
<tr id=tr1of9><td id=td11></td><td id=td21></td><td id=td31 class=bright></td><td id=td41></td><td id=td51></td><td id=td61 class=bright></td><td id=td71></td><td id=td81></td><td id=td91></td></tr>
<tr id=tr2of9><td id=td12></td><td id=td22></td><td id=td32 class=bright></td><td id=td42></td><td id=td52></td><td id=td62 class=bright></td><td id=td72></td><td id=td82></td><td id=td92></td></tr>
<tr id=tr3of9><td id=td13 class=bbottom></td><td id=td23 class=bbottom></td><td id=td33 class="bright bbottom"></td><td id=td43 class=bbottom></td><td id=td53 class=bbottom></td><td id=td63 class="bright bbottom"></td><td id=td73 class=bbottom></td><td id=td83 class=bbottom></td><td id=td93 class=bbottom></td></tr>
<tr id=tr4of9><td id=td14></td><td id=td24></td><td id=td34 class=bright></td><td id=td44></td><td id=td54></td><td id=td64 class=bright></td><td id=td74></td><td id=td84></td><td id=td94></td></tr>
<tr id=tr5of9><td id=td15></td><td id=td25></td><td id=td35 class=bright></td><td id=td45></td><td id=td55></td><td id=td65 class=bright></td><td id=td75></td><td id=td85></td><td id=td95></td></tr>
<tr id=tr6of9><td id=td16 class=bbottom></td><td id=td26 class=bbottom></td><td id=td36 class="bright bbottom"></td><td id=td46 class=bbottom></td><td id=td56 class=bbottom></td><td id=td66 class="bright bbottom"></td><td id=td76 class=bbottom></td><td id=td86 class=bbottom></td><td id=td96 class=bbottom></td></tr>
<tr id=tr7of9><td id=td17></td><td id=td27></td><td id=td37 class=bright></td><td id=td47></td><td id=td57></td><td id=td67 class=bright></td><td id=td77></td><td id=td87></td><td id=td97></td></tr>
<tr id=tr8of9><td id=td18></td><td id=td28></td><td id=td38 class=bright></td><td id=td48></td><td id=td58></td><td id=td68 class=bright></td><td id=td78></td><td id=td88></td><td id=td98></td></tr>
<tr id=tr9of9><td id=td19></td><td id=td29></td><td id=td39 class=bright></td><td id=td49></td><td id=td59></td><td id=td69 class=bright></td><td id=td79></td><td id=td89></td><td id=td99></td></tr>
</table>
<br><button style=background-color:yellow; onclick=checksels();>Check My Answers</button>&nbsp;<button style=background-color:orange; onclick='location.href=document.URL;'>New Game</button>
</body>
</html>
<?php
 }
 
 if (file_exists('./sudoku.pleasewait')) {
   unlink('./sudoku.pleasewait');
 }
 
 
exit;
/*
*/
?>