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

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

 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['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');
 $rell=explode(';' . $thisset . ';', $allcontentw);
 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>');
     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 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 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>');
     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>');
     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, $cuda . ';' . $weare . ';' . $thisset . ';') !== false) {
  $allcontenty=str_replace($cuda . ';' . $weare . ';' . $thisset . ';', $cuda . ' ;' . $weare . ';' . $thisset . ';', $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, $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');
 $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) {
       $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) + '",$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 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;
   
   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=';
     } 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=';
     } //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=';
     } 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 aeto=prompt('Please enter email address to invite regarding this Sudoku game collaboration and sharing', '');
     if (aeto == null) { aeto=''; }
     if (aeto.indexOf('@') != -1) {
    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);
      athis.href=(athis.href + 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 aeto=prompt('Please enter SMS number to invite regarding this Sudoku game collaboration and sharing', '');
     if (aeto == null) { aeto=''; }
     //if (aeto.indexOf('@') != -1) {
    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);
      athis.href=(athis.href + 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];
      } else if (ithis.value.indexOf(':') != -1) {
        if (ithis.value.split(':')[0].indexOf(' ') == -1) {
          yourname=ithis.value.split(':')[0];
        }
      }
     //alert('yes');
      ithis.value=ithis.value.replace(/\//g,' ').replace(/\*/g,' ').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) {
    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 xn() {
     document.getElementById('xnotif').src='./sudoku_' + (thenums.substring(0,81)) + '.html?rand=' + Math.floor(Math.random() * 198765643);
   }
      
   setTimeout(tacheck, 3000);
   setInterval(ifcheck, 3000);
   setInterval(xn, 1000);
</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 ..
    if(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');
 $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));
        $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><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="">' . $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);
     $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);
   $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><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) + '",$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');
 }
 
 if (file_exists('./sudoku.pleasewait')) {
   unlink('./sudoku.pleasewait');
 }
 
 
