/home/wpollock1/public_html/PHP/LastModTime.php
1: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
2: "http://www.w3.org/TR/html4/strict.dtd">
3: <html lang="en"> <head>
4: <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
5: <meta name="description" content="PHP File Lister">
6: <meta name="author" content="Wayne Pollock">
7: <link rel="contents" href="../index.htm">
8: <link rel="previous" href="../index.htm">
9: <link rel="Icon" type="image/x-icon" href="../images/PHP.ico">
10: <link rel="stylesheet" href="../Styles.css" type="text/css">
11: <script type="text/JavaScript" src="../Common.js"> </script>
12:
13: <title> Determine Last Modified Date of A Web Page </title>
14: </head>
15: <body>
16: <div>
17: <?php
18: // Script to determine the last modified date of some file.
19: // The JavaScript "document.lastmodified" functions doesn't work
20: // reliably; it usually shows the date of the cached copy (the
21: // current date).
22: // Arguments: file=path_to_file (NOT a URI, to prevent foreign
23: // documents)
24: // Written 9/2009 by Wayne Pollock, Tampa Florida USA. All Rights Reserved.
25:
26: // Parse args: filename (string):
27: if ( isset($_REQUEST['file']) ) $file = $_REQUEST['file'];
28: if ( ! isset( $file ) ) {
29: echo "<h2>No filename provided!</h2>\n"
30: . "<p><em>You need to pass</em> "
31: . "<q><code>file=<em>name</em></code></q> in the query string.\n"
32: . "The modification date of the file is returned.</p>\n";
33: echo '</div></body></html>';
34: exit;
35: }
36:
37: echo date("m/d/Y H:i:s",filemtime($file));
38:
39: // Output HTML epilog:
40: echo "</pre>\n";
41: ?>
42: </div>
43:
44: <div>
45: <script type="text/JavaScript">
46: // <![CDATA[
47: addFooter( "Question: PHP File Lister" );
48: // ]]>
49: </script>
50: <noscript>
51: <p>
52: <?php
53: $modi = @filemtime(__FILE__);
54: echo "(This page last modified: " . gmdate('Y-m-d\TH:i:s+00:00', $modi) . ")";
55: ?>
56: </p>
57: </noscript>
58:
59: </div></body></html>