-
Notifications
You must be signed in to change notification settings - Fork 0
/
suggestion.php
executable file
·78 lines (69 loc) · 2.32 KB
/
suggestion.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
67
68
69
70
71
72
73
74
75
76
77
78
<?php include("header.php"); ?>
<? $_SESSION['returnPage'] = $_SERVER['PHP_SELF']; ?>
<div id="xsnazzy">
<b class="xtop"><b class="xb1"></b><b class="xb2"></b><b class="xb3"></b><b class="xb4"></b></b>
<div class="xboxcontent">
<p> </p>
<?
if ($_SESSION['loggedin'] == true)
{
//force update buttonn
?>
<center><h1>Suggestions - <a href="feedback.php">Feedback</a></h1><br>
<div id="suggest">
<form method="POST" action="suggestion.php">
<textarea name="suggestion" cols="70" rows="10"></textarea><br>
<input type="submit" value="Suggest">
<input type="hidden" name="suggestioncheck" value="1">
</form>
</div>
<?
$mysqli = new mysqli('DATABASE SERVER','DATABASE USERNAME','DATABASE PASSWORD','DATABASE NAME');
$mysqli->set_charset("utf8");
if (($_GET['delete']>0) && ($_SESSION['status']>=50))
{
$query = "DELETE FROM suggestions WHERE id='".addslashes($_GET['delete'])."'";
$pass = $mysqli->query($query) or die("Suggestion Delete Failed!<br>".mysqli_error($mysqli));
}
if ($_POST['suggestioncheck']==1)
{
$feedback = addslashes($_POST['suggestion']);
$feedback = str_replace("\r\n","<br>",$feedback);
if ($feedback!="")
{
$query = "INSERT INTO suggestions VALUES ('','".$_SESSION['id']."',NOW(),'1','".$feedback."','0')";
$pass = $mysqli->query($query) or die("New Suggestion Entry Failed!<br>".mysqli_error($mysqli));
}
}
echo "<table width='590'>";
$query1 = "SELECT F.*, user FROM suggestions F INNER JOIN user U ON U.id = F.userid ORDER BY id DESC";
$items1 = $mysqli->query($query1) or die("Suggestion Query Failed!<br>".mysqli_error($mysqli));
while ($post = mysqli_fetch_array($items1))
{
echo "<tr>";
echo "<td><b>".$post['user']."</b></td><td align=right>".$post['timestamp'];
if ($_SESSION['status']>=50) echo " - <a href='?delete=".$post['id']."'>[x]</a>";
echo "</td>";
echo "</tr>";
echo "<tr>";
?><td colspan='2' style='border-bottom:groove;'><? echo $post['suggestion'] ?></td><?
echo "</tr>";
}
echo "</table>";
$mysqli->close();
?></center><?
}
else
{
?>
<center>
Please login <a href="bblogin.php">HERE</a>.
</center>
<?
}
?>
<p> </p>
</div>
<b class="xbottom"><b class="xb4"></b><b class="xb3"></b><b class="xb2"></b><b class="xb1"></b></b>
</div>
<?php include("footer.php"); ?>