-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathreply.php
118 lines (96 loc) · 5.16 KB
/
reply.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
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
<?php
include('pdoInc.php');
function replyTopic($id){
include('pdoInc.php');
$select = mysqli_query($con, "SELECT *
FROM restaurant
WHERE restaurant_id = $id");
while($row = mysqli_fetch_assoc($select)){
echo "<h4>大家對於 <b>".$row['name']."</b> 的評價</h4>";
}
}
function replyContent($id){
include('pdoInc.php');
$select = mysqli_query($con, "SELECT *
FROM reply
WHERE restaurant_id = $id");
$member = $dbh->prepare('SELECT * FROM member WHERE account = ?'); //目前登入的會員
if(isset($_SESSION['account'])){ //有登入
$member->execute(array($_SESSION['account'])); //目前登入的會員
while ($memberRow= $member->fetch(PDO::FETCH_ASSOC)) {
if(mysqli_num_rows($select) != 0){
while($row = mysqli_fetch_assoc($select)){
echo '<div class="card text-dark" style="background-color:rgb(255,255,255,0.3)">
<div class="card-body">';
echo '<div style="float:right">評 價 ';
for ($i=0;$i<$row['rate'];$i++){
echo '<span class="fa fa-star checked"></span>';
}
for ($j=0;$j<5-$row['rate'];$j++){
echo '<span class="fa fa-star"></span>';
}
echo '</div>';
echo "<p>".$row['replier']." 在 ".$row['date_posted']." 寫了一則評論</p>";
// echo "<p> 評分:".$row['rate']."分</p>";
if($row['img_content'] != '0'){
echo "<img src='test/".$row['img_content']."' width='200px'>";
}
echo "<p style='margin:0px;'>".$row['content']."</p>";
if(isset($_GET['id']) && ($memberRow['id'] == $row['member_id'] || $memberRow['is_admin'] == 1)){ //如果是自己留言的 || 如果是管理員
echo '<a href="restaurant.php?id='.$_GET['id'].'&del='.$row['reply_id'].'"><img src="pic/trash.png" style="height:18px;float:right;" onmouseover="this.src=\'pic/trash_hover.png\'" onmouseleave="this.src=\'pic/trash.png\'"></a>';
}
echo '</div></div><br>';
}
}
}
}
}
// function replyContent($id){
// include('pdoInc.php');
// $select = mysqli_query($con, "SELECT replier, content, img_content, rate, date_posted
// FROM reply
// WHERE restaurant_id = $id");
// if(mysqli_num_rows($select) != 0){
// while($row = mysqli_fetch_assoc($select)){
// echo '<div class="card text-dark" style="background-color:rgb(255,255,255,0.3)">
// <div class="card-body">';
// echo '<div style="float:right">評 價 ';
// for ($i=0;$i<$row['rate'];$i++){
// echo '<span class="fa fa-star checked"></span>';
// }
// for ($j=0;$j<5-$row['rate'];$j++){
// echo '<span class="fa fa-star"></span>';
// }
// echo '</div>';
// echo "<p>".$row['replier']." 在 ".$row['date_posted']." 寫了一則評論</p>";
// // echo "<p> 評分:".$row['rate']."分</p>";
// if($row['img_content'] != '0'){
// echo "<img src='test/".$row['img_content']."' width='200px'>";
// }
// echo "<p style='margin:0px;'>".$row['content']."</p>";
// // echo "<div class='like'>Like!</div> <br/><br/>";
// echo '</div></div><br>';
// }
// }
// }
// function replyContent($id){
// include('pdoInc.php');
// $select = mysqli_query($con, "SELECT replier, content, img_content, rate, date_posted
// FROM reply
// WHERE restaurant_id = $id");
// if(mysqli_num_rows($select) != 0){
// while($row = mysqli_fetch_assoc($select)){
// echo '<div class="card text-dark" style="background-color:rgb(255,255,255,0.3)">
// <div class="card-body">';
// echo "<p>".$row['replier']." 在 ".$row['date_posted']." 寫了一則評論</p>";
// echo "<p> 評分:".$row['rate']."分</p>";
// if($row['img_content'] != '0'){
// echo "<img src='test/".$row['img_content']."' width='200px'>";
// }
// echo "<p style='margin:0px;'>".$row['content']."</p>";
// // echo "<div class='like'>Like!</div> <br/><br/>";
// echo '</div></div><br>';
// }
// }
// }
?>