-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
105 lines (96 loc) · 2.95 KB
/
index.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
<?php
header("Content-type: text/html; charset=utf-8");
require_once './lib/mysql.func.php';
require_once './lib/FileUtil.php';
preg_match('/^\/\w*\//', $_SERVER['PHP_SELF'], $webname);
$pro_name = str_replace('/', '', $webname[0]);
// /index.php/501.HTML
// 请求URL必须是path_info的模式
// echo $_SERVER["PATH_INFO"];
$cat_id = '';
$json_path = '';
if (isset($_SERVER["PATH_INFO"])) {
if (preg_match('/^(\/\d{3})+.html/i', $_SERVER["PATH_INFO"], $arr)) {
// print_r($arr[0]);
$cat_id = $arr[0];
$cat_id = str_replace('/', ',', $cat_id);
// 不区分大小写替换
$cat_id = str_ireplace('.html', '', $cat_id);
$cat_id = substr($cat_id, 1);
// echo $cat_id;
$json_path = str_replace(',', '_', $cat_id);
$json_path = $_SERVER['DOCUMENT_ROOT'] . "/$pro_name/data/" . $json_path . '.json';
// echo $json_path;
}
}
$query = " select pro_id, title, img_url, detail_url, shop_name, price, month_sold, comm_percent, seller_ww, short_tbk_url, tbk_url";
$query .= " from BS_ProInfo as A ";
$query .= " join BS_Category as B on A.cat_id=B.cat_id ";
$query .= " where A.disabled=0";
if ($cat_id != '') {
$query .= " and B.cat_id in($cat_id)";
}
$query .= " order by A.pro_id";
$query .= " limit 0, 20";
$result = mysqli_query(connect(), $query);
$rows = array();
while (@$row = mysqli_fetch_assoc($result)) {
$rows[] = $row;
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<title>BoyStyle</title>
<?php require_once 'style.php';?>
<style>
.thumbnail img {
max-height: 428.25px;
min-height: 428.25px;
}
</style>
<meta name="description" content="Source code generated using layoutit.com">
<meta name="author" content="LayoutIt!">
<?php
echo "<link href='/$pro_name/css/bootstrap.min.css' rel='stylesheet'>";
echo "<link href='/$pro_name/css/style.css' rel='stylesheet'>";
?>
</head>
<body>
<div class="container-fluid">
<!--navbar-->
<?php require_once 'header.php';?>
<!--content-->
<div class="row">
<div class="col-md-12" id="content">
</div>
</div>
<!--footer-->
<?php require_once 'footer.php';?>
</div>
<?php require_once 'script.php';?>
<script type="text/javascript">
$(function() {
// RenderJSON("/data/BFF7A6473FF23C3C_1_50.json");
var JSONList = [];
<?php
$query = " select category,load_order,Data_rows,File_Name from BS_JSON";
$query .= " order by category, load_order";
$result = mysqli_query(connect(), $query);
while ($row = mysqli_fetch_assoc($result)) {
echo <<<JSON_List
JSONList.push({
category:'$row[category]',
load_order:'$row[load_order]',
Data_rows:'$row[Data_rows]',
File_Name:'$row[File_Name]'
});
JSON_List;
}
?>
$("#content").data("JSONList", JSONList);
ScrollPaging();
});
</script>
</body>
</html>