Skip to content

Commit e85f85f

Browse files
authored
Add files via upload
1 parent 826b1c8 commit e85f85f

File tree

3 files changed

+381
-0
lines changed

3 files changed

+381
-0
lines changed

common/sdkdata/data.css

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
.data-info {
2+
width: 90%;
3+
margin: 20px auto 0;
4+
}
5+
.data-info img {
6+
width: 100%;
7+
}
8+
.data-info .jump-btn {
9+
text-decoration: none;
10+
display: block;
11+
border-radius: 10px;
12+
color: #fff;
13+
background: #39f;
14+
font-size: 15px;
15+
width: 120px;
16+
padding: 8px 12px;
17+
text-align: center;
18+
margin: 20px auto 0;
19+
}

common/sdkdata/index.php

+184
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,184 @@
1+
<html>
2+
<head>
3+
<meta name="wechat-enable-text-zoom-em" content="true">
4+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
5+
<meta http-equiv="X-UA-Compatible" content="IE=edge">
6+
<meta name="viewport" content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=0,viewport-fit=cover">
7+
<meta name="apple-mobile-web-app-capable" content="yes">
8+
<meta name="apple-mobile-web-app-status-bar-style" content="black">
9+
<meta name="format-detection" content="telephone=no">
10+
<link rel="shortcut icon" href="https://res.wx.qq.com/a/wx_fed/assets/res/NTI4MWU5.ico">
11+
<link rel="stylesheet" href="../../static/css/common.css">
12+
<link rel="stylesheet" href="data.css">
13+
<script type="text/javascript" src="https://lf9-cdn-tos.bytecdntp.com/cdn/expire-1-M/jquery/3.1.1/jquery.min.js"></script>
14+
</head>
15+
<body>
16+
17+
<?php
18+
19+
// 页面编码
20+
header("Content-type:text/html;charset=utf-8");
21+
22+
// 获取参数
23+
$data_key = trim($_GET['key']);
24+
25+
// 过滤不安全的字符
26+
if(preg_match('/[_\-\/\[\].,:;\'"=+*`~!@#$%^&()]/',$data_key)){
27+
28+
echo warnInfo('温馨提示','该链接不安全,请重新生成!');
29+
exit;
30+
}
31+
if(preg_match('/(select|update|drop|DROP|insert|create|delete|where|join|script)/i',$data_key)){
32+
33+
echo warnInfo('温馨提示','该链接不安全,请重新生成!');
34+
exit;
35+
}
36+
37+
// 过滤参数
38+
if($data_key){
39+
40+
// 数据库配置
41+
include '../../console/Db.php';
42+
43+
// 实例化类
44+
$db = new DB_API($config);
45+
46+
// 获取当前 data_key 的详情
47+
$getPageInfo = $db->set_table('ylbPlugin_sdk')->find(['data_key' => $data_key]);
48+
49+
// 1. 检查当前链接的管理账号有效期
50+
// 2. 检测当前链接的管理账号状态
51+
52+
// 获取当前链接的管理账号
53+
$currentKeyUser = $getPageInfo['data_create_user'];
54+
55+
// 获取用户信息
56+
$getUserInfo = $db->set_table('huoma_user')->findAll(
57+
$conditions = ['user_name' => $currentKeyUser],
58+
$order = 'id asc',
59+
$fields = 'user_status',
60+
$limit = null
61+
);
62+
63+
// user_expire_time
64+
65+
// 检查创建者的状态
66+
if($getUserInfo[0]['user_status'] == 2) {
67+
68+
// 账号已被停止使用
69+
echo warnInfo('提示','当前页面的管理账号已被停止使用');
70+
exit;
71+
}
72+
73+
// // 当前链接的管理者的账号有效期
74+
// $current_user_expire_time = strtotime($getUserInfo[0]['user_expire_time']);
75+
76+
// // 对比时间
77+
// if(time() > $current_user_expire_time) {
78+
79+
// // 账号已过期
80+
// echo warnInfo('提示','当前链接的管理账号已到期');
81+
// exit;
82+
// }
83+
84+
if($getPageInfo){
85+
86+
// 检查当前页面是否已达到过期时间
87+
$data_expire_time = $getPageInfo['data_expire_time'];
88+
$current_time = date("Y-m-d H:i:s"); // 当前时间
89+
if (strtotime($current_time) >= strtotime($data_expire_time)) {
90+
91+
// 页面已到期
92+
echo warnInfo('提示','当前页面已过期');
93+
exit;
94+
}
95+
96+
// 状态
97+
$data_status = $getPageInfo['data_status'];
98+
99+
// 判断状态
100+
if($data_status == 1) {
101+
102+
// 正常
103+
// 访问限制检测(仅限手机打开)
104+
if($getPageInfo['data_limit'] == 2 && !preg_match('/Mobile|Android|iPhone|iPad|iPod|Windows Phone|webOS|BlackBerry/i', $_SERVER['HTTP_USER_AGENT'])) {
105+
106+
echo warnInfo('提示','请在手机设备打开页面');
107+
exit;
108+
}
109+
110+
// 访问限制检测(仅限微信内打开)
111+
if($getPageInfo['data_limit'] == 3 && strpos($_SERVER['HTTP_USER_AGENT'], 'MicroMessenger') === FALSE) {
112+
113+
echo warnInfo('提示','请在微信内打开页面');
114+
exit;
115+
}
116+
117+
// 访问限制检测(仅限QQ内打开)
118+
if($getPageInfo['data_limit'] == 4 && strpos($_SERVER['HTTP_USER_AGENT'], 'QQ/') === FALSE && strpos($_SERVER['HTTP_USER_AGENT'], 'MicroMessenger') === FALSE) {
119+
120+
echo warnInfo('提示','请在QQ内打开页面');
121+
exit;
122+
}
123+
124+
// 访问限制检测(仅限抖音内打开)
125+
if($getPageInfo['data_limit'] == 5 && (strpos($_SERVER['HTTP_USER_AGENT'], 'aweme') === FALSE || strpos($_SERVER['HTTP_USER_AGENT'], 'Bytedance') === FALSE)) {
126+
127+
echo warnInfo('提示','请在抖音内打开页面');
128+
exit;
129+
}
130+
131+
// 加载数据
132+
// 所有校验已通过
133+
// 这里就可以开始编写你的业务逻辑了
134+
echo '<div class="data-info">
135+
<title>'.$getPageInfo['data_title'].'</title>
136+
<img src="'.$getPageInfo['data_pic'].'" />
137+
<a href="'.$getPageInfo['data_jumplink'].'" class="jump-btn">点击跳转</a>
138+
</div>';
139+
}else {
140+
141+
// 停用
142+
echo warnInfo('提示','该页面已被管理员停止使用');
143+
}
144+
}else{
145+
146+
// 不存在
147+
echo warnInfo('提示','页面不存在或已被管理员删除');
148+
}
149+
}else {
150+
151+
// 参数不完整
152+
echo warnInfo('提示','参数不完整!');
153+
}
154+
155+
// 提醒文字
156+
function warnInfo($title,$warnText){
157+
158+
return '
159+
<title>'.$title.'</title>
160+
<div id="warnning">
161+
<img src="../../static/img/warn.png" />
162+
</div>
163+
<p id="warnText">'.$warnText.'</p>';
164+
}
165+
?>
166+
</body>
167+
<script>
168+
169+
// 从URL中获取参数
170+
const urlParams = new URLSearchParams(window.location.search);
171+
const key = urlParams.get('key'); // 获取 key 参数
172+
const exportKey = urlParams.get('exportKey'); // 获取 exportKey 参数
173+
if (key && exportKey) {
174+
175+
// 请求
176+
getData(key, exportKey);
177+
}else {
178+
179+
// 参数缺失
180+
document.title = '提醒';
181+
$('#chat-box').html('<div class="warnInfo"><div class="warn_icon"></div>参数缺失,无法加载页面!</div>');
182+
}
183+
</script>
184+
</html>

