Created
November 9, 2012 15:55
-
-
Save norv/4046468 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// If it hasn't been modified since the last time this attachement was retrieved, there's no need to display it again. | |
if (!empty($_SERVER['HTTP_IF_MODIFIED_SINCE'])) | |
{ | |
list($modified_since) = explode(';', $_SERVER['HTTP_IF_MODIFIED_SINCE']); | |
if (strtotime($modified_since) >= filemtime($filename)) | |
{ | |
ob_end_clean(); | |
// Answer the question - no, it hasn't been modified ;). | |
header('HTTP/1.1 304 Not Modified'); | |
exit; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment