10/02/2003 @10:50:31 ^12:01:37


This site was put up nearly a year ago. Since then, a number of other people I know have put up similar things. A number of them were only updated two or three times, but some of them endure... so I stole the idea from newsdot to make:

Site News of Acquaintances From University (SNAFU)

It was described last night as "clever" and "quite useful" but it's not yet without its problems.

Peter said to me "how can a CGI script have a last modified time?". I think there are many ways in which a dynamically created page can return the time it was last updated.

Here's some PHP to fix the first case. For this to work you need a file whose last modified time changes when, and only when, your site updates. For example, I have my Berkeley database of updates. Then you write the following code, or similar:

header(sprintf("Last-Modified: %s GMT",
 gmdate("D, d M Y H:i:s", filemtime(/PATH/TO/FILE))));

This goes at the top of your index.php (or something else - I can have it check a url different from the one that is linked) but it must be before any actual content is sent. See header() in the PHP manual for more details.