I made this script in ten minutes for fun. It uses GDLib to create an image telling you if it is the day you asked for.
Usage:
http://yoursite.com/dayofweek.php?day=monday
This will tell you if it is monday or not. Works for EVERY single day of the week!
Examples:
Sunday:
Monday:
Tuesday:
Wednesday:
Thursday:
Friday:
Saturday:
On Error (no date set):
C0d:
PHP Code:
<?php
Header( "Content-type: image/png");
$day = strtolower($_GET['day']);
switch ($day) {
case "sunday":
$printday = "Sunday";
break;
case "monday":
$printday = "Monday";
break;
case "tuesday":
$printday = "Tuesday";
break;
case "wednesday":
$printday = "Wenesday";
break;
case "thursday":
$printday = "Thursday";
break;
case "friday":
$printday = "Friday";
break;
case "saturday":
$printday = "Saturday";
break;
default:
$printday = "FAIL!";
break;
}
$image = imagecreate(100,18);
if ($printday!='FAIL!') {
if (date('l')==$printday) {
$color = ImageColorAllocate($image,0,255,0);
} else {
$color = ImageColorAllocate($image,255,0,0);
}
$black = ImageColorAllocate($image,0,0,0);
ImageFilledRectangle($image,0,0,320,130,$color);
ImageString($image, 12, 2, 0, "$printday", $black);
ImagePNG($image);
ImageDestroy($image);
} else {
$color = ImageColorAllocate($image,0,0,255);
$black = ImageColorAllocate($image,0,0,0);
ImageFilledRectangle($image,0,0,320,130,$color);
ImageString($image, 12, 2, 0, "You suck!", $black);
ImagePNG($image);
ImageDestroy($image);
}
?>