File: if_modified_since.php

package info (click to toggle)
jquery 3.1.1-2%2Bdeb9u1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 2,524 kB
  • sloc: php: 122; sh: 48; xml: 36; makefile: 29
file content (20 lines) | stat: -rw-r--r-- 378 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
<?php
error_reporting(0);

$ts = $_REQUEST['ts'];

$ifModifiedSince = isset($_SERVER['HTTP_IF_MODIFIED_SINCE']) ? stripslashes($_SERVER['HTTP_IF_MODIFIED_SINCE']) : false;
if ($ifModifiedSince == $ts) {
	header('HTTP/1.0 304 Not Modified');
	die; // stop processing
}

header("Last-Modified: " . $ts);

if ( $ifModifiedSince ) {
	echo "OK: " . $ts;
} else {
	echo "FAIL";
}

?>