Time To Print
Due: Sept 28
Create a PHP web page which prints the current time in various formats and colors depending on the query string. Your php page is intended to be loaded with a simple query string which controls how the time is displayed, the page title and the background and text colors. The query string has three fields separated by colons. The first is the time format, the second is the text color and the third is the background color.
There are three legal time formats:
If the query string is comp, the page title should be Computer Date/Time, and the body should contain a simple message and the time in a format similar to the Unix shell, as:
Note that this uses a 24-hour clock, the values in the time field are padded to two digits.
If the query string is eng, the page title should be Current Time in English, and the body should contain a simple message and the time
Note that the number of minutes must be padded to two places.
If the query string is compact, the page title should be Compact Date/Time, and the body should contain no text but the date and time itself, compressed into a single digit string, in descending order of increment, as
for the same date and time as the first form. Of course, the year is four digits and all the other numeric fields must be two.
The second and third fields are HTML colors. If you want to use a #, encode it as %35. They should become the text and bgcolor attributes on the body tag of the output page. (Or equivalent style sheets if you prefer.)
If any parts are missing, the format defaults to comp, the text color defaults to white and the background to blue.
PHP functions which might be useful include getdate, strftime printf and explode. If you use printf, you might wand to figure out what the conversion %02d means.
Simply leave your page online on sandbox. Call it a2.php, and store it in a directory named csc231 under local_html under your own account on Sandbox. I'll run it and collect a copy of the source from there. Please leave the file in place at least until you receive a grade.