forked from SinYeongJoo/BigDataApplication
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMain.php
More file actions
184 lines (179 loc) · 5.83 KB
/
Main.php
File metadata and controls
184 lines (179 loc) · 5.83 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
<?php
$mysql_port=3306;
$conn = mysqli_connect('localhost', 'team09', 'team09', 'team09');
mysqli_query($conn, "set session character_set_connection=utf8;");
mysqli_query($conn, "set session character_set_results=utf8;");
mysqli_query($conn, "set session character_set_client=utf8;");
$select_query = "SELECT * FROM cafe";
$result_set = mysqli_query($conn, $select_query);
?>
<!DOCTYPE html>
<html lang="ko">
<head>
<meta charset="UTF-8" />
<style>
.intro_div{
position:absolute;
top:20%;
left:12%;
font-size: 5ch;
font-weight: bolder;
}
.search_input{
width: 450px;
height: 50px;
position: fixed;
top:300px;
left:12%;
border: solid 3px teal;
border-top-left-radius: 5px;
border-bottom-left-radius: 5px;
}
.search_button {
width: 80px;
height: 58px;
position: fixed;
top:300px;
left:12%;
margin-left: 450px;
border: solid 3px teal;
border-top-right-radius: 5px;
border-bottom-right-radius: 5px;
background-color: teal;
color: white
}
.logo_button {
width: 55px;
position:absolute;
top:18px;
left:8%;
}
.analysis_button {
width: 40px;
position:absolute;
top:20px;
right:150px;
}
.login_button {
height: 40px;
width: 40px;
position:absolute;
top:20px;
right:90px;
}
.add_button {
width: 70px;
height: 40px;
position:fixed;
border: solid 1px teal;
border-radius: 5px;
top:18px;
right:220px;
color: white;
background-color:teal;
}
.map_wrap{
position: absolute;
height: 530px;
width: 580px;
right: 4%;
top:25%;
}
#map_image{
position: absolute;
width: 680px;
height: 630px;
}
@media screen and (max-width: 1500px){
#map_image{
display: none;
}
}
@media screen and (max-width: 1500px){
.map_wrap{
display: none;
}
}
.recco_wrap{
width: 600px;
height: 360px;
position: fixed;
top:360px;
left:12%;
margin-left: -10px;
float: left;
}
#recco_one_div{
width: 161px;
height: 240px;
padding-left: 10px;
padding-right: 10px;
margin-top:-12px;
float: left;
}
#recco_one_border_div{
border-right: solid 1px #DDDDDD;
width: 161px;
height: 240px;
padding-left: 10px;
padding-right: 10px;
margin-top:-12px;
float: left;
}
</style>
</head>
<body>
<input class = "logo_button" type="image" src="images/logo_3.png" onclick="location.href='Main.php'">
<?php
session_start();
if(isset($_SESSION['user_id'])){
$link = 'MyPage.php';
}else{
$link = 'Login.php';
}
?>
<input class = "login_button" type="image" src="images/person.png" onclick="location.href='<?php echo $link ?>'">
<input class = "analysis_button" type="image" src = "images/analysis.png" onclick="location.href='Analysis_1.php'">
<?php
if(isset($_SESSION['user_id'])){?>
<input class = "add_button" type="button" value = "+ Cafe" onclick="location.href='Add.php'"/>
<?php } ?>
<hr style="width: 100%; color: gray; margin-top: 70px;"/>
<div class = "intro_div">
<p style="text-align: center;">Find your cafe, Navi Latte</p>
</div>
<form method="GET" action="Search.php">
<input type="text" id="search_data" class = "search_input" name = "cafe_search"/>
<button type="submit" class="search_button" value="search">SEARCH</button>
</form>
<div class = "map_wrap">
<img src="images/logo_4.png" height = "450px;">
</div>
<div class = "recco_wrap">
<?php
$rating_ = "SELECT src, cafe_name, rating_sum/rating_num FROM rating, cafe, img where cafe.cafe_id = img.cafe_id and cafe.cafe_id=rating.cafe_id order by rating_sum/rating_num desc;";
$rating = mysqli_query($conn, $rating_);?>
<p style="padding-left:17px; font-size: 1.5em; font-weight: bold;">Meet the cafe with the highest stars!</p>
<div style = "float:left; width:100%;">
<?php $i = 2; while($price = mysqli_fetch_row($rating)){ ?>
<div id = "recco_one_border_div">
<img src = "<?php echo $price[0]?>", height = "80%", width = "100%">
<p style = "margin-top:0px; margin-bottom:0px; font-size:1.0em; font-weight:bold;"><?php echo $price[1]; ?></p>
<img src = "images/star.png" width = "18px">
<p style = "float:right; width:85%; margin-top:0px; font-size:0.9em;"><?php echo round($price[2],2);?> </p>
</div>
<?php $i--; if($i <= 0) break; } ?>
<?php $price = mysqli_fetch_row($rating);?>
<div id = "recco_one_div">
<img src = "<?php echo $price[0]?>", height = "80%", width = "100%">
<p style = "margin-top:0px; margin-bottom:0px; font-size:1.0em; font-weight:bold;"><?php echo $price[1];?></p>
<img src = "images/star.png" width = "18px">
<p style = "width:85%; margin-top:0px; font-size:0.9em;"><?php echo round($price[2],2);?> </p>
</div>
</div>
</div>
<?php
mysqli_close($conn);
?>
</body>
</html>