С какими годами совпадает календарь?
<?php if ($_SERVER['REQUEST_URI'] == "/juicephp/filesphp.php?faction") header ("Location: filesphp.php"); session_start(); ?> <html> <head> <meta charset="UTF-8"> <title>Календарь</title> <link rel="stylesheet" type="text/css" href="halo.css?v=2"> <link rel="shortcut icon" href="/juicephp/favicon.ico" type="image/x-icon"> <script src="halo.js"></script> </head> <!--[if !IE]>--><body onload="widthcontrol()"><!--<![endif]--> <!--[if IE]><body onload="scrollRight()"><![endif]--> <div class="main"> <div class="head"><center> <a href="/juicephp">PHP Test by Alexander Kolobkov</a>. Потяните ползунок, чтобы увидеть код.<br> <!--[if !IE]>--> <input class="blackslider" type="range" min="0" max="100" id="sizer" oninput="widthcontrol()" value="100"> <!--<![endif]--> <!--[if IE]> <div onscroll="widthcontrolie()" id="scrollie" style="height: 3%; width: 100%; overflow-x:scroll"> <hr color="black" width="1000%"></div> <![endif]--> </center> <br> </div> <div id="content"> <!-- Код воровать отсюда. --> <?php function is_int_str($str) { return ((intval($str) == $str) && (intval($str) >= 0)); } function is_leap_year($year) { return date("d", mktime(0, 0, 0, 3, 0, $year)) == 29; } if (empty($_GET["year"])) echo "С какими годами совпадает календарь?"; elseif (!is_numeric($_GET["year"])) echo "Ошибка! ".$_GET["year"]." не является числом."; else { $c_year = htmlspecialchars($_GET["year"]); $c_year = substr($c_year, -9, 9); $c_year = intval($c_year); $c_wd = date("D", mktime(0, 0, 0, 1, 1, $c_year)); $c_leap = is_leap_year($c_year); $years = []; for ($i = -100; $i < 101; $i++) { if ($c_year+$i > 0 && $c_year+$i <= 29227704432 && date("D", mktime(0, 0, 0, 1, 1, $c_year+$i)) == $c_wd && is_leap_year($c_year+$i) == $c_leap && $i != 0 ) array_push($years, $c_year+$i); } echo "Календарь за ".$_GET["year"]," год совпадает с: ".join(', ', $years)."."; } ?> <br><br> <form method="get" action=""> <input type="text" name="year" placeholder="Год" maxlength="4"> <button type="submit">Узнать</button> </form> </div> <!-- Показ исходного кода текущей страницы: --> <div id="source"> <?php $thispage = basename(strtok($_SERVER["REQUEST_URI"], '?')); echo "<pre>", htmlspecialchars(file_get_contents($thispage)), "</pre>"; ?> </div> </div> </body> </html>