<?php
// emojiicon.php
// RJM Programming
// March, 2025

  if (isset($_GET['codepoint'])) {
    if (strlen($_GET['codepoint']) > 0) {
     if (isset($_GET['ishex']) || isset($_GET['tohex']) || isset($_GET['hex'])) {
      //file_put_contents('xxx.xxx', str_replace('+',' ',urldecode($_GET['codepoint'])));
      //file_put_contents('xx.xx', '<svg xmlns="http://www.w3.org/2000/svg"><text y="32" font-size="32">&#x' . str_replace(',',';&#x',str_replace(';','',str_replace('&#','',str_replace('+',' ',urldecode($_GET['codepoint']))))) . ';</text></svg>');
      file_put_contents($_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . 'emojiicon' . DIRECTORY_SEPARATOR . 'favicon.svg', str_replace('&#x1f1e6;','&#127462;&#127465;','<svg xmlns="http://www.w3.org/2000/svg"><text y="32" font-size="32">&#x' . str_replace(',',';&#x',str_replace(';','',str_replace('&#','',str_replace('+',' ',urldecode($_GET['codepoint']))))) . ';</text></svg>'));
     } else {
      file_put_contents($_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . 'emojiicon' . DIRECTORY_SEPARATOR . 'favicon.svg', '<svg xmlns="http://www.w3.org/2000/svg"><text y="32" font-size="32">&#' . str_replace(',',';&#',str_replace(';','',str_replace('&#','',str_replace('+',' ',urldecode($_GET['codepoint']))))) . ';</text></svg>');
     }
    }
  }

echo "<html>
<head>
<link rel='icon' href='/emojiicon/favicon.svg?rand=" . rand(0,3456789) . "' sizes='any' type='image/svg+xml'>
</head>
<body>
<h1>Emoji Icon - RJM Programming - March, 2025</h1>
</body>
</html>";
?>
