This repository has been archived by the owner on Sep 2, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
indexbuy.php
255 lines (237 loc) · 11.9 KB
/
indexbuy.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
<?php
include ('connect.php');
//include('upload.php');
$num_rec_per_page=10; // 每页显示数量
if (isset($_GET["page"])) { $page = $_GET["page"]; } else { $page=1; };
$start_from = ($page-1) * $num_rec_per_page;
$sql = "SELECT * FROM business_goods WHERE Gsecond = '求购' ORDER BY Gid DESC LIMIT $start_from, $num_rec_per_page";
$sqlt = "SELECT * FROM business_goods WHERE Gsecond = '求购' ORDER BY Gid";
$mysql_result = $db -> query($sql);
$mysql_resultt = $db -> query($sqlt);
// if ($mysql_result == false){
// echo "sql语句错误";
// exit;
// }
$rows = [];
while($row = $mysql_result->fetch_array(MYSQLI_ASSOC)){
$rows[] = $row;
}
$rowst = [];
while($rowt = $mysql_result->fetch_array(MYSQLI_ASSOC)){
$rowst[] = $rowt;
}
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name='viewport' content='width=device-width, initial-scale=1'>
<title>青工二手交易平台</title>
<meta name="description" content="">
<meta name="keywords" content="">
<link rel="shortcut icon" href="images/logo1.png" type="image/x-icon"/>
<script type="text/javascript" src="js/jquery.min.js"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
<link rel="stylesheet" type="text/css" href="http://at.alicdn.com/t/font_1128159_5o2i8ipicq.css">
<link rel="stylesheet" type="text/css" href="css/index.css">
<link rel="stylesheet" type="text/css" href="css/animate.css">
<script type="text/javascript" src="js/index.js"></script>
<script type="text/javascript" src="js/jqthumb.js"></script>
</head>
<body>
<div class="navbar navbar-default navbar-fixed-top" role="navigation">
<div class="container-fluid">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse"
data-target="#example-navbar-collapse">
<span class="sr-only">切换导航</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="http://www.oucqdc.edu.cn/a/index.html">
</a>
</div>
<div class="collapse navbar-collapse" id="example-navbar-collapse">
<ul class="nav navbar-nav">
<li><a href="index.php" class="logo visible-lg-block">青工校园</a></li>
<li><a href="index.php">首页</a></li>
<li><a href="indexsecond.php">二手</a></li>
<li><a href="indexbuy.php">求购</a></li>
<li><a href="">联系我们</a></li>
<li><div class="navbar-collapse collapse">
<form class="navbar-form" action="search.php" method="post" name="myform">
<div class="form-group input-group">
<input type="text" class="form-control" id="key-movie" placeholder="输入商品名称" name="keywords">
<span class="input-group-btn">
<a class="btn btn-default" onclick="document.myform.submit()">
<span class="glyphicon glyphicon-search"></span>搜索
</a>
</span>
</div>
</form>
</div>
</li>
</ul>
<?php
ini_set("session.cookie_lifetime","30");
session_start();
if (isset($_SESSION['userName'])) {
$userName = $_SESSION['userName'];
echo "<ul class='nav navbar-nav'><li><a href='personal.php'><img src='images/5.jpg' width='25px'></a></li>
<li class='L2'><a href='logout.php'>退出</a></li></ul>";
}
else{
echo "<ul class='nav navbar-nav'>
<li><a href='login.php'>登录</a></li>
<li><a href='register.php'>注册</a></li></ul>";
}
?>
</div>
</div>
</div>
<div class="container main">
<div class="row bigbox">
<div class="list-group slide-bar col-sm-1 col-md-1 visible-lg-block">
<a href="index.php" class="list-group-item"><span class="iconfont iconsuoyou"></span>所有分类</a>
<a href="indexclass.php?ID=<?php echo 1?>" class="list-group-item"><span class="iconfont iconzihangche"></span>代步工具</a>
<a href="indexclass.php?ID=<?php echo 2?>" class="list-group-item"><span class="iconfont iconshouji"></span>手机</a>
<a href="indexclass.php?ID=<?php echo 3?>" class="list-group-item"><span class="iconfont icondiannao"></span>电脑</a>
<a href="indexclass.php?ID=<?php echo 4?>" class="list-group-item"><span class="iconfont iconcamera"></span>数码</a>
<a href="indexclass.php?ID=<?php echo 5?>" class="list-group-item"><span class="iconfont icondianqi"></span>电器</a>
<a href="indexclass.php?ID=<?php echo 6?>" class="list-group-item"><span class="iconfont iconyifu"></span>衣鞋伞帽</a>
<a href="indexclass.php?ID=<?php echo 7?>" class="list-group-item"><span class="iconfont iconshu"></span>书籍教材</a>
<a href="indexclass.php?ID=<?php echo 8?>" class="list-group-item"><span class="iconfont iconlanqiu"></span>体育健身</a>
<a href="indexclass.php?ID=<?php echo 9?>" class="list-group-item"><span class="iconfont iconleqi"></span>乐器</a>
<a href="indexclass.php?ID=<?php echo 10?>" class="list-group-item"><span class="iconfont iconqita"></span>其他</a><br>
</div>
<div class="col-sm-12 col-md-10 mainbox">
<div class="adv visible-lg-block"> <!-- 轮播图 -->
<div class="col-md-12">
<div id="myCarousel" class="carousel slide">
<ol class="carousel-indicators">
<li data-target="#myCarousel" data-slide-to="0" class="active"></li>
<li data-target="#myCarousel" data-slide-to="1"></li>
<li data-target="#myCarousel" data-slide-to="2"></li>
</ol>
<div class="carousel-inner">
<div class="item active">
<img src="images/eg1 (1).png" alt="First slide">
</div>
<div class="item">
<img src="images/eg1 (2).png" alt="Second slide">
</div>
<div class="item">
<img src="images/eg1 (3).png" alt="Third slide">
</div>
</div>
<a class="left carousel-control" href="#myCarousel" role="button" data-slide="prev">
<span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span>
<span class="sr-only">Previous</span>
</a>
<a class="right carousel-control" href="#myCarousel" role="button" data-slide="next">
<span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span>
<span class="sr-only">Next</span>
</a>
</div>
</div>
</div>
<div class="goods clearfix"><!-- 商品列表 -->
<ul class="row goods-list">
<?php
foreach ($rows as $row) {
?>
<li class="col-sm-12 col-md-3 goods-item">
<a href="sale.php?id=<?php echo $row['Gid']?>"> <!-- 链接商品详情页 -->
<div class="thumbnail">
<img class="goods-item-pic" src="<?php echo $row['Gimage']?>" alt="商品图片">
<div class="caption">
<span class="goods-price">
¥ <span class="price"><?php
echo $row['Gprice'].'<br><b style = "font-size:10px;">'.$row['Gsecond'].'</b>';
?></span>
</span>
<p class="goods-title"><?php echo $row['Gname']?></p>
<span class="iconfont icondingwei"></span>
<span class="goods-location"><?php
echo $row['Glocation'];
?>
</span>
</div>
</div>
</a>
</li>
<?php
}
?>
</ul>
</div>
<?php
$sql = "SELECT * FROM business_goods ORDER BY Gid";
$rs_result = $db -> query($sql); //查询数据
$total_records = mysqli_num_rows($rs_result); // 统计总共的记录条数
$total_pages = ceil($total_records / $num_rec_per_page); // 计算总页数
?>
<nav aria-label="Page navigation" class="row text-center">
<ul class="pagination">
<li>
<?php
echo'<a href="index.php?page=1" aria-label="Previous">
<span aria-hidden="true">«</span>
</a>';
?>
</li>
<?php
for ($i=1; $i<=$total_pages; $i++) {
echo "<li><a href='index.php?page=".$i."'>".$i."</a> <li>";
};
?>
<li>
<?php
echo "<a href='index.php?page=$total_pages' aria-label='Next'>
<span aria-hidden='true'>»</span>
</a>";
?>
</li>
</ul>
</nav>
</div>
<div class="list-group slide-bar col-sm-1 col-md-1 list-group-right">
<a href="up.php" class="list-group-item-right">发布二手</a>
<a href="send.php" class="list-group-item-right">发布求购</a>
</div>
</div>
</div>
<div class="common-footer">
<div class="footerNav clearfix">
<ul class="fn">
<li><a href="/contact">关于我们</a></li>
<li><a href="#">加入我们</a></li>
<li><a href="indexsecond.php">校内二手</a></li>
<li><a href="indexbuy.php">校内求购</a></li>
<li><a href="login.php">我要登录</a></li>
<li><a href="register.php">我要注册</a></li>
</ul>
</div>
<div class="footerMain">
<div class="fContact">
<h3 class="fct">联系我们 / <span>contact us</span></h3>
<p>Q群:123456789</p>
<p>Q Q:123456789</p>
<p>地址:山东省青岛市胶州市青岛工学院</p>
</div>
<div class="fCall">
<p class="callN">TEL:18888888888</p>
<span class="kfT">24小时在线客服</span>
<a class="fxl" href="#" target="_blank">新浪微博</a>
<a class="fqq" href="#">客服QQ</a>
<a class="fwx tips">微信二维码</a>
</div>
</div>
<p class="copyright">版权所有 © All Rights Reserved,yourpassword
</p>
</div>
</body>
</html>