forked from jeklen/PingPing
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathshow.php
More file actions
227 lines (218 loc) · 6.88 KB
/
show.php
File metadata and controls
227 lines (218 loc) · 6.88 KB
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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
<html>
<head>
<title>活动详情</title>
<!-- 简单的样式定义 -->
<style>
.head1{
background-color:Aliceblue;
margin:0;
padding:7px;
font-family:"微软雅黑";color:brown;
font-size:35px;
text-align:center;
}
.head2{
background-color:#FFA07A;
margin:0;
padding:7px;
font-family:"微软雅黑";color:brown;
font-size:35px;
text-align:center;
}
.nav{
float:left;
height:1300px;
background-color:lightgrey;
font-size:20px;
font-family:"sans-serif";color:brown;
padding:5px;
}
.tag{
font-size:20px;
font-family:"微软雅黑";color:brown;
padding:0;
spacing:0;
}
.footer{
float:bottom;
text-align:center;
font-family:"微软雅黑";color:white;
font-size:10px;
background-color:black;
padding:0px;
height:23px;
clear:both;
}
.pad{
background-color:#6495ED;
font-family:"微软雅黑";color:white;
}
.namepad{
width:6em;
background-color:#9932CC;
font-family:"楷体";color:white;
}
.contentpad{
background-color:#00FFFF;
font-family:"微软雅黑";color:white;
font-size:1.2em;
border-radius:15px;
border:1px solid lightblue;
box-shadow:10px 10px 10px #888888;
}
.commentpad{
border: 2px solid #6495ED;
background-color:Aliceblue;
font-family:"微软雅黑";color:black;
font-size:1.2em;
}
textarea:focus,input:focus{
background-color:#FAFAD2;
border-left:2.5px solid #B0C4DE;
border-top:1px solid #B0C4DE;
border-right:0;
border-bottom:0;
}
</style>
</head>
<?php
//获取活动内容
if(isset($_GET['id']) && is_numeric($_GET['id'])){
$show_id=$_GET['id'];}
else{
echo'<script type="text/javascript">location.href="../123.php"</script>';
}
$link=mysql_connect("localhost:3306","root") or die(mysql_error());
mysql_select_db("activity") or die(mysql_error());
$sql="select * from table1 where activity_id=$show_id";
$result=mysql_query($sql);
$row=mysql_fetch_object($result);
mysql_close($link);
//获取评论数目
$link=mysql_connect("localhost:3306","root") or die(mysql_error());
mysql_select_db("activity") or die(mysql_error());
$sql1="select count(*) from comment where activity_id=$show_id";
$result1=mysql_query($sql1) or die(mysql_error());
$row1=mysql_fetch_array($result1);
mysql_close($link);
$count=$row1[0];
//计算留言页数
$pagesize=5;
$totalpage=ceil($count / $pagesize);
if(isset($_GET['page']) && $_GET['page'] > 0 && $_GET['page'] <= $totalpage){
$page=$_GET['page'];
}
else $page=1;
$start=($page-1)*$pagesize;
?>
<body>
<div class="head1">
<p>活动详情</p>
</div>
<div class="nav">
<p><a href="../分页界面.php?page=1">查看所有活动</a></p>
</div>
<!-- 显示活动详情 -->
<div>
<form action="show_action.php?" method="post" name="commentarea">
<table width=89% align=right cellpadding=0 cellspacing=0>
<tr class="head2"><th align=left colspan="3"><?php echo "活动名称:" . $row->activity_name; ?></th><th > </th></tr>
<tr><td rowspan='8'><?php
echo "<IMG SRC='show_pic.php?id=$show_id' width=350 height=400>";
?></td>
<td width="30%" class='tag'> </td><td width="10%"> </td><td width="30%"> </td></tr>
<tr><td class='tag'><?php echo "活动类型:" . $row->activity_type; ?></td></tr>
<tr><td class='tag'><?php echo "活动地点:" . $row->activity_place; ?></td></tr>
<tr><td class='tag'><?php echo "活动人数:" . $row->activity_people; ?></td></tr>
<tr><td class='tag'><?php echo "活动联系人:" . $row->name; ?></td></tr>
<tr><td class='tag'><?php echo "联系人电话:" . $row->tel; ?></td></tr>
<tr><td class='tag'><?php echo "联系人QQ:" . $row->qq; ?></td></tr>
<tr><td > </td></tr>
<tr><td colspan='4' class='tag'><p><?php echo "活动内容:" . $row->activity_content;?></p></td></tr>
<tr><td > </td></tr>
<tr><td > </td></tr>
<tr><td > </td></tr>
<tr><td > </td></tr>
<!--留言板-->
<tr><td align=center colspan='2' style="font-family:'楷体';color:crimson; font-size:35px;">留言板</td></tr>
<?php
//读取留言内容
$link=mysql_connect("localhost:3306","root") or die(mysql_error());
mysql_select_db("activity") or die(mysql_error());
$sql2="select * from comment where activity_id=$show_id order by time desc limit $start,$pagesize";
$result2=mysql_query($sql2) or die(mysql_error());
for($i=1;$i<=5;++$i){
$flag=false;
?>
<tr><td> </td></tr>
<tr >
<?php if($row2=mysql_fetch_array($result2)) {?>
<td align=left class="namepad"><?php echo $row2['user_name']; ?></td><td class="namepad"><?php echo "发布于" . $row2{'time'}; ?></td>
<?php $flag=true;} else { ?>
<td> </td><td> </td>
<?php }
if($i==2){ ?>
<td align=left colspan="2" style="font-family:'楷体';color:crimson;font-size:20px;"><b>发布留言</b></td>
<?php }?>
</tr>
<tr>
<td> </td> <td> </td>
<?php if($i==2){ ?>
<td align=right style="font-family:'楷体';color:crimson;font-size:20px;">留言人:</td><td><input class="commentpad" type="text" name="user_name"></td>
<?php }?>
</tr>
<tr>
<?php if($flag){ ?>
<td class="contentpad" style="text-indent:2em;padding-left:3em"><b><?php echo $row2['content'] ?></b></td><td> </td>
<?php } else { ?>
<td> </td><td> </td>
<?php }
if($i==2){ ?>
<td colspan="2" rowspan="18"><textarea style="text-indent:2.4em;" class="commentpad" name="content" cols="40" rows="15"></textarea></td>
<?php }?>
</tr>
<tr><td> </td></tr>
<?php }
mysql_close($link);?>
<tr><td> </td><td> </td><td><input type="submit" value="提交"><input type="reset" value="取消">
<input type="hidden" name="id" value=<?php echo $show_id?>></td></tr>
<tr><td> </td></tr>
<!-- 留言页面跳转-->
<tr><td colspan='2' align=center color=grey>
<?php if($totalpage!=0) echo $page. "/" .$totalpage;
else { ?>
<font color="grey">暂时没有留言哦</font>
<?php }?>
<?php if($page==1 || $page > $totalpage) {?>
<font color="grey">首页</font>
<?php } else{ ?>
<a href="show.php?id=<?php echo $show_id ?>&&page=1">首页</a>
<?php } ?>
<?php if($page==1 || $page > $totalpage){?>
<font color="grey">上一页</font>
<?php } else{ ?>
<a href="show.php?id=<?php echo $show_id ?>&&page=<?php echo $page-1 ?>">上一页</a>
<?php } ?>
<?php if($page==$totalpage || $page > $totalpage) { ?>
<font color="grey">下一页</font>
<?php } else { ?>
<a href="show.php?id=<?php echo $show_id ?>&&page=<?php echo $page+1 ?>">下一页</a>
<?php } ?>
<?php if($page==$totalpage || $page > $totalpage) { ?>
<font color="grey">尾页</font>
<?php } else { ?>
<a href='show.php?id=<?php echo $show_id ?>&&page=<?php echo $totalpage ?>'>尾页</a>
<?php } ?>
</form>
</table>
</div>
<div class="nav"> </div>
<div class="footer">
<p>版权@大学生拼拼平台</p>
</div>
</body>
</html>