forked from HarDi517/h-p-project
-
Notifications
You must be signed in to change notification settings - Fork 0
/
자세히보기2.php
156 lines (114 loc) · 3.61 KB
/
자세히보기2.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
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
<!DOCTYPE html>
<html lang="en">
<head>
<META NAME="GENERATOR" Content="Microsoft Visual Studio">
<meta name="description" content="This is an HTML5 example">
<meta name="keywords" content="HTML5, CSS3, JavaScript">
<title> 커픽(CUPPICK) </title>
<link rel="stylesheet" href="main_css.css">
</head>
<body>
<div class="wapper">
<header>
<a href="ver2_main.php"><img src="logo.jpg" width="100px" height="100px"></a>
<p>What's your Cuppick?</p>
</header>
<?php
$host='39.115.75.246';
$user='bobo';
$password='opensw1';
$dbname='test';
$cafeName=$_COOKIE["myvar3"];
$OwnerID=$_COOKIE["myvar4"];
$cafeAddress='';
$cafeType='';
$cafePurpose='';
$cafePlug='';
$cafeParking='';
$cafeToilet='';
$cafeWiFi='';
$cafeScore='';
$cafePost='';
$cafeOwnerID='';
$db=new mysqli($host, $user, $password, $dbname);
if(mysqli_connect_errno()){
echo '<p>Error: Could not connect to database.<br/> Please try agin later.</p>';
exit;
}
/* $select_cafe_query="SELECT OwnerID, CafeName, CafeAddress, CafeType, Purpose, Plug, Parking, Toilet, WiFi FROM owner WHERE cafeName = ?";
$stmt5=$db->prepare($select_cafe_query);
$stmt5->bind_param('s',$cafeName);
$stmt5->execute();
$stmt5->store_result();
$stmt5->bind_result($cafeOwnerID, $cafeName, $cafeAddress, $cafeType, $cafePurpose, $cafePlug, $cafeParking, $cafeToilet, $cafeWiFi);
*/
$select_review_query="SELECT Score, Post FROM customer WHERE owner_OwnerID = $OwnerID";
$stmt6=$db->prepare($select_review_query);
$stmt6->execute();
$stmt6->store_result();
$stmt6->bind_result($cafeScore,$cafePost);
?>
<section>
<article>
<h1><?php echo $cafeName; ?></h1>
<table id="user-table2">
<thead>
<tr>
<th></th>
<th>사용자들의 리뷰</th>
<th>별점(5점만점)</th>
</tr>
</thead>
<tbody>
<?php
$sum=0;
$count=0;
$star=0;
while($stmt6->fetch()){ ?>
<tr>
<?php $count=$count+1; ?>
<td><?php echo $count; ?></td>
<td><?php echo $cafePost; ?></td>
<td><?php echo $cafeScore; ?></td>
<?php $sum=$sum+$cafeScore; ?>
</tr>
<?php } ?>
<?php $star=$sum/$count;?>
<?php $name6="myvar6";
$value6=$star;
setcookie($name6,$value6); ?>
<?php echo $star; ?>
</tbody>
</table>
</article>
</section>
<!--사이드바-->
<aside>
안녕하세요! [
<?php
$userEmail=$_COOKIE["myvar2"];
echo $userEmail;
?> ] 님</p>
<form action="main.php" method="post">
<button>로그아웃</button>
</form>
<form action="customer_info.php" method="post">
<button>회원정보수정</button>
</form>
<form action="showowner.php" method="post">
<button>사업자용 리뷰보기</button>
</form>
</aside>
<script ="text/javascript">
function logIn() {
var memberRegister = window.open('logIn.html', '', 'width=800, height=600');
}
function register() {
var memberRegister = window.open('memberRegister.html', '', 'width=800, height=600');
}
</script>
</aside>
<footer></footer>
</div>
</body>
</html>