Mercurial > SimpleWebPresenter
view cache_check.inc @ 17:75ab765300d1
Fix error which caused mtime for html files not to be updated.
| author | Tom Fredrik "BFG" Klaussen <bfg@blenning.no> |
|---|---|
| date | Wed, 19 Sep 2012 14:40:00 +0200 |
| parents | a64e8f968e7e |
| children | d5068ced2ad1 |
line wrap: on
line source
<?php function cache_check($mtime) { if (DEBUG) var_dump($_SERVER); $HTTP_IF_MODIFIED_SINCE=$_SERVER['HTTP_IF_MODIFIED_SINCE']; $if_modified_since = preg_replace('/;.*$/', '', $HTTP_IF_MODIFIED_SINCE); $gmdate_mod = gmdate('D, d M Y H:i:s', $mtime) . ' GMT'; if ($if_modified_since == $gmdate_mod) { header("HTTP/1.0 304 Not Modified"); exit; } header("Last-Modified: $gmdate_mod"); } function cache_time($path) { global $newest; $mtime = filemtime($path); if ($mtime > $newest) { print $newest; $newest = $mtime; } } ?>
