-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbugs.php
66 lines (58 loc) · 2.07 KB
/
bugs.php
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
<?php require_once("includes/session.php"); ?>
<?php $_SESSION['last_url'] = $_SERVER['PHP_SELF']; ?>
<?php require_once("includes/connections.php"); ?>
<?php require_once("includes/functions.php"); ?>
<?php include("includes/header.php"); ?>
<?php
if(isset($_POST['bugSubmit'])){
$tester = $_POST['bugTester'];
$detail = $_POST['bugDetail'];
$query = "INSERT INTO bugs (
tester, detail
) VALUES (
'{$tester}', '{$detail}'
)";
$result = mysql_query($query, $connection);
if ($result) {
$message = "Bug submitted successfully. Thank you!";
$alertClass = "alert-success";
}
}
?>
<?php if(!empty($message)) {echo '<div class="alert ' . $alertClass . '"><button class="close" data-dismiss="alert">Cool, thanks ×</button>' . $message . '</div>';} ?>
<div class="container">
<div class="row">
<div class="span12">
<form action="bugs.php" method="post" class="form-vertical ideaForm topMargin">
<textarea class="span12" id="bugDetail" name="bugDetail" rows="4" cols="50" placeholder="Describe your bug" autofocus></textarea>
<input class="span12" id="bugTester" name="bugTester" type="text" placeholder="Your name please">
<button class="btn btn-danger stashItButton" id="submitButton" type="submit" value="Stash it!" name="bugSubmit">Squash it!</button>
</form>
</div>
</div>
<div class="row">
<div class="span12">
<hr/>
<h2 class="bottomMargin">List of known issues currently plaguing the system</h2>
<?php
$result = mysql_query("SELECT * FROM bugs", $connection);
if(!$result){
die("Database query failed: " . mysql_error());
}
echo "<ol>";
while ($row = mysql_fetch_array($result)){
if(empty($row)){
echo 'No ideas have been submitted <a href="index.php">yet</a>.';
}
if ($row[3]) {
$markCompleted = 'completed';
} else {
$markCompleted = '';
}
echo '<li><blockquote class='.$markCompleted.'>'.$row[2].'<small>'.$row[1].'</small></blockquote></li>';
}
echo "</ol>";
?>
</div>
</div>
<?php require("includes/footer.php"); ?>