1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
| $row_date['date'] = gmdate();
$colname_date = "1";
if (isset($_SERVER['date'])) {
$colname_date = (get_magic_quotes_gpc()) ? $_SERVER['date'] : addslashes($_SERVER['date']);
}
mysql_select_db($database_recettes, $recettes);
$query_date = sprintf("SELECT `date` FROM recettes WHERE receptID = %s", $colname_date);
$date = mysql_query($query_date, $recettes) or die(mysql_error());
$row_date = mysql_fetch_assoc($date);
$totalRows_date = mysql_num_rows($date);
$last_modified = gmdate('D, d M Y H:i:s', $row_date['date']) . ' GMT';
// did the browser send an if-modified-since request?
if (isset($_SERVER['HTTP_IF_MODIFIED_SINCE'])) {
// parse header
$if_modified_since = preg_replace('/;.*$/', '', $_SERVER['HTTP_IF_MODIFIED_SINCE']);
if ($if_modified_since == $last_modified) {
// the browser's cache is still up to date
header('HTTP/1.0 304 Not Modified');
exit;
}
}
header('Last-Modified: ' . $last_modified); |
Partager