diff options
Diffstat (limited to 'index.php')
-rw-r--r-- | index.php | 30 |
1 files changed, 16 insertions, 14 deletions
@@ -10,28 +10,30 @@ $conn = new PDO($config['db']['dsn'], $config['db']['username'], $config['db'][' <h2>Bugs</h2> <?php -# bugs query -$bugs_q= '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]"; - $bugs_q = $bugs_q . " WHERE title LIKE '%$_GET[term]%'"; +if(session_set()) { + echo "<p><a href='{$config['urls']['base']}/bug/edit.php'>Create</a></p>\n"; } +# bugs query +$bugs = $conn->prepare("SELECT bugs.id AS id, title, description, users.username AS submitter + FROM bugs JOIN users ON bugs.author = users.id + WHERE title LIKE :term"); +$bugs->bindValue(':term', isset($_GET['term']) ? '%' . $_GET['term'] : "%"); +$bugs->execute(); -$bugs_r = $conn->query($bugs_q); -if($bugs_r->rowCount() > 0) { +if($bugs->rowCount() > 0) { ?> <table style='width:80%'> <tr><th>Title</th><th>Description</th><th>Owner</th></tr> <?php -foreach ($bugs_r as $row) { - echo "<tr><td><a href=view.php?id=$row[id]>$row[title]</a></td> <td>" . truncate($row['description']) . "</td> <td>$row[submitter]</td></tr>\n"; +foreach ($bugs as $row) { + echo "<tr><td><a href=bug/view.php?id=$row[id]>$row[title]</a></td> <td>" . truncate($row['description']) . "</td> <td>$row[submitter]</td></tr>\n"; } ?> </table> <?php } else { - echo "<p>Zero boogs found.</p>\n"; + echo "<p>No bugs found.</p>\n"; } ?> @@ -43,16 +45,16 @@ if(session_set()) { } # reports query -$reports_q = 'SELECT reports.id AS id, title, description, users.username AS user FROM reports JOIN users ON reports.author=users.id WHERE bug IS NULL ORDER BY id'; +$reports = $conn->query("SELECT reports.id AS id, title, description, users.username AS user + FROM reports JOIN users ON reports.author=users.id WHERE bug IS NULL ORDER BY id"); -$reports_r = $conn->query($reports_q); -if($reports_r->rowCount() > 0) { +if($reports->rowCount() > 0) { ?> <table style='width:80%'> <tr><th>Title</th><th>Description</th><th>Submitted by</th></tr> <?php -foreach ($reports_r as $row) { +foreach ($reports as $row) { echo "<tr><td><a href=report/view.php?id=$row[id]>$row[title]</a></td> <td>" . truncate($row['description']) . "</td> <td>$row[user]</td></tr>\n"; } ?> |