Browse Source

Fixed being able to request stories that don't exist

pull/1/head
parent
commit
27f3ff162f
1 changed files with 9 additions and 2 deletions
  1. +9
    -2
      news/story.php

+ 9
- 2
news/story.php View File

@ -1,3 +1,12 @@
<?php
$file = $_GET['id'];
if (file_exists("./stories/$file/meta.json")) {
$data = json_decode(file_get_contents("./stories/$file/meta.json"), true);
}
else {
header("Location: https://socialistra.org");
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
@ -8,8 +17,6 @@
<?php
include("../res/php/top.php");
date_default_timezone_set('America/New_York');
$file = $_GET['id'];
$data = json_decode(file_get_contents("./stories/$file/meta.json"), true);
?>
<div id="article-title"><?php echo $data['title'];?></div>
<p class="article-subtitle"><?php echo $data['subtitle'];?></p>


Loading…
Cancel
Save