summaryrefslogtreecommitdiff
path: root/src/frontend_blog/essay_fulfillment.php
diff options
context:
space:
mode:
Diffstat (limited to 'src/frontend_blog/essay_fulfillment.php')
-rw-r--r--src/frontend_blog/essay_fulfillment.php20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/frontend_blog/essay_fulfillment.php b/src/frontend_blog/essay_fulfillment.php
new file mode 100644
index 00000000..df2f8cfa
--- /dev/null
+++ b/src/frontend_blog/essay_fulfillment.php
@@ -0,0 +1,20 @@
+<?php
+
+session_start();
+
+if (!isset($_GET['article'])){
+ http_response_code(400);
+ echo "No article specified";
+ die();
+}
+$article = $_GET['article'];
+/* check if the client is allowed to get the wanted article */
+if(!isset($_SESSION['allowed_articles'][$article])){
+ http_response_code(401); // unauthorized
+ echo "Not allowed to read this article";
+ die();
+}
+// get the article
+$article_doc = get_article($article);
+echo $article_doc->saveHTML();
+?>