Calendars written in php <P> There are many calendars written in JavaScript on the Internet. these calendars read local time and may be inaccurate. So I want to find a service that can be read by using php.
There are many calendars written in JavaScript on the internet. these calendars read local time and may be inaccurate. So I want to find a calendar written in php that can read the server time, but I still cannot find a suitable one, so I tried to write it myself.
Code
<? Php $ mnow = (isset ($ HTTP_GET_VARS ['month']) & intval ($ HTTP_GET_VARS ['month'])> 0 & intval ($ HTTP_GET_VARS ['month']) <13 )? Intval ($ HTTP_GET_VARS ['month']): date ("m"); $ ynow = (isset ($ HTTP_GET_VARS ['Year']) & intval ($ HTTP_GET_VARS ['Year'])> 1969 & intval ($ HTTP_GET_VARS ['Year']) <2038 )? Intval ($ HTTP_GET_VARS ['Year']): date ("Y"); $ mtime = mktime (0, 0, 0, $ mnow, date ("d "), $ ynow); $ f = date ("w", mktime (0, 0, 0, $ mnow, 1, $ ynow)-1; echo "<table id = \" calendar \ "border = \" 0 \ "cellpadding = \" 2 \ "cellspacing = \" 1 \ "> "; echo "<tr> <td colspan = \" 4 \ "align = \" center \ "class = \" calendartitle \ "> <". $ ynow. "> </td> <td colspan = \" 3 \ "align = \" center \ "class = \" calendartitle \ "> <". date ("M", $ mtime ). "> </td> </tr>"; echo "<tr> <td cl Ass = \ "calendartop \"> S </td> <td class = \ "calendartop \"> M </td> <td class = \ "calendartop \"> T </td> <td class = \ "calendartop \"> W </td> <td class = \ "calendartop \"> T </td> <td class = \ "calendartop \ "> F </td> <td class = \" calendartop \ "> S </td> </tr> "; for ($ I = 0; $ I <date ("t", $ mtime) + $ f + 1; $ I ++) {if ($ I % 7 = 0) echo "<tr>"; echo "<td ". ($ I-$ f = intval (date ("d") & $ mnow = date ("m ") & $ ynow = date ("Y "))? "Id = \" calendartoday \ ":" "). ($ I % 7 = 0 | $ I % 7 = 6 )? "Class = \" calendarw \"":""). ">"; if ($ I> $ f) echo $ I-$ f; echo "</td>"; if ($ I % 7 = 6) echo "</tr>" ;}if ($ I % 7 <6 & $ I % 7> 0) echo "<td colspan = \"". (7-$ I % 7 ). "\"> </td> </tr> "; if ($ I % 7 = 6) echo" <td> </tr> "; echo "</table>" ;?>