/
commodity1.php
304 lines (285 loc) · 12.7 KB
/
commodity1.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
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
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>商品</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta charset="utf-8">
<meta name="keywords" content=" Inwardly Responsive web template, Bootstrap Web Templates, Flat Web Templates, Android Compatible web template,
Smartphone Compatible web template, free webdesigns for Nokia, Samsung, LG, SonyEricsson, Motorola web design" />
<script>
addEventListener("load", function() {
setTimeout(hideURLbar, 0);
}, false);
function hideURLbar() {
window.scrollTo(0, 1);
}
// window.onload = function() {
// if (!!window.performance && window.performance.navigation.type === 1) {
// window.location.reload();
// alert("請從登入處進入頁面")
// window.history.back(1);
// }
// if (!!window.performance && window.performance.navigation.type === 2) {
// window.location.reload();
// alert("請從登入處進入頁面")
// window.history.back(1);
// }
// };
</script>
<!--// Meta tag Keywords -->
<!-- css files -->
<link rel="stylesheet" href="css/bootstrap.css">
<!-- Bootstrap-Core-CSS -->
<link rel="stylesheet" href="css/owl.carousel.css" type="text/css" media="all">
<link rel="stylesheet" href="css/owl.theme.css" type="text/css" media="all">
<link rel="stylesheet" href="css/style.css" type="text/css" media="all" />
<!-- Style-CSS -->
<link href="css/prettyPhoto.css" rel="stylesheet" type="text/css" />
<link href="css/style6.css" rel='stylesheet' type='text/css' />
<link rel="stylesheet" href="css/fontawesome-all.css">
<!-- Font-Awesome-Icons-CSS -->
<!-- //css files -->
<!--web font-->
<link href="//fonts.googleapis.com/css?family=Open+Sans:300,300i,400,400i,600,600i,700,700i,800" rel="stylesheet">
<link href="//fonts.googleapis.com/css?family=Raleway:100,100i,200,200i,300,300i,400,400i,500,500i,600,600i" rel="stylesheet">
<!--//web font-->
<?php session_start(); ?>
</head>
<body>
<!-- banner -->
<section class="banner-inner" id="home">
<!-- header -->
<header>
<div class="container">
<nav class="navbar navbar-expand-lg navbar-light">
<h1><a class="navbar-brand" href="index.php">
<span class="fab fa-osi"></span> 卑鄙粘之棉
</a></h1>
<button class="navbar-toggler ml-md-auto" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav ml-lg-auto text-center">
<li class="nav-item cool">
<a class="nav-link" href="index.php">首頁
<span class="sr-only">(current)</span>
</a>
</li>
<li class="nav-item active cool">
<a class="nav-link" href="commodity.php">商品</a>
</li>
<li class="nav-item cool">
<a class="nav-link" href="custom.php">客製化</a>
</li>
<li class="nav-item cool">
<a class="nav-link" href="contact.php">問題回報</a>
</li>
<?php
//判斷COOKIE內是否有資料,有就顯示會員名稱、登出,否則登入/註冊
if (!isset($_SESSION["code"])) {
?>
<li class="nav-item cool">
<!--顯示登入/註冊按鈕-->
<a class="nav-link" href="login.php">登入/註冊</a>
</li>
<?php
} else {
?>
<li class="nav-item dropdown cool">
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<?php echo $_SESSION["account"] ?>您好</a>
<div class="dropdown-menu" aria-labelledby="navbarDropdown">
<a class="dropdown-item" href="blog.html">個人資訊</a>
<a class="dropdown-item" href="changepswd.php">修改密碼</a>
<div class="dropdown-divider"></div>
<a class="dropdown-item" href="signout.php">登出</a>
</div>
</li>
<?php
}
?>
<!-- /search -->
<li class="search">
<div class="cd-main-header">
<ul class="cd-header">
<li>
<a href="buybuycar.php">
<img src="./images/buybuycar.png" style="background:rgba(177, 173, 173, 0.12); width:35px;height:35px">
<span></span>
</a>
</li>
</ul>
</div>
<div id="cd-search" class="cd-search">
<form action="#" method="post">
<input name="Search" type="search" placeholder="Click enter after typing...">
</form>
</div>
</li>
</ul>
</div>
</nav>
</div>
</header>
<!-- //header -->
<!-- banner -->
<div class="bs-slider-overlay-inner"></div>
</section>
<!-- //banner -->
<ol class="breadcrumb">
<li class="breadcrumb-item">
<a href="index.php">首頁</a>
</li>
<li class="breadcrumb-item active">商品</li>
</ol>
<!--gallery -->
<section class="gallery py-md-5 py-4">
<div class="gallery-inner py-md-5 py-4">
<h2 class="tittle text-center mb-md-5 mb-4">商品</h2>
<ul class="portfolio-categ filter pb-5 mb-lg-3 text-center">
<li>
<a href="commodity.php">所有商品</a>
</li>
<li class="port-filter all active">
<a href="commodity1.php">價格高到低</a>
</li>
<li>
<a href="commodity2.php">價格低到高</a>
</li>
<li>
<a href="commodity3.php">特價商品</a>
</li>
<li>
<a href="commodity4.php">熱銷商品</a>
</li>
</ul>
<ul class="portfolio-area clearfix">
<?php
$dbhost = '127.0.0.1';
$dbuser = 'hj';
$dbpass = 'test1234';
$dbname = 'db_commodity';
$conn = new mysqli($dbhost, $dbuser, $dbpass, $dbname);
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
$dbcommodityname = null;
$dbcommoditymoney = null;
$dbcommodityimage = null;
$dbcommoditymodel = null;
$sql = "SELECT model, name, money, image FROM commodity2 ORDER BY money DESC";
$result = $conn->query($sql);
echo "<div style=padding:30px>";
while ($row = $result->fetch_assoc()) { //while迴圈將$result中的結果找出來
$dbcommodityname = $row["name"];
$dbcommoditymoney = $row["money"];
$dbcommodityimage = $row["image"];
$dbcommoditymodel = $row["model"];
echo "<form method = post action=information.php>
<ul class=portfolio-area clearfix>
<li class=portfolio-item2>
<span class=image-block>
<a href=information.php?model=$row[model] style=color:black>
<tr>
<div style=padding:10px>
<td><img src=$row[image] class=img-fluid style=width:300px;height:300px><br></td>
<td>$row[name]<br></td>
<td>價錢:$row[money]<br></td>
</div>
</tr>
<br>
</a>
</span>
</li>
</ul>
</form>";
}
echo "</div>";
$conn->close();
?>
</div>
<!-- //gallery container -->
</section>
<!-- js -->
<script src="js/jquery-2.2.3.min.js"></script>
<script src="js/search.js"></script>
<!-- /dropdown nav -->
<script>
$(document).ready(function() {
$(".dropdown").hover(
function() {
$('.dropdown-menu', this).stop(true, true).slideDown("fast");
$(this).toggleClass('open');
},
function() {
$('.dropdown-menu', this).stop(true, true).slideUp("fast");
$(this).toggleClass('open');
}
);
});
</script>
<!-- //dropdown nav -->
<!-- Banner Responsiveslides -->
<script src="js/responsiveslides.min.js"></script>
<script>
// You can also use "$(window).load(function() {"
$(function() {
// Slideshow 4
$("#slider3").responsiveSlides({
auto: true,
pager: true,
nav: false,
speed: 500,
namespace: "callbacks",
before: function() {
$('.events').append("<li>before event fired.</li>");
},
after: function() {
$('.events').append("<li>after event fired.</li>");
}
});
});
</script>
<!-- // Banner Responsiveslides -->
<!-- Smooth-Scrolling-JavaScript -->
<script src="js/easing.js"></script>
<script src="js/move-top.js"></script>
<script>
jQuery(document).ready(function($) {
$(".scroll, .navbar li a, .footer li a").click(function(event) {
$('html,body').animate({
scrollTop: $(this.hash).offset().top
}, 1000);
});
});
</script>
<!-- //Smooth-Scrolling-JavaScript -->
<script>
$(document).ready(function() {
/*
var defaults = {
containerID: 'toTop', // fading element id
containerHoverID: 'toTopHover', // fading element hover id
scrollSpeed: 1200,
easingType: 'linear'
};
*/
$().UItoTop({
easingType: 'easeOutQuart'
});
});
</script>
<!-- //Smooth-Scrolling-JavaScript -->
<!-- jQuery-Photo-filter-lightbox-Gallery-plugin -->
<!--// end-smoth-scrolling -->
<script src="js/jquery-1.7.2.js"></script>
<script src="js/jquery.quicksand.js"></script>
<script src="js/script.js"></script>
<script src="js/jquery.prettyPhoto.js"></script>
<!-- //jQuery-Photo-filter-lightbox-Gallery-plugin -->
<!-- /js -->
<script src="js/bootstrap.js"></script>
<!-- //js -->
</body>
</html>