public function viewPost() { $session = new SessionHelper(); if ($this->_authCheck()) { // Instance used for data on page $user = new User(); $postmodel = new PostModel(); // Id of the top post $id = htmlspecialchars($_GET['id']); // Instance used for data on page $thispost = new Post($id); $replies = $postmodel->getRepliesTopPostById($id); // Increment the views file of this post if (file_exists(BASE_URI . 'views/' . $id . '.txt')) { $viewsfile = file_get_contents(BASE_URI . 'views/' . $id . '.txt'); $viewsfile++; $handle = fopen(BASE_URI . 'views/' . $id . '.txt', "w"); fwrite($handle, $viewsfile); fclose($handle); } // Load the views $page_title = h($thispost->title); include BASE_URI . 'app/view/user/template/header.php'; include BASE_URI . 'app/view/post/post.php'; if ($replies != false) { include_once BASE_URI . 'app/view/post/viewreply.php'; } include BASE_URI . 'app/view/user/template/footer.php'; } else { $this->viewLoginPage(); } }