优化操作体验,增加自定义颜色

This commit is contained in:
六零 2022-12-02 01:10:35 +08:00
parent e5cdb50e0e
commit e85959919b
7 changed files with 312 additions and 156 deletions

54
admin/ajax_apply.php Normal file
View File

@ -0,0 +1,54 @@
<?php
include_once("../include/common.php");
if(isset($islogin)==1) {
} else exit("<script language='javascript'>window.location.href='./login.php';</script>");
header('Content-Type:application/json');
$set= isset($_GET['set']) ? $_GET['set'] : null;
switch($set) {
//修改分组
case 'status':
$id = $_POST['id'];
$sw = $_POST['status'];
$sql = "UPDATE `lylme_apply` SET `apply_status` = '".$sw."' WHERE `lylme_apply`.`apply_id` = ".$id.";";
if($sw==1) {
if ($DB->query($sql)) {
$applyres = $DB->get_row("SELECT * FROM `lylme_apply` WHERE `apply_id` = ".$id);
$name=strip_tags(daddslashes($applyres['apply_name']));
$url=strip_tags(daddslashes($applyres['apply_url']));
$icon=daddslashes($applyres['apply_icon']);
$group_id=strip_tags(daddslashes($applyres['apply_group']));
$mail=strip_tags(daddslashes($applyres['apply_mail']));
$link_order = $DB->count('select MAX(id) from `lylme_links`')+1;
$sql1 = "INSERT INTO `lylme_links` (`id`, `name`, `group_id`, `url`, `icon`, `PS`,`link_order`) VALUES (NULL, '" . $name . "', '" . $group_id . "', '" . $url . "', '" . $icon . "', '" . $mail . "的提交 ', '" . $link_order . "');";
if($DB->query($sql1)) {
exit('{"code": "200","msg":"成功!网站已成功收录!"}');
} else {
exit('{"code": "-1","操作失败!原因:\n'.$DB->error().'"}');
}
}
} else if($sw==2){
if ($DB->query($sql)) {
exit('{"code": "200","msg":"操作成功!"}');
}
else{
exit('{"code": "-1","操作失败!原因:\n'.$DB->error().'"}');
}
}
else{
exit('{"code": "-2","操作失败!-2"}');
}
break;
case 'delete':
$id = $_POST['id'];
$delsql = 'DELETE FROM `lylme_apply` WHERE apply_id =' . $id;
if ($DB->query($delsql)) {
exit('{"code": "200","msg":"操作成功!"}');
}else{
exit('{"code": "-2","操作失败!-2"}');
}
break;
default:
exit('error');
break;
}

View File

