From 0d53041fc67e13fc53cca0c993ec1a7a31a5a16e Mon Sep 17 00:00:00 2001 From: Malf Furious Date: Sun, 15 Jan 2017 05:57:19 -0500 Subject: Reorganize examples/ directory --- examples/file.php | 71 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 examples/file.php (limited to 'examples/file.php') diff --git a/examples/file.php b/examples/file.php new file mode 100644 index 0000000..ceee9f7 --- /dev/null +++ b/examples/file.php @@ -0,0 +1,71 @@ +heads($file); break; + } + } + + /* + * Request a user head (user image) + * Requester must be currently logged in + */ + function heads($file) + { + if (!$this->getCurrentUser()) + return; + + if (!file_exists("assets/img/heads/" . $file)) + $file = "null.jpg"; + + $file = "assets/img/heads/" . $file; + $f = fopen($file, "rb"); + + if (!$f) + return; + + header("Content-type: " . mime_content_type($file)); + header("Content-length: " . filesize($file)); + fpassthru($f); + fclose($f); + } +} + +$res = new Resource(); +$res->handle($_REQUEST['d'], $_REQUEST['f']); + +?> -- cgit v1.2.3