-
Notifications
You must be signed in to change notification settings - Fork 0
/
showcomment.php
51 lines (39 loc) · 1.25 KB
/
showcomment.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
<?php
session_start();
require_once './model/ctService.class.php';
require_once './model/Fenye.class.php';
if(empty($_SESSION['loginuser'])){
die("请<a href='login.php'>登录</a>再查看评论");
}
if(empty($_REQUEST['id'])){
die("参数不完整");
}
$id=$_REQUEST['id'];
$ctserv=new ctService();
$fenye=new Fenye();
if(!empty($_REQUEST['page'])){
$fenye->setPageNow($_REQUEST['page']);
}
$fenye->setPageSize(5);
$ctserv->getCommentAFP($fenye,$id);
$ct_arr=$fenye->getResArray();
foreach($ct_arr as $key=>$value){
if($value['id']==$id){
$sender=htmlspecialchars($value['sender'], ENT_QUOTES);
$receiver=htmlspecialchars($value['receiver'], ENT_QUOTES);
$content=htmlspecialchars($value['content'], ENT_QUOTES);
if($sender==$_SESSION['loginuser']){
echo "<a href='javascript:' style='color:#ff0000;'>我</a> : " .$content;
}else if($sender!=$receiver){
echo "<a href='javascript:'>$sender</a> : " .$content;
}else{
echo "<a href='javascript:'><b>$sender</b></a> : " .$content;
}
echo "<br/>{$value['time']}";
echo "<br/><br/>";
}
}
if($fenye->getRowCount()>5){
echo "<span class='commentfenye'>".$fenye->getNavigate()."</span>";
}
?>