aboutsummaryrefslogtreecommitdiff
path: root/index.php
blob: 5e79ca7355cc7a1d1b82cfbef319041cae6b565a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
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");
?>