3 function getReferrerPath() {
4 if (!isset($_SERVER["HTTP_REFERER"]))
6 $url = parse_url($_SERVER["HTTP_REFERER"]);
11 $image = "../../resources/square100.png";
12 header("Content-Type: image/png");
13 header("Content-Length: " . filesize($image));
14 header("Access-Control-Allow-Origin: *");
21 $font = "../../../../resources/Ahem.ttf";
22 header("Content-Type: font/truetype");
23 header("Content-Length: " . filesize($font));
24 header("Access-Control-Allow-Origin: *");
30 $expectedReferrerPaths = array(
31 "document" => "/css/css-resources-referrer.html",
32 "sheet" => "/css/resources/css-resources-referrer.css",
33 "importedSheet" => "/css/resources/css-resources-referrer-import.css",
34 "iframe" => "/from/iframe.html"
37 $from = $_GET["from"];
38 $resource = $_GET["resource"];
39 $referrerPath = getReferrerPath();
41 if ($referrerPath === $expectedReferrerPaths[$from]) {
42 if ($resource === "image" || $resource === "image2")
44 else if ($resource === "font")
47 header("HTTP/1.1 500 Internal Server Error");
49 header("HTTP/1.1 500 Internal Server Error");