common/sdkdata/rkpage/index.php

+178
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,178 @@
1+
<html>
2+
<head>
3+
<meta name="wechat-enable-text-zoom-em" content="true">
4+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
5+
<meta http-equiv="X-UA-Compatible" content="IE=edge">
6+
<meta name="color-scheme" content="light dark">
7+
<meta name="viewport" content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=0,viewport-fit=cover">
8+
<meta name="apple-mobile-web-app-capable" content="yes">
9+
<meta name="apple-mobile-web-app-status-bar-style" content="black">
10+
<meta name="format-detection" content="telephone=no">
11+
<link rel="shortcut icon" href="https://res.wx.qq.com/a/wx_fed/assets/res/NTI4MWU5.ico">
12+
<link rel="stylesheet" href="../../../static/css/common.css">
13+
<link rel="stylesheet" href="../../../static/css/bootstrap.min.css">
14+
<link rel="stylesheet" href="https://res.wx.qq.com/t/wx_fed/weui-source/res/2.5.16/weui.min.css">
15+
<script type="text/javascript" src="https://res.wx.qq.com/t/wx_fed/weui.js/res/1.2.21/weui.min.js"></script>
16+
</head>
17+
<body>
18+
19+
<?php
20+
21+
// 页面编码
22+
header("Content-type:text/html;charset=utf-8");
23+
24+
// 获取参数
25+
$data_key = trim($_GET['dkey']);
26+
27+
// 过滤不安全的字符
28+
if(preg_match('/[_\-\/\[\].,:;\'"=+*`~!@#$%^&()]/',$data_key)){
29+
30+
echo warnInfo('温馨提示','该链接不安全,请重新生成!');
31+
exit;
32+
}
33+
if(preg_match('/(select|update|drop|DROP|insert|create|delete|where|join|script)/i',$data_key)){
34+
35+
echo warnInfo('温馨提示','该链接不安全,请重新生成!');
36+
exit;
37+
}
38+
39+
// 过滤参数
40+
if($data_key){
41+
42+
// 数据库配置
43+
include '../../../console/Db.php';
44+
45+
// 实例化类
46+
$db = new DB_API($config);
47+
48+
// 获取当前 data_key 的详情
49+
$getDataInfo = $db->set_table('ylbPlugin_sdk')->find(['data_key' => $data_key]);
50+
51+
// 1. 检查当前链接的管理账号有效期
52+
// 2. 检测当前链接的管理账号状态
53+
54+
// 获取当前链接的管理账号
55+
$currentKeyUser = $getDataInfo['data_create_user'];
56+
57+
// 获取用户信息
58+
$getUserInfo = $db->set_table('huoma_user')->findAll(
59+
$conditions = ['user_name' => $currentKeyUser],
60+
$order = 'id asc',
61+
$fields = 'user_status',
62+
$limit = null
63+
);
64+
65+
// user_expire_time
66+
67+
// 检查创建者的状态
68+
if($getUserInfo[0]['user_status'] == 2) {
69+
70+
// 账号已被停止使用
71+
echo warnInfo('提示','当前页面的管理账号已被停止使用');
72+
exit;
73+
}
74+
75+
// // 当前链接的管理者的账号有效期
76+
// $current_user_expire_time = strtotime($getUserInfo[0]['user_expire_time']);
77+
78+
// // 对比时间
79+
// if(time() > $current_user_expire_time) {
80+
81+
// // 账号已过期
82+
// echo warnInfo('提示','当前链接的管理账号已到期');
83+
// exit;
84+
// }
85+
86+
// 检查当前页面是否已达到过期时间
87+
$data_expire_time = $getDataInfo['data_expire_time'];
88+
$current_time = date("Y-m-d H:i:s"); // 当前时间
89+
if (strtotime($current_time) >= strtotime($data_expire_time)) {
90+
91+
// 页面已到期
92+
echo warnInfo('提示','当前页面已过期');
93+
exit;
94+
}
95+
96+
if($getDataInfo){
97+
98+
// 落地域名
99+
$data_ldym = $getDataInfo['data_ldym'];
100+
101+
// 状态
102+
$data_status = $getDataInfo['data_status'];
103+
104+
// 当前访问次数
105+
$data_pv = $getDataInfo['data_pv'];
106+
107+
// 判断状态
108+
if($data_status == 1) {
109+
110+
// 正常
111+
// 访问限制检测(仅限手机打开)
112+
if($getDataInfo['page_limit'] == 2 && !preg_match('/Mobile|Android|iPhone|iPad|iPod|Windows Phone|webOS|BlackBerry/i', $_SERVER['HTTP_USER_AGENT'])) {
113+
114+
echo warnInfo('提示','请在手机设备打开页面');
115+
exit;
116+
}
117+
118+
// 访问限制检测(仅限微信内打开)
119+
if($getDataInfo['page_limit'] == 3 && strpos($_SERVER['HTTP_USER_AGENT'], 'MicroMessenger') === FALSE) {
120+
121+
echo warnInfo('提示','请在微信内打开页面');
122+
exit;
123+
}
124+
125+
// 访问限制检测(仅限QQ内打开)
126+
if($getDataInfo['page_limit'] == 4 && strpos($_SERVER['HTTP_USER_AGENT'], 'QQ/') === FALSE && strpos($_SERVER['HTTP_USER_AGENT'], 'MicroMessenger') === FALSE) {
127+
128+
echo warnInfo('提示','请在QQ内打开页面');
129+
exit;
130+
}
131+
132+
// 访问限制检测(仅限抖音内打开)
133+
if($getDataInfo['page_limit'] == 5 && (strpos($_SERVER['HTTP_USER_AGENT'], 'aweme') === FALSE || strpos($_SERVER['HTTP_USER_AGENT'], 'Bytedance') === FALSE)) {
134+
135+
echo warnInfo('提示','请在抖音内打开页面');
136+
exit;
137+
}
138+
139+
// 更新访问次数
140+
$newPV = $data_pv + 1;
141+
$db->set_table('ylbPlugin_sdk')->update(
142+
['data_key' => $data_key],
143+
['data_pv' => $newPV]
144+
);
145+
146+
// 跳转到落地域名页面
147+
$jumpToldym = dirname(dirname($data_ldym . $_SERVER['REQUEST_URI'])).'/?key='.$data_key;
148+
header('Location:' . $jumpToldym . '&exportKey='.MD5(time()).'&signature='.hash('sha256', $data_key.time()));
149+
}else {
150+
151+
// 停用
152+
echo warnInfo('提示','该页面已被管理员停止使用');
153+
}
154+
}else{
155+
156+
// 不存在
157+
echo warnInfo('提示','页面不存在或已被管理员删除');
158+
}
159+
}else {
160+
161+
// 参数不完整
162+
echo warnInfo('提示','参数不完整!');
163+
}
164+
165+
// 提醒文字
166+
function warnInfo($title,$warnText){
167+
168+
return '
169+
<title>'.$title.'</title>
170+
<div id="warnning">
171+
<img src="../../../static/img/warn.png" />
172+
</div>
173+
<p id="warnText">'.$warnText.'</p>';
174+
}
175+
176+
?>
177+
</body>
178+
</html>

0 commit comments

Comments
 (0)