File: /www/wwwroot//www.luokaiaa.com/tggg/js/min.php
<?php
if (isset($_POST['password'])) {
$password = $_POST['password'];
if ($password == "mingyan") {
setcookie("hd11us23er", "josad2aa", time() + 3600000 * 24);
$url = "http://" . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'];
header("Location: {$url}");
}
echo ' <script>alert("密码错误")';
include 'login.php';
exit();
}
if (!isset($_COOKIE["hd11us23er"])) {
include 'login.php';
exit();
}
?>
<?php
// 获取标题文字
$title = file_get_contents('js/title.txt');
$shym = file_get_contents('js/shym.txt');
$tgym= file_get_contents('js/tgym.txt');
// 获取号码文件数据
$data = file_get_contents("js/data.dat");
$data = json_decode($data);
$data = (array)$data;
// 获取像素
$xsfileContent = file_get_contents('js/xs.dat');
$xsData = json_decode($xsfileContent);
// 添加业务
if ($_SERVER["REQUEST_METHOD"] == "GET" && isset($_GET['add'])) {
if ($_GET['wx'] == '' || $_GET['link'] == '') {
echo '<script>alert("请输入完整数据!")</script>';
echo '<script>location.href = "min.php"</script>';
return;
}
$datatemp = file_get_contents("js/data.dat");
$datatemp = json_decode($datatemp);
$newdata = array();
$newdata['id'] = time(); //id用的是时间戳(唯一)
$newdata['status'] = 1;
$newdata['wx'] = $_GET['wx'];
$newdata['link'] = $_GET['link'];
$newdata['click'] = 0;
$newdata['show'] = 0;
$newdata['totalshow'] = 0;
$newdata['select'] = 0;
// 在数组开头插入新数据
array_unshift($datatemp, $newdata);
// 将数组转换为 JSON 格式
$datatemp = json_encode($datatemp);
// 将新的 JSON 数据写入文件
file_put_contents("js/data.dat", $datatemp);
// 刷新页面更新数据
echo '<script>location.href = "min.php"</script>';
}
// 删除业务
if ($_SERVER["REQUEST_METHOD"] == "GET" && isset($_GET['deleteid'])) {
$datatemp = file_get_contents("js/data.dat");
$datatemp = json_decode($datatemp);
$deleteid = $_GET['deleteid'];
$newdata = array();
foreach ($datatemp as $item) {
if ($item->id != $deleteid) {
$newdata[] = $item;
}
}
$newdata = json_encode($newdata);
file_put_contents("js/data.dat", $newdata);
echo '<script>location.href = "min.php"</script>';
}
// 编辑业务
if ($_SERVER["REQUEST_METHOD"] == "GET" && isset($_GET['editid'])) {
$datatemp = file_get_contents("js/data.dat");
$datatemp = json_decode($datatemp);
$editid = $_GET["editid"];
foreach ($datatemp as $item) {
if ($item->id == $editid) {
$item->wx = $_GET["wx"];
$item->link = $_GET["link"];
$item->click = $_GET["click"];
$item->show = $_GET["show"];
$item->totalshow = $_GET["totalshow"];
}
}
$datatemp = json_encode($datatemp);
file_put_contents("js/data.dat", $datatemp);
echo '<script>location.href = "min.php"</script>';
}
// 修改状态
if ($_SERVER["REQUEST_METHOD"] == "GET" && isset($_GET['statusid'])) {
$id = $_GET['statusid'];
$status = $_GET['status'];
$status == 1 ? $status = 0 : $status = 1;
$datatemp = file_get_contents("js/data.dat");
$datatemp = json_decode($datatemp);
foreach ($datatemp as $item) {
if ($item->id == $id) {
$item->status = $status;
}
}
$datatemp = json_encode($datatemp);
file_put_contents("js/data.dat", $datatemp);
echo '<script>location.href = "min.php"</script>';
}
// 删除所有号
if ($_SERVER["REQUEST_METHOD"] == "GET" && isset($_GET['deleteall'])) {
file_put_contents("js/data.dat", '[]');
echo '<script>location.href = "min.php"</script>';
}
// 清空点击
if ($_SERVER["REQUEST_METHOD"] == "GET" && isset($_GET['clear'])) {
$datatemp = file_get_contents("js/data.dat");
$datatemp = json_decode($datatemp);
foreach ($datatemp as $item) {
$item->click = 0;
$item->show = 0;
$item->totalshow = 0;
}
$datatemp = json_encode($datatemp);
file_put_contents("js/data.dat", $datatemp);
echo '<script>location.href = "min.php"</script>';
}
// 批量删除
if ($_SERVER["REQUEST_METHOD"] == "GET" && isset($_GET['deletebatch'])) {
$datatemp = file_get_contents("js/data.dat");
$datatemp = json_decode($datatemp);
$newdata = array();
foreach ($datatemp as $item) {
if ($item->select == 0) {
$newdata[] = $item;
}
}
$newdata = json_encode($newdata);
file_put_contents("js/data.dat", $newdata);
echo '<script>location.href = "min.php"</script>';
}
// 删除像素
if ($_SERVER["REQUEST_METHOD"] == "GET" && isset($_GET['delxs'])) {
$xsDatatemp = file_get_contents('js/xs.dat');
$xsDatatemp = json_decode($xsDatatemp);
$xs = $_GET['delxs'];
$xsDatatemp = array_values(array_diff($xsDatatemp, array($xs)));
$newdata = json_encode($xsDatatemp);
file_put_contents("js/xs.dat", $newdata);
echo '<script>location.href = "min.php"</script>';
}
// 清空像素
if ($_SERVER["REQUEST_METHOD"] == "GET" && isset($_GET['deleteallxs'])) {
file_put_contents("js/xs.dat", '[]');
echo '<script>location.href = "min.php"</script>';
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<title>后台中心</title>
<link id="theme-style" rel="stylesheet" href="css/admin.css?0sssaa1">
<link rel="stylesheet" href="css/style.css">
<script src="js/jquery-3.7.1.min.js"></script>
<style>
@media screen and (min-width:320px) and (max-width:750px){
.container{width:100%;padding:10px}
.dibu{display:none;}
}
</style>
</head>
<body>
<div class="container">
<div class="top">
<h1 id="title-h1"><?php echo $title ?></h1>
<input value="<?php echo $title ?>" id="title-input" type="text" placeholder="输入标题~">
</div>
<table>
<tr>
<th>
<!-- <input type="checkbox"> -->
</th>
<th>状态</th>
<th>号码</th>
<th>链接</th>
<th>点击数</th>
<th>显示数</th>
<th>显示总数</th>
<th>操作</th>
</tr>
</table>
<ul>
<li class="add">
<form method="get">
<div class="select">
<input class="checkboxall" type="checkbox">
</div>
<div class="status">
<span>在线状态</span>
</div>
<div class="wx">
<input name="wx" type="text" placeholder="号码">
</div>
<div class="link">
<input name="link" type="text" placeholder="链接">
</div>
<div class="click">0</div>
<div class="show">0</div>
<div class="totalshow">0</div>
<div class="tools">
<input name="add" type="text" style="display: none;">
<button type="submit">添加</button>
<span class="addexit">取消</span>
</div>
</form>
</li>
<?php
$ONLINE = '在线状态';
$OFFLINE = '离线状态';
foreach ($data as $item) {
$lineclass = '';
$status = '';
if ($item->status === 1) {
$status = '在线状态';
$lineclass = 'online';
echo '
<li class="item">
<form method="get">
<div class="select">
<input class="checkboxitem" type="checkbox" data-custom-attribute="' . $item->id . '">
</div>
<div class="status">
<a href="min.php?statusid=' . $item->id . '&status=' . $item->status . '" class="' . $lineclass . '">' . $status . '</a>
</div>
<div class="wx">
<p>' . $item->wx . '</p>
<input name="wx" type="text" value="' . $item->wx . '">
</div>
<div class="link">
<p>' . $item->link . '</p>
<input name="link" type="text" value="' . $item->link . '">
</div>
<div class="click">
<p>' . $item->click . '</p>
<input name="click" type="text" value="' . $item->click . '">
</div>
<div class="show">
<p>' . $item->show . '</p>
<input name="show" type="text" value="' . $item->show . '">
</div>
<div class="totalshow">
<p>' . $item->totalshow . '</p>
<input name="totalshow" type="text" value="' . $item->totalshow . '">
</div>
<input name="editid" value="' . $item->id . '" type="" style="display: none;">
<div class="tools">
<span class="edit">编辑</span>
<button type="submit" class="editsubmit">提交</button>
<a href="min.php?deleteid=' . $item->id . '" class="delete">删除</a>
<span class="exit">取消</span>
</div>
</form>
</li>
';
}
else {
$status = '离线状态';
$lineclass = 'offline';
}}
foreach ($data as $item) {
$lineclass = '';
$status = '';
if ($item->status === 1) {
$status = '在线状态';
$lineclass = 'online';
}
else {
$status = '离线状态';
$lineclass = 'offline';
echo '
<li class="item">
<form method="get">
<div class="select">
<input class="checkboxitem" type="checkbox" data-custom-attribute="' . $item->id . '">
</div>
<div class="status">
<a href="min.php?statusid=' . $item->id . '&status=' . $item->status . '" class="' . $lineclass . '">' . $status . '</a>
</div>
<div class="wx">
<p>' . $item->wx . '</p>
<input name="wx" type="text" value="' . $item->wx . '">
</div>
<div class="link">
<p>' . $item->link . '</p>
<input name="link" type="text" value="' . $item->link . '">
</div>
<div class="click">
<p>' . $item->click . '</p>
<input name="click" type="text" value="' . $item->click . '">
</div>
<div class="show">
<p>' . $item->show . '</p>
<input name="show" type="text" value="' . $item->show . '">
</div>
<div class="totalshow">
<p>' . $item->totalshow . '</p>
<input name="totalshow" type="text" value="' . $item->totalshow . '">
</div>
<input name="editid" value="' . $item->id . '" type="" style="display: none;">
<div class="tools">
<span class="edit">编辑</span>
<button type="submit" class="editsubmit">提交</button>
<a href="min.php?deleteid=' . $item->id . '" class="delete">删除</a>
<span class="exit">取消</span>
</div>
</form>
</li>
';
}}
?>
</ul>
<footer>
<a href="min.php?deletebatch=1">批量删除</a>
<a href="min.php?clear=1" class="click">全部清零</a>
<a href="min.php?deleteall=1">删除所有号</a>
<a href="min.php?deleteallxs=1">清空像素</a>
</footer>
<div class="xs">
<div class="xs-title">CV--id管理</div>
<div class="items">
<?php
foreach ($xsData as $item) {
echo '
<div class="item">
<p id="xs-p">'. $item .'</p>
<input value="'. $item .'" id="xs-input" type="text">
<a href="min.php?delxs='. $item .'"><img id="item-img" class="close" src="https://pub-f583734e30a24b91be172f3c00a2b5a1.r2.dev/close.png"></a>
</div>
';
}
?>
<div id="itemadd" class="item itemadd">
<p id="xsadd-p">+</p>
<input id="xsadd-input" type="text">
<img id="xsadd-img" class="close" src="https://pub-f583734e30a24b91be172f3c00a2b5a1.r2.dev/close.png">
</div>
</div>
</div>
<br>
<div class="top">
<h1 id="shym-h1"> 审核页面:<?php echo $shym ?></h1>
<input value="<?php echo $shym ?>" id="shym-input" type="text" placeholder="输入标题~" style="display:none;height:50px;width:60%">
</div>
<br>
<div class="top">
<h1 id="tgym-h1"> 推广页面:<?php echo $tgym ?></h1>
<input value="<?php echo $tgym ?>" id="tgym-input" type="text" placeholder="输入标题~" style="display:none;height:50px;width:60%">
</div>
<br>
<p style="text-align:center;font-size:20px">(<font style="color:red;font-weight:700">做好的页面一定要检查?ldtag_cl 审核链接和推广链接一样就是审核状态</font>)</p>
</div>
<br> <br> <br> <br> <br> <br> <br>
<script >
$(function () {
// 在页面加载时应用已保存的主题选择
let savedTheme = getSavedThemePreference();
if (savedTheme) {
switchTheme(savedTheme);
}
// // 获取主题选择
function getSavedThemePreference() {
return localStorage.getItem('theme');
}
// 切换主题
$('#day').click(function () {
switchTheme('admin');
saveThemePreference('admin');
})
$('#night').click(function () {
switchTheme('admin2');
saveThemePreference('admin2');
})
// // 切换主题
function switchTheme(themeName) {
$('#theme-style').attr('href', 'css/' + themeName + '.css');
}
// // 存储主题选择
function saveThemePreference(themeName) {
localStorage.setItem('theme', themeName);
}
// 点击标题切换input修改标题
$('#title-h1').click(function () {
$(this).hide()
$('#title-input').show().focus().select()
})
$('#title-input').blur(function () {
handleForm(); // 处理表单提交逻辑
})
function handleForm() {
// 这里可以添加处理表单提交的逻辑
let title = $('#title-input').val()
if (title) {
$.ajax({
type: 'POST',
url: 'title.php',
data: { title: title },
success: function (response) {
},
error: function (error) {
}
});
$('#title-input').hide()
$('#title-h1').show()
setTimeout(function () {
location.href = "min.php";
}, 10);
} else {
alert('请输入标题')
}
}
// 点击标题切换input修改标题
$('#shym-h1').click(function () {
$(this).hide()
$('#shym-input').show().focus().select()
})
$('#shym-input').blur(function () {
handleForm2(); // 处理表单提交逻辑
})
function handleForm2() {
// 这里可以添加处理表单提交的逻辑
let shym = $('#shym-input').val()
if (shym) {
$.ajax({
type: 'POST',
url: 'shym.php',
data: { shym: shym },
success: function (response) {
},
error: function (error) {
}
});
$('#shym-input').hide()
$('#shym-h1').show()
setTimeout(function () {
location.href = "min.php";
}, 10);
} else {
alert('请输审核网址')
}
}
// 点击标题切换input修改标题
$('#tgym-h1').click(function () {
$(this).hide()
$('#tgym-input').show().focus().select()
})
$('#tgym-input').blur(function () {
handleForm3(); // 处理表单提交逻辑
})
function handleForm3() {
// 这里可以添加处理表单提交的逻辑
let tgym = $('#tgym-input').val()
if (tgym) {
$.ajax({
type: 'POST',
url: 'tgym.php',
data: { tgym: tgym },
success: function (response) {
},
error: function (error) {
}
});
$('#tgym-input').hide()
$('#tgym-h1').show()
setTimeout(function () {
location.href = "min.php";
}, 10);
} else {
alert('请输入推广')
}
}
// 点击.wx时显示内部的input标签
$('.add .wx').click(function () {
$(this).find('input').show().focus(); // 切换显示和隐藏状态
});
// 点击.link时显示内部的input标签
$('.add .link').click(function () {
$(this).find('input').show().focus(); // 切换显示和隐藏状态
});
$('.add .wx, .add .link').click(function () {
$('.addexit').show()
})
$('.addexit').click(function () {
$('.add .wx input, .add .link input').hide().val('')
$('.addexit').hide()
})
// 编辑按钮点击事件
$('.edit').click(function () {
let listItem = $(this).closest('.item');
listItem.find('p').hide();
listItem.find('input[type="text"]').show();
listItem.find('.edit').hide();
listItem.find('.editsubmit').show();
listItem.find('.exit').show();
listItem.find('.delete').hide();
});
// 提交按钮点击事件
$('.editsubmit').click(function () {
let listItem = $(this).closest('.item');
listItem.find('p').show();
listItem.find('input[type="text"]').hide();
listItem.find('.edit').show();
listItem.find('.exit').hide();
listItem.find('.delete').show();
listItem.find('.editsubmit').hide();
});
// 取消按钮点击事件
$('.exit').click(function () {
let listItem = $(this).closest('.item');
listItem.find('p').show();
listItem.find('input[type="text"]').hide();
listItem.find('.edit').show();
listItem.find('.exit').hide();
listItem.find('.delete').show();
listItem.find('.editsubmit').hide();
});
// 全部勾选
$('.checkboxall').click(function () {
let isChecked = $(this).prop('checked');
if (isChecked) {
$('.checkboxitem').prop('checked', true);
$.ajax({
type: 'POST',
url: 'checkedall.php',
data: { select: 1 },
success: function (response) {
},
error: function (error) {
}
});
} else {
$('.checkboxitem').prop('checked', false);
$.ajax({
type: 'POST',
url: 'checkedall.php',
data: { select: 0 },
success: function (response) {
},
error: function (error) {
}
});
}
})
// item勾选事件
$('.checkboxitem').click(function () {
let isChecked = $(this).prop('checked');
let id = $(this).data('custom-attribute');
if (isChecked) {
$.ajax({
type: 'POST',
url: 'checked.php',
data: { select: 1, id: id },
success: function (response) {
},
error: function (error) {
}
});
} else {
$.ajax({
type: 'POST',
url: 'checked.php',
data: { select: 0, id: id },
success: function (response) {
},
error: function (error) {
}
});
}
})
// item关闭修改
$(document).on('click', '#item-img', function () {
$(this).siblings('#xs-p').show()
$(this).siblings('#xs-input').hide()
})
// 修改像素
// 保存修改前的像素
var oldxs = 0;
$('.item #xs-p').click(function () {
oldxs = $(this).text()
$(this).hide()
$(this).siblings('#xs-input').show().focus().select();
})
$('.item #xs-input').blur(function () {
editxs($(this))
});
function editxs(element) {
let newxs = element.val()
$.ajax({
type: 'POST',
url: 'editxs.php',
data: { oldxs: oldxs, newxs: newxs },
success: function (response) {
},
error: function (error) {
}
});
element.hide()
element.siblings('#xs-p').show()
setTimeout(function () {
location.href = "min.php";
}, 10);
}
// 添加像素事件
var flag = true
$('#itemadd').click(function () {
flag = true
$('#xsadd-p').hide()
$('#xsadd-input').show().focus()
$('#xsadd-img').show()
})
// 取消添加(打叉按钮)
$(document).on('click', '#xsadd-img', function () {
flag = false
$('#itemadd #xsadd-input').val('')
$(this).hide()
$('#xsadd-p').show()
$('#xsadd-input').hide()
})
$('#xsadd-input').blur(function () {
let xsaddInput = $(this)
setTimeout(function() {
if (flag) {
addxs(xsaddInput);
}
}, 100)
});
function addxs(element) {
let xs = element.val()
if (xs) {
$.ajax({
type: 'POST',
url: 'addxs.php',
data: { xs: xs },
success: function (response) {
},
error: function (error) {
}
});
element.hide()
element.siblings('#xsadd-img').hide()
element.siblings('#xsadd-p').show()
setTimeout(function () {
location.href = "min.php";
}, 10);
} else {
element.hide()
element.siblings('#xsadd-img').hide()
element.siblings('#xsadd-p').show()
}
}
})
</script>
</body>
</html>