diff options
Diffstat (limited to 'index.php')
-rw-r--r-- | index.php | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/index.php b/index.php new file mode 100644 index 0000000..5e79ca7 --- /dev/null +++ b/index.php @@ -0,0 +1,27 @@ +<?php +require 'config.php'; +require_once(TEMPLATES_PATH . "/header.php"); +require_once(TEMPLATES_PATH . "/panel.php"); +require_once(LIBRARY_PATH . "/functions.php"); + +$conn = new PDO($config['db']['dsn'], $config['db']['username'], $config['db']['password']); + +$query = 'SELECT bugs.id AS id, title, description, users.username AS submitter FROM bugs JOIN users ON bugs.author = users.id'; +if(isset($_GET['term']) && $_GET['term'] != "") { + echo "where the title contains: $_GET[term]"; + $query = $query . " WHERE title LIKE '%$_GET[term]%'"; +} + +echo "<table style='width:80%'>\n"; +echo "<tr><th>Title</th><th>Description</th><th>Submitter</th></tr>\n"; +foreach ($conn->query($query) as $row) { + echo "<tr>\n"; + echo "<td><a href=view.php?id=$row[id]>$row[title]</a></td>\n"; + echo "<td>" . truncate($row['description']) . "</td>\n"; + echo "<td>$row[submitter]</td>\n"; + echo "</tr>\n"; +} +echo "</table>\n"; + +require_once(TEMPLATES_PATH . "/footer.php"); +?> |