-
Notifications
You must be signed in to change notification settings - Fork 1
/
feedback.php
76 lines (73 loc) · 2.39 KB
/
feedback.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
<?php
include_once ("functions.php");
$title = "回覆留言";
$page = "home";
include ("header.php");
extract($_GET);
?>
<div class="container">
<h1 id="dheading" class='a'><?php echo $title; ?></h1>
<table>
<thead>
<tr>
<th>ID</th>
<th>Message</th>
<th>time</th>
</tr>
</thead>
<tbody>
<?php
if(!($link = mysql_connect(MYSQL_LOCATION, MYSQL_USERNAME, MYSQL_PASSWORD)))
die("cannot link database");
if(!(mysql_select_db(MYSQL_DATABASE)))
die("cannot open db");
mysql_set_charset("utf8", $link);
$result = mysql_query("select * from feedback");
if(!($result))
{print("can't execute");}
while($e=mysql_fetch_row($result)){
if($e[1] == $ID && $e[4] == $time){
print("<tr><td>$e[1]</td>");
print("<td>$e[2]</td>");
print("<td>$e[3]</td>");
print("<td><a href='fix_feedback.php?ID=$e[0]&message=$e[1]&time=$e[2]'>修改</a></td>");
print("<td><a href='do_delete_feedback.php?ID=$e[0]&re_ID=$e[1]&message=$e[2]&time=$e[3]&re_time=$e[4]'>刪除</a></td></tr>");
}
}
?>
</tbody>
</table>
<h1 id="heading">編寫回覆</h1>
<div id='a'>
<form method="POST" action="do_feedback.php">
<table>
<?php if($_SESSION['loginOK'] == true){ ?>
<tr>
<td><input type = "hidden" id="re_nam" name='re_nam' VALUE = '<?PHP print("$ID"); ?>' /></td>
<td><input type = "hidden" id="re_time" name='re_time' VALUE = '<?PHP print("$time"); ?>'/></td>
</tr>
<tr>
<td><input type = "hidden" id="nam" name='nam' VALUE = '<?PHP print("$username"); ?>' /></td>
</tr>
<tr>
<td>留言:<input type = "text" id="ins" name='ins' size = "100" maxlength = "100" /></td>
<td><input type = "submit" value='送出' /></td>
</tr>
<?php }else{ ?>
<tr>
<td><input type = "hidden" id="re_nam" name='re_nam' VALUE='<?PHP print("$ID"); ?>' /></td>
<td><input type = "hidden" id="re_time" name='re_time' VALUE='<?PHP print("$time"); ?>'/></td>
</tr>
<tr>
<td>名字:<input type = "text" id="nam" name='nam' size = "20" maxlength = "20" /></td>
</tr>
<tr>
<td>留言:<input type = "text" id="ins" name='ins' size = "100" maxlength = "100" /></td>
<td><input type = "submit" value='送出' /></td>
</tr>
<?php } ?>
</table>
</form>
</div>
</div>
<?php include ("footer.php"); ?>