@ -50,33 +50,12 @@ switch($submit) {
//获取链接信息
case 'geturl':
function get_head($url) {
ini_set("user_agent","Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/101.0.4951.54 Safari/537.36 Edg/101.0.1210.39 Lylme/11.24");
$opts = array(
'http'=>array(
'method'=>"GET",
'timeout'=>4
)
);
$contents = @file_get_contents("compress.zlib://".$url, false, stream_context_create($opts));
preg_match('/<title>(.*?)<\/title>/is',$contents,$title); // 获取网站标题
preg_match('/<link rel=".*?icon" * href="(.*?)".*?>/is', $contents,$icon); // 获取网站icon
preg_match('/<meta.+?charset=[^\w]?([-\w]+)/i', $contents,$charset); //获取网站编码
$get_heads = array();
$get_heads['charset']=$charset[1];
$get_heads['title'] = str_replace("'","\"",preg_replace("/\s/","",$title[1]));
$get_heads['icon'] = get_urlpath(preg_replace("/\s/","",$icon[1]),$url);
if(strtolower($get_heads['charset'])!="uft-8"){
// 将非UTF-8编码转换
$get_heads['title'] = iconv($get_heads['charset'], "UTF-8",$get_heads['title']);
$get_heads['icon'] = iconv($get_heads['charset'], "UTF-8",$get_heads['icon']);
}
return $get_heads;
}
$head = get_head($_POST['url']);
if(empty($head['title'])&&empty($head['icon']))exit('Unable to access');
header('Content-Type:application/json');
exit('{"title": "'.$head['title'].'", "icon": "'.$head['icon'].'","charset": "'.$head['charset'].'"}');
$url = $_GET['url'];
$head = get_head($url);
if(empty($head['title'])&&empty($head['icon']))exit('Unable to access');
//download_img($url,head['icon']);
header('Content-Type:application/json');
exit(json_encode($head,JSON_UNESCAPED_SLASHES|JSON_UNESCAPED_UNICODE)); //输出json
break;
//检测更新
case 'update':

View File

@ -113,43 +113,8 @@ elseif ($set == 'edit_submit') {
$sql = "UPDATE `lylme_apply` SET `apply_name` = '" . $name . "', `apply_group` = '" . $group . "',`apply_icon` = '" . $icon . "',`apply_url` = '" . $url . "' WHERE `lylme_apply`.`apply_id` = '" . $id . "';";
if ($DB->query($sql)) echo '<script>alert("修改 ' . $name . ' 成功!");window.location.href="./apply.php";</script>'; else echo '<script>alert("' . $sql . '修改失败!原因:\n'.$DB->error().'");history.go(-1);</script>';
}
} elseif ($set == 'delete') {
$id = $_GET['id'];
$delsql = 'DELETE FROM `lylme_apply` WHERE apply_id =' . $id;
if ($DB->query($delsql)) echo '<script>alert("删除成功!");window.location.href="./apply.php";</script>'; else echo '<script>alert("删除失败!");history.go(-1);</script>';
}
elseif ($set == 'status') {
$id = $_GET['id'];
$sw = $_GET['sw'];
$sql = "UPDATE `lylme_apply` SET `apply_status` = '".$sw."' WHERE `lylme_apply`.`apply_id` = ".$id.";";
if($sw==1) {
if ($DB->query($sql)) {
$applyres = $DB->get_row("SELECT * FROM `lylme_apply` WHERE `apply_id` = ".$id);
$name=strip_tags(daddslashes($applyres['apply_name']));
$url=strip_tags(daddslashes($applyres['apply_url']));
$icon=daddslashes($applyres['apply_icon']);
$group_id=strip_tags(daddslashes($applyres['apply_group']));
$mail=strip_tags(daddslashes($applyres['apply_mail']));
$link_order = $DB->count('select MAX(id) from `lylme_links`')+1;
$sql1 = "INSERT INTO `lylme_links` (`id`, `name`, `group_id`, `url`, `icon`, `PS`,`link_order`) VALUES (NULL, '" . $name . "', '" . $group_id . "', '" . $url . "', '" . $icon . "', '" . $mail . "的提交 ', '" . $link_order . "');";
if($DB->query($sql1)) {
echo '<script>alert("成功!网站已成功收录!");window.location.href="./apply.php";</script>';
} else {
echo '<script>alert("收录失败!错误原因:\n'.$DB->error().'");history.go(-1);</script>';
}
}
} else if($sw==2){
if ($DB->query($sql)) {
echo '<script>window.location.href="./apply.php";</script>';
}
else{
echo '<script>alert("审核失败!原因:\n'.$DB->error().'");history.go(-1);</script>';
}
}
else{
echo '<script>alert("审核失败!未知参数");history.go(-1);</script>';
}
} else {
else {
echo '<pre>'.$conf['apply_gg'].'<br><a href="./apply.php?set=conf">修改</a></pre>';
echo '<div class="alert alert-info">
收录申请统计: <b>' . $applyrows . '</b> <br/>
@ -170,7 +135,7 @@ elseif ($set == 'status') {
申请收录地址:<code>'. siteurl().'/apply</code> <a href="'. siteurl().'/apply" target="_blank">访问</a><br><br><sub>已审核的图标会被隐藏,点击图标可重新加载<br>部分网站图标一直处于加载或无法显示,可能原因:无法访问或跨域问题,建议建将图标本地化</sub></div>';
?>
<div class="table-responsive">
<div class="table-responsive" id="applylist">
<table class="table table-striped">
<thead><tr><th>序号</th><th>图标</th><th>名称</th><th>链接</th><th>访问</th><th>分组</th><th>审核</th><th>操作</th><th>申请时间</th></tr></thead>
<tbody>
@ -206,12 +171,12 @@ elseif ($set == 'status') {
echo '<font color="#3c763d">已通过</font>';
} else {
echo '
<a href="./apply.php?set=status&id=' . $res['apply_id'] . '&sw=1" class="btn btn-primary btn-xs" onclick="return confirm(\'是否通过该条申请?\');">通过</a>&nbsp;
<a href="./apply.php?set=status&id=' . $res['apply_id'] . '&sw=2" class="btn btn-cyan btn-xs" onclick="return confirm(\'是否拒绝该条申请 \');">拒绝</a>';
<button class="btn btn-primary btn-xs" onclick="status(' . $res['apply_id'] . ',1)">通过</button>&nbsp;
<button class="btn btn-cyan btn-xs" onclick="status(' . $res['apply_id'] . ',2)">拒绝</a>';
}
echo '</td><td>';
if($res["apply_status"]==0) {echo '<a href="./apply.php?set=edit&id=' . $res['apply_id'] . '" class="btn btn-info btn-xs">编辑</a>&nbsp;';}
echo '<a href="./apply.php?set=delete&id=' . $res['apply_id'] . '" class="btn btn-xs btn-danger" onclick="return confirm(\'确定删除 ' . $res['apply_name'] . ' 的记录吗?\');">删除</a> </td>
echo ' <button class="btn btn-xs btn-danger" onclick="deletes(' . $res['apply_id'] . ')">删除</button> </td>
<td>'.$res['apply_time'].'</td>
</tr>';
}
@ -230,7 +195,59 @@ elseif ($set == 'status') {
include './footer.php';
?>
<script src="https://lf26-cdn-tos.bytecdntp.com/cdn/expire-1-M/jquery.lazyload/1.9.1/jquery.lazyload.min.js" type="application/javascript"></script>
<script src="https://lf3-cdn-tos.bytecdntp.com/cdn/expire-1-M/layer/3.1.1/layer.min.js" type="application/javascript"></script>
<script>
function status(id,status){
$.ajax({
url:"ajax_apply.php?set=status",
type:"POST",
dataType:"json",
data:{id:id,status:status},
success:function(data){
if(data.code == '200'){
layer.msg(data.msg);
$("#applylist").load(location.href+" #applylist>*","");
return true;
}
else{
layer.msg(data.msg);
return false;
}
},
error:function(data){
layer.msg('服务器错误');
return false;
}
});
}
function deletes(id){
if(!confirm("确定删除?")){
return false;
}
$.ajax({
url:"ajax_apply.php?set=delete",
type:"POST",
dataType:"json",
data:{id:id},
success:function(data){
if(data.code == '200'){
layer.msg(data.msg);
$("#applylist").load(location.href+" #applylist>*","");
return true;
}
else{
layer.msg(data.msg);
return false;
}
},
error:function(data){
layer.msg('服务器错误');
return false;
}
});
}
$("img.lazy").lazyload({
threshold : 100
});

1
admin/css/coloris.min.css vendored Normal file
View File

@ -0,0 +1 @@
.clr-picker{display:none;flex-wrap:wrap;position:absolute;width:200px;z-index:1000;border-radius:10px;background-color:#fff;justify-content:space-between;box-shadow:0 0 5px rgba(0,0,0,.05),0 5px 20px rgba(0,0,0,.1);-moz-user-select:none;-webkit-user-select:none;user-select:none}.clr-picker.clr-open{display:flex}.clr-dark{background-color:#444}.clr-gradient{position:relative;width:100%;height:100px;margin-bottom:15px;border-radius:3px 3px 0 0;background-image:linear-gradient(rgba(0,0,0,0),#000),linear-gradient(90deg,#fff,currentColor);cursor:pointer}.clr-marker{position:absolute;width:12px;height:12px;margin:-6px 0 0 -6px;border:1px solid #fff;border-radius:50%;background-color:currentColor;cursor:pointer}.clr-picker input[type=range]::-webkit-slider-runnable-track{width:100%;height:8px}.clr-picker input[type=range]::-webkit-slider-thumb{width:8px;height:8px;-webkit-appearance:none}.clr-picker input[type=range]::-moz-range-track{width:100%;height:8px;border:0}.clr-picker input[type=range]::-moz-range-thumb{width:8px;height:8px;border:0}.clr-hue{background-image:linear-gradient(to right,red 0,#ff0 16.66%,#0f0 33.33%,#0ff 50%,#00f 66.66%,#f0f 83.33%,red 100%)}.clr-alpha,.clr-hue{position:relative;width:calc(100% - 40px);height:8px;margin:5px 20px;border-radius:4px}.clr-alpha span{display:block;height:100%;width:100%;border-radius:inherit;background-image:linear-gradient(90deg,rgba(0,0,0,0),currentColor)}.clr-alpha input,.clr-hue input{position:absolute;width:calc(100% + 16px);height:16px;left:-8px;top:-4px;margin:0;background-color:transparent;opacity:0;cursor:pointer;appearance:none;-webkit-appearance:none}.clr-alpha div,.clr-hue div{position:absolute;width:16px;height:16px;left:0;top:0;margin:-4px 0 0 -8px;border:2px solid #fff;border-radius:50%;background-color:currentColor;box-shadow:0 0 1px #888;pointer-events:none}.clr-alpha div:before{content:'';position:absolute;height:100%;width:100%;left:0;top:0;border-radius:50%;background-color:currentColor}.clr-swatches{order:2;width:calc(100% - 40px);margin:0 20px}.clr-swatches div{display:flex;flex-wrap:wrap;padding-bottom:12px;justify-content:center}.clr-swatches button{position:relative;width:20px;height:20px;margin:0 8px 6px 0;border:0;border-radius:50%;color:inherit;text-indent:-1000px;white-space:nowrap;overflow:hidden;cursor:pointer}.clr-swatches button:last-child,.clr-swatches button:nth-child(6n){margin-right:0}.clr-swatches button:after{content:'';display:block;position:absolute;width:100%;height:100%;left:0;top:0;border-radius:inherit;background-color:currentColor;box-shadow:inset 0 0 0 1px rgba(0,0,0,.1)}.clr-dark .clr-swatches button:after{box-shadow:inset 0 0 0 1px rgba(255,255,255,.3)}input.clr-color{order:1;width:120px;height:32px;margin:15px 20px 15px 0;padding:0 15px;border:1px solid #ddd;border-radius:16px;color:#444;background-color:#fff;font-family:sans-serif;font-size:14px;text-align:left;box-shadow:none}.clr-dark input.clr-color{color:#fff;border-color:#777;background-color:#555}input.clr-color:focus{outline:0;border:1px solid #aaa}.clr-preview{position:relative;width:32px;height:32px;margin:15px 0 20px 20px;border:0;border-radius:50%;overflow:hidden;cursor:pointer}.clr-preview:after,.clr-preview:before{content:'';position:absolute;height:100%;width:100%;left:0;top:0;border:1px solid #fff;border-radius:50%}.clr-preview:after{border:0;background-color:currentColor;box-shadow:inset 0 0 0 1px rgba(0,0,0,.1)}.clr-dark .clr-preview:after{box-shadow:inset 0 0 0 1px rgba(255,255,255,.5)}.clr-alpha div,.clr-color,.clr-hue div,.clr-marker{box-sizing:border-box}.clr-field{display:inline-block;position:relative;color:#000}.clr-field button{position:absolute;width:30px;height:100%;right:0;top:50%;transform:translateY(-50%);border:0;color:inherit;text-indent:-1000px;white-space:nowrap;overflow:hidden;pointer-events:none}.clr-field button:after{content:'';display:block;position:absolute;width:100%;height:100%;left:0;top:0;border-radius:inherit;background-color:currentColor;box-shadow:inset 0 0 1px rgba(0,0,0,.5)}.clr-alpha,.clr-alpha div,.clr-field button,.clr-preview:before,.clr-swatches button{background-image:repeating-linear-gradient(45deg,#aaa 25%,transparent 25%,transparent 75%,#aaa 75%,#aaa),repeating-linear-gradient(45deg,#aaa 25%,#fff 25%,#fff 75%,#aaa 75%,#aaa);background-position:0 0,4px 4px;background-size:8px 8px}.clr-marker:focus{outline:0}.clr-keyboard-nav .clr-alpha input:focus+div,.clr-keyboard-nav .clr-hue input:focus+div,.clr-keyboard-nav .clr-marker:focus{outline:0;box-shadow:0 0 0 2px #1e90ff,0 0 2px 2px #fff}

6
admin/js/coloris.min.js vendored Normal file

File diff suppressed because one or more lines are too long

View File

@ -100,34 +100,91 @@ function geturl(){
layer.msg('链接地址不能为空');
return false;
}
lightyear.loading("show");
$('#loading').css("display","flex");
if (!/^http[s]?:\/\/+/.test(url)&&url!="") {
var url = "http://"+url;
$("input[name=\'url\']").val(url);
}
$.ajax({
url:"ajax_link.php?submit=geturl",
type:"post",
type:"GET",
dataType:"json",
data:{url:url},
success:function(data){
lightyear.loading("hide");
var head = eval(data);
$("input[name=\'name\']").val(head.title);
if(!head.icon){
$("input[name=\'name\']").val(data.title);
if(!data.title && !data.icon){
layer.msg('获取失败,请手动填写');
}
else if(!data.icon){
layer.msg('未获取到网站图标');
}
$("textarea[name=\'icon\']").val(head.icon);
layer.msg('正则抓取目标网站图标...');
downloadimg(data.icon,url);
$('#loading').css("display","none");
return true;
},
error:function(data){
lightyear.loading('hide');
layer.msg('获取失败,网站无法访问或防火墙限制!');
layer.msg('获取失败,目标网站无法访问或防火墙限制!');
$('#loading').css("display","none");
return false;
}
});
}
}
//抓取网站图标
function downloadimg(url,referer){
$.ajax({
url:"/include/file.php",
type:"POST",
dataType:"json",
data:{url:url,referer:referer},
success:function(data){
if(data.code == '200'){
layer.msg(data.msg);
$("textarea[name=\'icon\']").val(data.url);
return true;
}
else{
layer.msg(data.msg);
return false;
}
},
error:function(data){
layer.msg('服务器错误');
return false;
}
});
}
//上传图标
function uploadimg(e) {
var formData = new FormData();
formData.append("file", $("#file")[0].files[0]);
$.ajax({
method: 'POST',
url: '/include/file.php',
data: formData,
timeout: 20000,
cache: false,
processData: false,
contentType: false,
dataType:"JSON",
success:function(data){
if(data.code == '200'){
layer.msg(data.msg);
$("textarea[name=\'icon\']").val(data.url);
return true;
}
else{
layer.msg(data.msg);
return false;
}
},
error:function(data){
layer.msg('服务器错误');
return false;
}
});
}
//多选删除
function del_link(id){
var link_id = [];

View File

@ -5,9 +5,7 @@ $grouplists = $DB->query("SELECT * FROM `lylme_groups`");
$pwd_lists = $DB->query("SELECT * FROM `lylme_pwd`");
?>
<main class="lyear-layout-content">
<div class="container-fluid">
<div class="row">
<div class="col-lg-12">
<div class="card">
@ -15,7 +13,7 @@ $pwd_lists = $DB->query("SELECT * FROM `lylme_pwd`");
<?php
$set = isset($_GET['set']) ? $_GET['set'] : null;
if ($set == 'add') {
echo '<h4>新增链接</h4>
echo '<h4>新增链接</h4>
<div class="panel-body">
<form action="./link.php?set=add_submit" method="POST">
<div class="form-group">
@ -26,38 +24,46 @@ if ($set == 'add') {
<button class="btn btn-default" onclick="geturl()" type="button">获取</button>
</span>
</div></div>
<div class="form-group">
<label>*网站名称:</label><br>
<input type="text" class="form-control" placeholder="网站名称" name="name" value="" required>
<input type="text" class="coloris form-control" onchange="select_color()" placeholder="链接颜色" name="color" value="" />
</div>
<div class="form-group">
<div class="input-group">
<label>链接图标:</label><br>
<textarea type="text" class="form-control" name="icon" placeholder="网站图标"></textarea>
<small class="help-block">方式1填写图标的<code>URL</code>地址,如<code>/img/logo.png</code><code>http://www.xxx.com/img/logo.png</code><br>
方式2粘贴图标的<code>SVG</code>代码,<a href="./help.php?doc=icon" target="_blank">查看教程</a><br>方式3留空使用默认图标</small>
<span class="input-group-btn">
<input type="file" id="file" onchange="uploadimg()" accept="image/png, image/jpeg,image/gif,image/x-icon" style="display: none" />
<button class="btn btn-default" id="uploadImage" onclick="$(&quot;#file&quot;).click();" type="button">选择</button>
</span>
</div>
<small class="help-block"><b>可选方案:</b><br>1. 填写图标的<code>URL</code>地址,如<code>/img/logo.png</code><code>http://www.xxx.com/img/logo.png</code><br>
2. 粘贴图标的<code>SVG</code>代码,<a href="./help.php?doc=icon" target="_blank">查看教程</a><br>3. 留空使用默认图标<br>4. 从本地上传</small>
</div>
<div class="form-group">
<label>*分组:</label><br>
<select class="form-control" name="group_id">';
while ($grouplist = $DB->fetch($grouplists)) {
if ($grouplist["group_id"] == $row['group_id']) {
$select = 'selected="selected"';
} else {
$select = '';
}
echo '<option value="' . $grouplist["group_id"] . '">' . $grouplist["group_id"] . ' - ' . $grouplist["group_name"] . '</option>';
}
echo '</select></div>
while ($grouplist = $DB->fetch($grouplists)) {
if ($grouplist["group_id"] == $row['group_id']) {
$select = 'selected="selected"';
} else {
$select = '';
}
echo '<option value="' . $grouplist["group_id"] . '">' . $grouplist["group_id"] . ' - ' . $grouplist["group_name"] . '</option>';
}
echo '</select></div>
<div class="form-group">
<input type="submit" class="btn btn-primary btn-block" value="添加"></form>
</div>
<br/><a href="./link.php"><<返回</a>
</div></div>';
} elseif ($set == 'edit') {
$id = $_GET['id'];
$row2 = $DB->query("select * from lylme_links where id='$id' limit 1");
$row = $DB->fetch($row2);
echo '<h4>修改链接信息</h4>
$id = $_GET['id'];
$row2 = $DB->query("select * from lylme_links where id='$id' limit 1");
$row = $DB->fetch($row2);
preg_match_all('/<font color=[\"|\']+(.*?)[\"|\']>/i',$row['name'],$color);
echo '<h4>修改链接信息</h4>
<div class="panel-body">
<form action="./link.php?set=edit_submit&id=' . $id . '" method="POST">
<div class="form-group">
@ -70,38 +76,47 @@ if ($set == 'add') {
</div></div>
<div class="form-group">
<label>*网站名称:</label><br>
<input type="text" class="form-control" name="name" value="' . $row['name'] . '" required>
<input type="text" class="form-control" name="name" id="urlname" value="' . strip_tags($row['name']) . '" required>
<input type="text" class="coloris form-control" onchange="select_color()" placeholder="留空默认" name="color" value="'.$color[1][0].'" />
</div>
<div class="form-group">
<div class="input-group">
<label>链接图标:</label><br>
<textarea type="text" class="form-control" name="icon" >' . $row['icon'] . '</textarea>
<small class="help-block">方式1填写图标的<code>URL</code>地址,如<code>/img/logo.png</code><code>http://www.xxx.com/img/logo.png</code><br>
方式2粘贴图标的<code>SVG</code>代码,<a href="./help.php?doc=icon" target="_blank">查看教程</a><br>方式3留空使用默认图标</small>
<span class="input-group-btn">
<input type="file" id="file" onchange="uploadimg()" accept="image/png, image/jpeg,image/gif,image/x-icon" style="display: none" />
<button class="btn btn-default" id="uploadImage" onclick="$(&quot;#file&quot;).click();" type="button">选择</button>
</span>
</div>
<small class="help-block"><b>可选方案:</b><br>1. 填写图标的<code>URL</code>地址,如<code>/img/logo.png</code><code>http://www.xxx.com/img/logo.png</code><br>
2. 粘贴图标的<code>SVG</code>代码,<a href="./help.php?doc=icon" target="_blank">查看教程</a><br>2. 留空使用默认图标<br>4. 从本地上传</small>
</div>
<div class="form-group">
<label>*分组:</label><br>
<select class="form-control" name="group_id">';
while ($grouplist = $DB->fetch($grouplists)) {
if ($grouplist["group_id"] == $row['group_id']) {
$select = 'selected="selected"';
} else {
$select = '';
}
echo '<option value="' . $grouplist["group_id"] . '" ' . $select . '>' . $grouplist["group_id"] . ' - ' . $grouplist["group_name"] . '</option>';
}
echo '</select>
while ($grouplist = $DB->fetch($grouplists)) {
if ($grouplist["group_id"] == $row['group_id']) {
$select = 'selected="selected"';
} else {
$select = '';
}
echo '<option value="' . $grouplist["group_id"] . '" ' . $select . '>' . $grouplist["group_id"] . ' - ' . $grouplist["group_name"] . '</option>';
}
echo '</select>
</div>
<div class="form-group">
<label>链接加密:</label><br>
<select class="form-control" required name="link_pwd">';
$pwd_lists = $DB->query("SELECT * FROM `lylme_pwd`");
while ($pwd_list = $DB->fetch($pwd_lists)) {
if($row['link_pwd']==$pwd_list["pwd_id"]){$sel = 'selected="selected"';}else{ $sel ='';}
echo '<option value="' . $pwd_list["pwd_id"] . '" '.$sel.' >' . $pwd_list["pwd_id"] . ' - ' . $pwd_list["pwd_name"] . ' | 密码['. $pwd_list["pwd_key"].']</option>';
}
if(empty($row['link_pwd'])) $sele = 'selected="selected"';
echo '
$pwd_lists = $DB->query("SELECT * FROM `lylme_pwd`");
while ($pwd_list = $DB->fetch($pwd_lists)) {
if($row['link_pwd']==$pwd_list["pwd_id"]) {
$sel = 'selected="selected"';
} else {
$sel ='';
}
echo '<option value="' . $pwd_list["pwd_id"] . '" '.$sel.' >' . $pwd_list["pwd_id"] . ' - ' . $pwd_list["pwd_name"] . ' | 密码['. $pwd_list["pwd_key"].']</option>';
}
if(empty($row['link_pwd'])) $sele = 'selected="selected"';
echo '
<option value="0" '.$sele.'>0 - 不加密</option></select>
<small class="help-block"><code>注意:对链接所在的分组加密后,单独设置的链接加密将会失效</code><br>
加密后只能通过输入密码访问,使用该功能先配置加密组
@ -111,46 +126,58 @@ echo '
<input type="submit" class="btn btn-primary btn-block" value="修改"></form>
</div>
<br/><a href="./link.php"><<返回</a>
</div></div>';
</div></div>
';
} elseif ($set == 'add_submit') {
$name = $_POST['name'];
$url = $_POST['url'];
$icon = $_POST['icon'];
$group_id = $_POST['group_id'];
$link_order = $linksrows + 1;
if ($name == NULL or $url == NULL) {
echo '<script>alert("保存错误,请确保带星号的都不为空!");history.go(-1);</script>';
} else {
$sql = "INSERT INTO `lylme_links` (`id`, `name`, `group_id`, `url`, `icon`, `PS`,`link_order`) VALUES (NULL, '" . $name . "', '" . $group_id . "', '" . $url . "', '" . $icon . "', '" . $name . "', '" . $link_order . "');";
if ($DB->query($sql)) {
echo '<script>alert("添加链接 ' . $name . ' 成功!");window.location.href="./link.php";</script>';
} else echo '<script>alert("添加链接失败!");history.go(-1);</script>';
}
$color = $_POST['color'];
$name = $_POST['name'];
if(empty($color)) {
$name1 = $name;
} else {
$name1 = '<font color="'.$color.'">'.$name.'</font>';
}
$url = $_POST['url'];
$icon = $_POST['icon'];
$group_id = $_POST['group_id'];
$link_order = $linksrows + 1;
if ($name == NULL or $url == NULL) {
echo '<script>alert("保存错误,请确保带星号的都不为空!");history.go(-1);</script>';
} else {
$sql = "INSERT INTO `lylme_links` (`id`, `name`, `group_id`, `url`, `icon`, `PS`,`link_order`) VALUES (NULL, '" . $name1 . "', '" . $group_id . "', '" . $url . "', '" . $icon . "', '" . $name . "', '" . $link_order . "');";
if ($DB->query($sql)) {
echo '<script>alert("添加链接 ' . $name . ' 成功!");window.location.href="./link.php";</script>';
} else echo '<script>alert("添加链接失败!");history.go(-1);</script>';
}
} elseif ($set == 'edit_submit') {
$id = $_GET['id'];
$rows2 = $DB->query("select * from lylme_links where id='$id' limit 1");
$rows = $DB->fetch($rows2);
if (!$rows) echo '<script>alert("当前记录不存在!");history.go(-1);</script>';
$name = $_POST['name'];
$url = $_POST['url'];
$icon = $_POST['icon'];
$link_pwd = $_POST['link_pwd'];
$group_id = $_POST['group_id'];
if ($name == NULL or $url == NULL) {
echo '<script>alert("保存错误,请确保带星号的都不为空!");history.go(-1);</script>';
} else {
$sql = "UPDATE `lylme_links` SET `name` = '" . $name . "', `url` = '" . $url . "', `icon` = '" . $icon . "', `group_id` = '" . $group_id . "', `link_pwd` = " . $link_pwd . " WHERE `lylme_links`.`id` = '" . $id . "';";
// exit($sql);
if ($DB->query($sql)) echo '<script>alert("修改链接 ' . $name . ' 成功!");window.location.href="./link.php";</script>';
else echo '<script>alert("修改链接失败!");history.go(-1);</script>';
}
// } elseif ($set == 'delete') {
// $id = $_GET['id'];
// $sql = "DELETE FROM lylme_links WHERE id='$id'";
// if ($DB->query($sql)) echo '<script>alert("删除成功!");window.location.href="./link.php";</script>';
// else echo '<script>alert("删除失败!");history.go(-1);</script>';
$id = $_GET['id'];
$rows2 = $DB->query("select * from lylme_links where id='$id' limit 1");
$rows = $DB->fetch($rows2);
if (!$rows) exit('<script>alert("当前记录不存在!");history.go(-1);</script>');
$color = $_POST['color'];
$name = $_POST['name'];
if(empty($color)) {
$name1 = $name;
} else {
$name1 = '<font color="'.$color.'">'.$name.'</font>';
}
$url = $_POST['url'];
$icon = $_POST['icon'];
$link_pwd = $_POST['link_pwd'];
$group_id = $_POST['group_id'];
if ($name == NULL or $url == NULL) {
echo '<script>alert("保存错误,请确保带星号的都不为空!");history.go(-1);</script>';
} else {
$sql = "UPDATE `lylme_links` SET `name` = '" . $name1 . "', `url` = '" . $url . "', `icon` = '" . $icon . "', `group_id` = '" . $group_id . "', `link_pwd` = " . $link_pwd . " WHERE `lylme_links`.`id` = '" . $id . "';";
// exit($sql);
if ($DB->query($sql)) echo '<script>alert("修改链接 ' . $name . ' 成功!");window.location.href="./link.php";</script>'; else echo '<script>alert("修改链接失败!");history.go(-1);</script>';
}
// } elseif ($set == 'delete') {
// $id = $_GET['id'];
// $sql = "DELETE FROM lylme_links WHERE id='$id'";
// if ($DB->query($sql)) echo '<script>alert("删除成功!");window.location.href="./link.php";</script>';
// else echo '<script>alert("删除失败!");history.go(-1);</script>';
} else {
echo '<div id="listTable"></div>
echo '<div id="listTable"></div>
</div>
</div>
</div>
@ -158,7 +185,6 @@ echo '
</div>
</main>
';
}
include './footer.php';
?>
@ -166,6 +192,22 @@ include './footer.php';
<link href="https://lf6-cdn-tos.bytecdntp.com/cdn/expire-1-M/jquery-confirm/3.3.0/jquery-confirm.min.css" type="text/css" rel="stylesheet" />
<script src="https://lf3-cdn-tos.bytecdntp.com/cdn/expire-1-M/layer/3.1.1/layer.min.js" type="application/javascript"></script>
<script src="https://lf9-cdn-tos.bytecdntp.com/cdn/expire-1-M/jquery-confirm/3.3.0/jquery-confirm.min.js" type="application/javascript"></script>
<!--选色器-->
<link rel="stylesheet" type="text/css" href="css/coloris.min.css" />
<script type="text/javascript" src="js/coloris.min.js"></script>
<script type="text/javascript">Coloris( {
el:'.coloris',swatches:['#000000','#555555','#666666','#264653','#2a9d8f','#f4a261','#e76f51','#ff0000','#d62828','#023e8a','#0077b6','#0096c7']
});
</script>
<style>.clr-alpha {display: none !important;}</style>
<script type="text/javascript">
select_color();
function select_color() {
var fontcolor = $('input[name="color"]').val();
$('#urlname').css("color",fontcolor);
}
</script>
<!--选色器-->
<!--消息提示-->
<script src="js/bootstrap-notify.min.js"></script>
<script type="text/javascript" src="js/lightyear.js"></script>