Usage: \ndailyc&h.php?pgs=[Your preferred number of pages in the feed.]&first=[The first page you haven't read yet]&date=[The date at which you start using the script in YYYY-MM-DD format, or any other format strtotime() understands]";
$nbpages = $_GET['pgs']; // The number of pages you want in the feed.
if (!is_numeric($nbpages) || $nbpages <= 0) die($usage);
$starting_page = $_GET['first']; // The first page you haven't read yet
if (!is_numeric($starting_page) || $starting_page <= 0) die($usage);
$starting_date = strtotime($_GET['date']) or die($usage); // The date at which you start using this script
header('Content-type: application/atom+xml; charset=utf-8');
// Entries will be like this: "Time for page 100, buddy."
// In that example:
// "Time for page " is $announcement
// ", " is $seperator
// "." is $endofannouncement
// "buddy" is one of the entries in $names
// "100" is, obviously, the page
$announcement = "Time for page ";
$seperator = ", ";
// The script will call you names, enter them in this array
$names = array("buddy",
"pal",
"kid",
"fella",
"mate",
"friend");
$endofannouncement = ".";
// We won't check whether the current one actually exists, because I'm lazy like that.
// You'll notice when it's over and you can can this script :-).
$now = strtotime(date('Y-m-d'));
$time_difference = $now - $starting_date;
$daysinbetween = $time_difference / 60 / 60 / 24;
$currentpage = $starting_page + $daysinbetween;
print '' . "\n"; ?>
Your daily C&H!Bill Wattersonhttp://www.transmogrifier.org
= 0 && $i > $currentpage - $nbpages; $i --) {
$currentnameindex = ($daysinbetween - $j) % count($names);
if ($currentnameindex < 0) {
$currentnameindex = 6 + $currentnameindex;
}
$currentname = $names[$currentnameindex];
?>