You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
32 lines
803 B
32 lines
803 B
<?php |
|
function endsWith( $haystack, $needle ) { |
|
$length = strlen( $needle ); |
|
if( !$length ) { |
|
return true; |
|
} |
|
return substr( $haystack, -$length ) === $needle; |
|
} |
|
|
|
// open the file in a binary mode |
|
$resource = "optflow.html"; |
|
$name = "./${resource}"; |
|
$fp = fopen($name, 'rb'); |
|
|
|
// send the right headers |
|
if(endsWith($resource, ".html")) { |
|
header("Content-Type: text/html"); |
|
} elseif (endsWith($resource, ".js")) { |
|
header("Content-Type: text/javascript"); |
|
} elseif (endsWith($resource, ".wasm")) { |
|
header("Content-Type: application/wasm"); |
|
} else { |
|
header("Content-Type: text/html"); |
|
} |
|
header("Content-Length: " . filesize($name)); |
|
header("Cross-Origin-Embedder-Policy: require-corp"); |
|
header("Cross-Origin-Opener-Policy: same-origin"); |
|
fpassthru($fp); |
|
exit; |
|
|
|
?> |
|
|
|
|