exit;
/*
Thu, 15 Dec 2022;0000__1;386719254975246813124538796719365428852471369643982571461857932237694185598123647;Welcome+to+our+Sudoku+game%21
Thu, 15 Dec 2022;00000__1;386719254975246813124538796719365428852471369643982571461857932237694185598123647;Joe%3A+yes
Thu, 15 Dec 2022;0000__1;386719254975246813124538796719365428852471369643982571461857932237694185598123647;Hilary%3A+ok
Thu, 15 Dec 2022;00000__1;386719254975246813124538796719365428852471369643982571461857932237694185598123647;Joe%3A+dfgh
Thu, 15 Dec 2022;00000__1;386719254975246813124538796719365428852471369643982571461857932237694185598123647;Joe%3A+dfg
Thu, 15 Dec 2022;0000__1;386719254975246813124538796719365428852471369643982571461857932237694185598123647;Hilary%3A+dfg
Thu, 15 Dec 2022;00000__1;386719254975246813124538796719365428852471369643982571461857932237694185598123647;Bill%3A+yes
Thu, 15 Dec 2022;0000__1;386719254975246813124538796719365428852471369643982571461857932237694185598123647;Hilary%3A+dfes
Thu, 15 Dec 2022;0000__1;386719254975246813124538796719365428852471369643982571461857932237694185598123647;Hilary%3A+wte
Thu, 15 Dec 2022;00000__1;386719254975246813124538796719365428852471369643982571461857932237694185598123647;Bill%3A+ertytert
Thu, 15 Dec 2022;0000__1;812963754735148962946572318374659821589217436621834597253486179497321685168795243;Welcome+to+our+Sudoku+game%21
Thu, 15 Dec 2022;0000__1;812963754735148962946572318374659821589217436621834597253486179497321685168795243;Will%3A+hi%21
Thu, 15 Dec 2022;00000__1;812963754735148962946572318374659821589217436621834597253486179497321685168795243;Betty%3A+Here
Thu, 15 Dec 2022;0000__1;861542793395761482472938615628194357534876921917325864156487239789253146243619578;Welcome+to+our+Sudoku+game%21
Thu, 15 Dec 2022;00000__1;861542793395761482472938615628194357534876921917325864156487239789253146243619578;Jill%3A+fgghh
Thu, 15 Dec 2022;0000__1;861542793395761482472938615628194357534876921917325864156487239789253146243619578;Willy%3A+yes
Thu, 15 Dec 2022;00000__1;861542793395761482472938615628194357534876921917325864156487239789253146243619578;Jill%3A+dfghj
Thu, 15 Dec 2022;0000__1;948351276312769584756284193473192658285643719691875432134927865567438921829516347;Welcome+to+our+Sudoku+game%21
Thu, 15 Dec 2022;00000__1;948351276312769584756284193473192658285643719691875432134927865567438921829516347;Kim%3A+ghjghj
Thu, 15 Dec 2022;0000__1;214675893637198452859234617543982176782316549961547328378459261496821735125763984;Welcome+to+our+Sudoku+game%21
Thu, 15 Dec 2022;00000__1;214675893637198452859234617543982176782316549961547328378459261496821735125763984;Kim%3A+hjk
Thu, 15 Dec 2022;0000__1;214675893637198452859234617543982176782316549961547328378459261496821735125763984;Jo%3A+yes
Thu, 15 Dec 2022;0000__1;214675893637198452859234617543982176782316549961547328378459261496821735125763984;Jo%3A+rtr
Thu, 15 Dec 2022;00000__1;214675893637198452859234617543982176782316549961547328378459261496821735125763984;Kim%3A+rt+gh
Thu, 15 Dec 2022;0000__1;935764182621398547784152963293845716546271839178936254819423675357619428462587391;Welcome+to+our+Sudoku+game%21
Thu, 15 Dec 2022;00000__1;935764182621398547784152963293845716546271839178936254819423675357619428462587391;Kim%3A+hjk
Thu, 15 Dec 2022;0000__1;629358471173294856845671329931426587258713694467985213382169745794532168516847932;Welcome+to+our+Sudoku+game%21
Thu, 15 Dec 2022;00000__1;629358471173294856845671329931426587258713694467985213382169745794532168516847932;Jo%3A+ghg
Thu, 15 Dec 2022;0000__1;629358471173294856845671329931426587258713694467985213382169745794532168516847932;kj%3A+gh
Thu, 15 Dec 2022;0000__1;768951243243768591591423876815634729679182354432597618387249165154876932926315487;Welcome+to+our+Sudoku+game%21
Thu, 15 Dec 2022;00000__1;768951243243768591591423876815634729679182354432597618387249165154876932926315487;May%3A+yes
Thu, 15 Dec 2022;0000__1;768951243243768591591423876815634729679182354432597618387249165154876932926315487;Ji%3A+yes
Thu, 15 Dec 2022;00000__1;768951243243768591591423876815634729679182354432597618387249165154876932926315487;May%3A+tyr
Thu, 15 Dec 2022;0000__1;489376125235491876761852943978514362652983714143627598824739651396145287517268439;Welcome+to+our+Sudoku+game%21
Thu, 15 Dec 2022;00000__1;489376125235491876761852943978514362652983714143627598824739651396145287517268439;May%3A+yes
Thu, 15 Dec 2022;0000__1;489376125235491876761852943978514362652983714143627598824739651396145287517268439;wefw
Thu, 15 Dec 2022;00000__1;489376125235491876761852943978514362652983714143627598824739651396145287517268439;May%3A+jkhgf
Thu, 15 Dec 2022;0000__1;239678415165394728487152369714823956693715284528469173341587692872946531956231847;Welcome+to+our+Sudoku+game%21
Thu, 15 Dec 2022;00000__1;239678415165394728487152369714823956693715284528469173341587692872946531956231847;ji%3A+yes
Thu, 15 Dec 2022;0000__1;239678415165394728487152369714823956693715284528469173341587692872946531956231847;%2Cmom%2Cnb
Thu, 15 Dec 2022;00000__1;239678415165394728487152369714823956693715284528469173341587692872946531956231847;ji%3A+jkl+hjkjhk+
Thu, 15 Dec 2022;0000__1;842317956359682147671495328496758231513264879287139465725941683934876512168523794;Welcome+to+our+Sudoku+game%21
Thu, 15 Dec 2022;00000__1;842317956359682147671495328496758231513264879287139465725941683934876512168523794;May%3A+i+yes
Thu, 15 Dec 2022;0000__1;842317956359682147671495328496758231513264879287139465725941683934876512168523794;Yah%3A+yes
Thu, 15 Dec 2022;0000__1;842317956359682147671495328496758231513264879287139465725941683934876512168523794;Yah%3A+bam+fjh
Thu, 15 Dec 2022;0000__1;842317956359682147671495328496758231513264879287139465725941683934876512168523794;Yah%3A+eew
Thu, 15 Dec 2022;0000__1;564728319892513674317964258431852967629371845758496123183245796946137582275689431;Welcome+to+our+Sudoku+game%21
Thu, 15 Dec 2022;00000__1;564728319892513674317964258431852967629371845758496123183245796946137582275689431;May%3A+yes
Thu, 15 Dec 2022;0000__1;564728319892513674317964258431852967629371845758496123183245796946137582275689431;Jess%3A+yes
Thu, 15 Dec 2022;00000__1;564728319892513674317964258431852967629371845758496123183245796946137582275689431;May%3A+ysdt
Thu, 15 Dec 2022;00000__1;564728319892513674317964258431852967629371845758496123183245796946137582275689431;May%3A+kjhghjkl+hjkl+
Thu, 15 Dec 2022;0000__1;564728319892513674317964258431852967629371845758496123183245796946137582275689431;Jess%3A+b+gjkl+
Thu, 15 Dec 2022;00000__1;564728319892513674317964258431852967629371845758496123183245796946137582275689431;May%3A+ghjk+bnm%2C.+nm%2C
Thu, 15 Dec 2022;00000__1;564728319892513674317964258431852967629371845758496123183245796946137582275689431;May%3A+fghjkl+kl+
Thu, 15 Dec 2022;0000__1;564728319892513674317964258431852967629371845758496123183245796946137582275689431;Jess%3A+gaffe+dfhgf
Thu, 15 Dec 2022;00000__1;564728319892513674317964258431852967629371845758496123183245796946137582275689431;May%3A+cv+dhgfd
Thu, 15 Dec 2022;0000__1;564728319892513674317964258431852967629371845758496123183245796946137582275689431;Jess%3A+fog+gffgfffgf
Thu, 15 Dec 2022;0000__1;259386714347129658816745239672594183195837426438261597783452961564913872921678345;Welcome+to+our+Sudoku+game%21
Thu, 15 Dec 2022;00000__1;259386714347129658816745239672594183195837426438261597783452961564913872921678345;Maylene%3A+yes
Thu, 15 Dec 2022;0000__1;259386714347129658816745239672594183195837426438261597783452961564913872921678345;Jolene%3A+yes
Thu, 15 Dec 2022;00000__1;259386714347129658816745239672594183195837426438261597783452961564913872921678345;Maylene%3A+hjgfhjjkl
Thu, 15 Dec 2022;0000__1;259386714347129658816745239672594183195837426438261597783452961564913872921678345;Jolene%3A+vbnmbv
Thu, 15 Dec 2022;00000__1;259386714347129658816745239672594183195837426438261597783452961564913872921678345;Maylene%3A+hjkl+lkj
Thu, 15 Dec 2022;00000__1;259386714347129658816745239672594183195837426438261597783452961564913872921678345;Maylene%3A+hgggghk+hh
Thu, 15 Dec 2022;0000__1;862173495153249786947685123729351864418726539635894271384562917571938642296417358;Welcome+to+our+Sudoku+game%21
Thu, 15 Dec 2022;00000__1;862173495153249786947685123729351864418726539635894271384562917571938642296417358;June%3A+ght
Thu, 15 Dec 2022;0000__1;862173495153249786947685123729351864418726539635894271384562917571938642296417358;May%3A+yes
Thu, 15 Dec 2022;00000__1;862173495153249786947685123729351864418726539635894271384562917571938642296417358;June%3A+dfghj
Thu, 15 Dec 2022;0000__1;862173495153249786947685123729351864418726539635894271384562917571938642296417358;May%3A+fghjk
Thu, 15 Dec 2022;0000__1;596472831134968257827135946763841592985723164412596783371689425648257319259314678;Welcome+to+our+Sudoku+game%21
Thu, 15 Dec 2022;00000__1;596472831134968257827135946763841592985723164412596783371689425648257319259314678;June%3A+yes
Thu, 15 Dec 2022;0000__1;596472831134968257827135946763841592985723164412596783371689425648257319259314678;May%3A+yes
Thu, 15 Dec 2022;0000__1;596472831134968257827135946763841592985723164412596783371689425648257319259314678;May%3A+mnbvbgh
Thu, 15 Dec 2022;0000__1;596472831134968257827135946763841592985723164412596783371689425648257319259314678;May%3A+bad+gh
Thu, 15 Dec 2022;00000__1;596472831134968257827135946763841592985723164412596783371689425648257319259314678;June%3A+h+ghjjklkjhgf
Thu, 15 Dec 2022;0000__1;542718639763924158981365742418672593296531874357849216134287965625193487879456321;Welcome+to+our+Sudoku+game%21
Thu, 15 Dec 2022;00000__1;542718639763924158981365742418672593296531874357849216134287965625193487879456321;May%3A+yes
Thu, 15 Dec 2022;0000__1;542718639763924158981365742418672593296531874357849216134287965625193487879456321;June%3A+yes
Thu, 15 Dec 2022;00000__1;542718639763924158981365742418672593296531874357849216134287965625193487879456321;May%3A+jkjh+hjkl
Thu, 15 Dec 2022;0000__1;542718639763924158981365742418672593296531874357849216134287965625193487879456321;June%3A+gh+hjhkklhgf
Thu, 15 Dec 2022;00000__1;542718639763924158981365742418672593296531874357849216134287965625193487879456321;May%3A+ggbhjk
Thu, 15 Dec 2022;0000__1;542718639763924158981365742418672593296531874357849216134287965625193487879456321;June%3A+ghjklkjhgh+hjkkl
Thu, 15 Dec 2022;00000__1;542718639763924158981365742418672593296531874357849216134287965625193487879456321;May%3A+ccvbn+ghjkl
Thu, 15 Dec 2022;0000__1;542718639763924158981365742418672593296531874357849216134287965625193487879456321;June%3A+sdd+dfghjk
Thu, 15 Dec 2022;00000__1;542718639763924158981365742418672593296531874357849216134287965625193487879456321;May%3A+g+gghjkl+lkjgg+g
Thu, 15 Dec 2022;0000__1;519687423643215987278439615362948751157326894984751236826173549735894162491562378;Welcome+to+our+Sudoku+game%21
Thu, 15 Dec 2022;00000__1;519687423643215987278439615362948751157326894984751236826173549735894162491562378;May%3A+fgte
Thu, 15 Dec 2022;0000__1;519687423643215987278439615362948751157326894984751236826173549735894162491562378;rtyu
Thu, 15 Dec 2022;00000__1;519687423643215987278439615362948751157326894984751236826173549735894162491562378;May%3A+dfghj+h
Thu, 15 Dec 2022;0000__1;519687423643215987278439615362948751157326894984751236826173549735894162491562378;erty
*/
?>