summaryrefslogtreecommitdiff
path: root/src/frontend_blog/essay_fulfillment.php
blob: b21e8b6d56e5da822ca03f85ac7b9af655845971 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
<?php

include("./blog_lib.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();
?>