/home/wpollock1/public_html/PHP/LastModTime.php
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html lang="en"> <head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<meta name="description" content="PHP File Lister">
<meta name="author" content="Wayne Pollock">
<link rel="contents" href="../index.htm">
<link rel="previous" href="../index.htm">
<link rel="Icon" type="image/x-icon" href="../images/PHP.ico">
<link rel="stylesheet" href="../Styles.css" type="text/css">
<script type="text/JavaScript" src="../Common.js"> </script>
<title> Determine Last Modified Date of A Web Page </title>
</head>
<body>
<div>
<?php
// Script to determine the last modified date of some file.
// The JavaScript "document.lastmodified" functions doesn't work
// reliably; it usually shows the date of the cached copy (the
// current date).
// Arguments: file=path_to_file (NOT a URI, to prevent foreign
// documents)
// Written 9/2009 by Wayne Pollock, Tampa Florida USA. All Rights Reserved.
// Parse args: filename (string):
if ( isset($_REQUEST['file']) ) $file = $_REQUEST['file'];
if ( ! isset( $file ) ) {
echo "<h2>No filename provided!</h2>\n"
. "<p><em>You need to pass</em> "
. "<q><code>file=<em>name</em></code></q> in the query string.\n"
. "The modification date of the file is returned.</p>\n";
echo '</div></body></html>';
exit;
}
echo date("m/d/Y H:i:s",filemtime($file));
// Output HTML epilog:
echo "</pre>\n";
?>
</div>
<div>
<script type="text/JavaScript">
// <![CDATA[
addFooter( "Question: PHP File Lister" );
// ]]>
</script>
<noscript>
<p>
<?php
$modi = @filemtime(__FILE__);
echo "(This page last modified: " . gmdate('Y-m-d\TH:i:s+00:00', $modi) . ")";
?>
</p>
</noscript>
</div></body></html>