76 lines
2.7 KiB
PHP
76 lines
2.7 KiB
PHP
<?php
|
|
require("function.php");
|
|
require("layout.php");
|
|
|
|
//Get that data!
|
|
$bugs=mysqli_query($con,"SELECT * FROM bugs ORDER BY date DESC");
|
|
|
|
print $header;
|
|
|
|
//Default page
|
|
if (!isset($_GET['action']) && !isset($_POST['action'])) {
|
|
print"$smallfont
|
|
This board is still a massive work in progress. Before submitting a bug, first check <a href=progress.html>the progress page</a> to see whether or not the bug is known or has occured on a \"finished\" page. | <a href=bug.php?action=bug>Submit Bug Report</a>
|
|
$tblstart
|
|
$tccellh Page</td>
|
|
$tccellh Description</td>
|
|
$tccellh Date</td></tr>
|
|
";
|
|
|
|
while($buglist = mysqli_fetch_array($bugs)) {
|
|
print"<tr>
|
|
$tccell1 $buglist[page]</td>
|
|
$tccell2 $buglist[desc]</td>
|
|
$tccell1".dateformat($buglist['date'])."</td></tr>
|
|
|
|
";
|
|
}
|
|
}
|
|
|
|
//Bug submit form page
|
|
if (isset($_GET['action']) && $_GET['action']=="bug" && !isset($_POST['action'])) {
|
|
print "$fonttag<br>$tblstart
|
|
<FORM ACTION=\"bug.php\" NAME=\"REPLIER\" METHOD=\"POST\">
|
|
$tccellha $tccellhb </font></td>
|
|
$tccellh </td><tr>
|
|
$tccell1 <b>Page:</b>$smallfont<br></center> The exact page the bug happened on.</td>
|
|
$tccell2 </center><INPUT TYPE=TEXT NAME=\"page\" VALUE=\"\" SIZE=25 MAXLENGTH=25></td><tr>
|
|
$tccell1 <b>Description:</b>$smallfont<br></center> Description of the bug. Please include information relating to what you were doing at the time.</td>
|
|
$tccell2 </center><TEXTAREA NAME=\"desc\" ROWS=5 COLS=60 WRAP=VIRTUAL></TEXTAREA></td><tr>
|
|
$tccell1 </td>
|
|
$tccell2 </center>
|
|
<INPUT TYPE=HIDDEN NAME=\"action\" VALUE=\"bugadd\">
|
|
<INPUT TYPE=Submit NAME=\"submit\" VALUE=\"Submit report\"></td></FORM></table>";
|
|
}
|
|
|
|
//Submitting the bug
|
|
if (isset($_POST['action']) && $_POST['action']=="bugadd" && !isset($_GET['action'])) {
|
|
print $tblstart;
|
|
|
|
//Time to sanitize user input!
|
|
$desc = mysqli_real_escape_string($con,$_POST['desc']);
|
|
$page = mysqli_real_escape_string($con,$_POST['page']);
|
|
|
|
//Hrm, are any fields empty?
|
|
if ($desc && $page) {
|
|
//Fix line breaks. Nasty, I should replace it at some point
|
|
$desc=str_replace("
|
|
","<br>",$desc);
|
|
|
|
$date=time();
|
|
mysqli_query($con,"INSERT INTO bugs (`date`, `desc`, `page`, `ip`) VALUES ('$date', '$desc', '$page', '$_SERVER[REMOTE_ADDR]')") or die(mysql_error());
|
|
|
|
print "$tccell1"."Thank you for submitting a bug report.
|
|
Click <a href=index.php>here</a> to return to the board.
|
|
</table></td></table>";
|
|
} else {
|
|
//Yes, something's empty!
|
|
print "$tccell1 You must enter something into both fields
|
|
<br>Click <a href=index.php>here</a> to return to the board.";
|
|
}
|
|
}
|
|
|
|
//Time to wrap this up
|
|
print "$footer <br>";
|
|
rendertime();
|
|
?>
|