diff options
author | Aqua-sama <aqua@iserlohn-fortress.net> | 2021-04-29 20:43:35 +0300 |
---|---|---|
committer | Aqua-sama <aqua@iserlohn-fortress.net> | 2021-04-29 20:43:35 +0300 |
commit | 7319816b7c712cd16d6e83bcd617c95943b79be6 (patch) | |
tree | ae5de7c1e2a4387c50ee1df53b24b0021be5c591 /bug/view.php | |
parent | Finish user management (diff) | |
download | bugtracker-7319816b7c712cd16d6e83bcd617c95943b79be6.tar.xz |
CRUD reports
Diffstat (limited to 'bug/view.php')
-rw-r--r-- | bug/view.php | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/bug/view.php b/bug/view.php new file mode 100644 index 0000000..2468abb --- /dev/null +++ b/bug/view.php @@ -0,0 +1,28 @@ +<?php +require 'config.php'; +require_once(TEMPLATES_PATH . "/header.php"); +require_once(TEMPLATES_PATH . "/panel.php"); +require_once(LIBRARY_PATH . "/parsedown.php"); + +if(!isset($_GET['id']) || $_GET['id'] == "") { + echo "<div id='error'>No bug selected, redirecting to index...</div>"; + header('Refresh: 2; URL=index.php'); + +} else { + if(isset($_SESSION['user_id']) && $_SESSION['user_id'] != "") { + echo "<p><a href=edit.php?id=$_GET[id]>Edit</a></p>"; + } + + $conn = new PDO($config['db']['dsn'], $config['db']['username'], $config['db']['password']); + $markdown = new Parsedown(); + + $query = "SELECT title, description, users.username AS submitter FROM bugs JOIN users ON bugs.author = users.id WHERE bugs.id=$_GET[id]"; + $result = $conn->query($query)->fetch(); + + echo "<p><b>$result[title]</b></p>"; + echo "<p>Submitted by $result[submitter]</p>"; + echo '<p>' . $markdown->text($result['description']) . '</p>'; +} + +require_once(TEMPLATES_PATH . "/footer.php"); +?> |