-
Notifications
You must be signed in to change notification settings - Fork 1
/
messenger.php
67 lines (63 loc) · 2.1 KB
/
messenger.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
<?php
include_once ("functions.php");
$title = "留言板";
$page = "home";
include ("header.php");
?>
<div class="container">
<h1 id="dheading" class='a'><?php echo $title ?></h1>
<table>
<thead>
<tr>
<th>姓名</th>
<th>留言</th>
<th>留言時間</th>
<th colspan='3'>相關操作</th>
</tr>
</thead>
<?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 messager");
if(!($result))
{print("can't execute");}
while($row=mysql_fetch_row($result))
{
print("<tr><td>$row[0]</td>");
print("<td>$row[1]</td>");
print("<td>$row[2]</td>");
print("<td><a href='feedback.php?ID=$row[0]&time=$row[2]'>回覆</a>");
print("<td><a href='fix.php?ID=$row[0]&message=$row[1]&time=$row[2]'>修改</a></td>");
print("<td><a href='do_delete.php?ID=$row[0]&message=$row[1]&time=$row[2]'>刪除</a></td></tr>");
}
?>
</table>
<h1 id="heading">開始留言吧</h1>
<div id='a'>
<form method="POST" action="do_messenger.php">
<table>
<?php if(isUser() == true){?>
<tr>
<td><input type = "hidden" id="nam" name='nam' value='<?PHP echo $_SESSION['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 = "text" id="nam" name='nam' size = "20" maxlength = "20" value = ""/></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"); ?>