优化 收录页
This commit is contained in:
parent
81042fdbf7
commit
71d4609e2c
225
apply/index.php
225
apply/index.php
|
@ -2,7 +2,7 @@
|
||||||
include("../include/common.php");
|
include("../include/common.php");
|
||||||
if(!empty($url = isset($_GET['url']) ? $_GET['url'] : null)) {
|
if(!empty($url = isset($_GET['url']) ? $_GET['url'] : null)) {
|
||||||
function get_head($url) {
|
function get_head($url) {
|
||||||
$get_heads = array();
|
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(
|
$opts = array(
|
||||||
'http'=>array(
|
'http'=>array(
|
||||||
'method'=>"GET",
|
'method'=>"GET",
|
||||||
|
@ -13,6 +13,7 @@ if(!empty($url = isset($_GET['url']) ? $_GET['url'] : null)) {
|
||||||
preg_match('/<title>(.*?)<\/title>/is',$contents,$title); // 获取网站标题
|
preg_match('/<title>(.*?)<\/title>/is',$contents,$title); // 获取网站标题
|
||||||
preg_match('/<link rel=".*?icon" * href="(.*?)".*?>/is', $contents,$icon); // 获取网站icon
|
preg_match('/<link rel=".*?icon" * href="(.*?)".*?>/is', $contents,$icon); // 获取网站icon
|
||||||
preg_match('/<meta.+?charset=[^\w]?([-\w]+)/i', $contents,$charset); //获取网站编码
|
preg_match('/<meta.+?charset=[^\w]?([-\w]+)/i', $contents,$charset); //获取网站编码
|
||||||
|
$get_heads = array();
|
||||||
$get_heads['charset']=$charset[1];
|
$get_heads['charset']=$charset[1];
|
||||||
$get_heads['title'] = str_replace("'","\"",preg_replace("/\s/","",$title[1]));
|
$get_heads['title'] = str_replace("'","\"",preg_replace("/\s/","",$title[1]));
|
||||||
$get_heads['icon'] = get_urlpath(preg_replace("/\s/","",$icon[1]),$url);
|
$get_heads['icon'] = get_urlpath(preg_replace("/\s/","",$icon[1]),$url);
|
||||||
|
@ -23,9 +24,10 @@ if(!empty($url = isset($_GET['url']) ? $_GET['url'] : null)) {
|
||||||
}
|
}
|
||||||
return $get_heads;
|
return $get_heads;
|
||||||
}
|
}
|
||||||
$head = get_head($url);
|
$head = get_head($_GET['url']);
|
||||||
|
if(empty($head['title'])&&empty($head['icon']))exit('Unable to access');
|
||||||
header('Content-Type:application/json');
|
header('Content-Type:application/json');
|
||||||
exit("{'title': '".$head['title']."', 'icon': '".$head['icon']."','charset': '".$head['charset']."'}");
|
exit('{"title": "'.$head['title'].'", "icon": "'.$head['icon'].'","charset": "'.$head['charset'].'"}');
|
||||||
}
|
}
|
||||||
$grouplists =$DB->query("SELECT * FROM `lylme_groups`");
|
$grouplists =$DB->query("SELECT * FROM `lylme_groups`");
|
||||||
if(isset($_REQUEST['authcode'])) {
|
if(isset($_REQUEST['authcode'])) {
|
||||||
|
@ -104,88 +106,33 @@ if(isset($_REQUEST['authcode'])) {
|
||||||
<link href="https://cdn.lylme.com/admin/lyear/css/bootstrap.min.css" rel="stylesheet">
|
<link href="https://cdn.lylme.com/admin/lyear/css/bootstrap.min.css" rel="stylesheet">
|
||||||
<link href="https://cdn.lylme.com/admin/lyear/css/style.min.css" rel="stylesheet">
|
<link href="https://cdn.lylme.com/admin/lyear/css/style.min.css" rel="stylesheet">
|
||||||
<style>
|
<style>
|
||||||
#loading {
|
#loading{position:absolute;left:0;top:0;height:100vh;width:100vw;z-index:100;display:none;align-items:center;justify-content:center;background-color:rgba(0,0,0,0.5);color:#bbb;font-size:16px}
|
||||||
position:absolute;
|
#loading>img{height:18px;width:18px}
|
||||||
left:0;
|
.lylme-wrapper{position:relative}
|
||||||
top:0;
|
.lylme-form{display:flex !important;min-height:100vh;align-items:center !important;justify-content:center !important}
|
||||||
height:100vh;
|
.lylme-form:after{content:'';min-height:inherit;font-size:0}
|
||||||
width:100vw;
|
.lylme-center{background:#fff;min-width:29.25rem;padding:30px;border-radius:20px;margin:2.85714em}
|
||||||
z-index:1;
|
.lylme-header{margin-bottom:1.5rem !important}
|
||||||
display:none;
|
.lylme-center .has-feedback.feedback-left .form-control{padding-left:38px;padding-right:12px}
|
||||||
align-items: center;
|
.lylme-center .has-feedback.feedback-left .form-control-feedback{left:0;right:auto;width:38px;height:38px;line-height:38px;z-index:4;color:#dcdcdc}
|
||||||
justify-content: center;
|
.lylme-center .has-feedback.feedback-left.row .form-control-feedback{left:15px}
|
||||||
background-color:rgba(0,0,0,0.5);
|
.code{height:38px}
|
||||||
color: #bbb;
|
.apply_gg{margin:20px 0;font-size:15px;line-height:2}
|
||||||
font-size: 16px;
|
|
||||||
}
|
|
||||||
#loading>img {
|
|
||||||
height:32px;
|
|
||||||
width:32px;
|
|
||||||
}
|
|
||||||
.lylme-wrapper {
|
|
||||||
position: relative;
|
|
||||||
}
|
|
||||||
.lylme-form {
|
|
||||||
display: flex !important;
|
|
||||||
min-height: 100vh;
|
|
||||||
align-items: center !important;
|
|
||||||
justify-content: center !important;
|
|
||||||
}
|
|
||||||
.lylme-form:after {
|
|
||||||
content: '';
|
|
||||||
min-height: inherit;
|
|
||||||
font-size: 0;
|
|
||||||
}
|
|
||||||
.lylme-center {
|
|
||||||
background: #fff;
|
|
||||||
min-width: 29.25rem;
|
|
||||||
padding: 30px;
|
|
||||||
border-radius: 20px;
|
|
||||||
margin: 2.85714em;
|
|
||||||
}
|
|
||||||
.lylme-header {
|
|
||||||
margin-bottom: 1.5rem !important;
|
|
||||||
}
|
|
||||||
.lylme-center .has-feedback.feedback-left .form-control {
|
|
||||||
padding-left: 38px;
|
|
||||||
padding-right: 12px;
|
|
||||||
}
|
|
||||||
.lylme-center .has-feedback.feedback-left .form-control-feedback {
|
|
||||||
left: 0;
|
|
||||||
right: auto;
|
|
||||||
width: 38px;
|
|
||||||
height: 38px;
|
|
||||||
line-height: 38px;
|
|
||||||
z-index: 4;
|
|
||||||
color: #dcdcdc;
|
|
||||||
}
|
|
||||||
.lylme-center .has-feedback.feedback-left.row .form-control-feedback {
|
|
||||||
left: 15px;
|
|
||||||
}
|
|
||||||
.code {
|
|
||||||
/*padding-left: 10px;*/
|
|
||||||
/*padding-right: 0px;*/
|
|
||||||
height: 38px;
|
|
||||||
/*max-width: 100px;*/
|
|
||||||
}
|
|
||||||
.apply_gg {
|
|
||||||
margin: 20px 0;
|
|
||||||
font-size: 15px;
|
|
||||||
line-height: 2;
|
|
||||||
}
|
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div id="loading"><img src="https://cdn.lylme.com/admin/lyear/img/loading.gif"/>
|
<div id="loading"><img src="https://cdn.lylme.com/admin/lyear/img/loading.gif"/> 正在获取....</div>
|
||||||
正在获取....</div>
|
<?php
|
||||||
<?php if(!empty(background())){
|
if(!empty($background = background())){
|
||||||
echo '<div class="row lylme-wrapper" style="background-image: url('.background().');background-size: cover;">';}
|
$background = str_replace('./','../',$background);
|
||||||
else{ echo '<div class="row lylme-wrapper">';}?>
|
echo '<div class="row lylme-wrapper" style="background-image: url('.$background.');background-size: cover;">';}
|
||||||
|
else{ echo '<div class="row lylme-wrapper">';}
|
||||||
|
?>
|
||||||
|
|
||||||
<div class="lylme-form">
|
<div class="lylme-form">
|
||||||
<div class="lylme-center">
|
<div class="lylme-center">
|
||||||
<?php if($conf["apply"]==2) {
|
<?php if($conf["apply"]==2) {
|
||||||
exit('<div class="lylme-header text-center"><h2>网站已关闭申请收录</h2></div> </div>');
|
exit('<div class="lylme-header text-center"><h2>网站已关闭申请收录</h2></div>'. $conf['apply_gg']. '</div>');
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
<div class="lylme-header text-center"><h2>申请收录</h2></div>
|
<div class="lylme-header text-center"><h2>申请收录</h2></div>
|
||||||
|
@ -193,13 +140,14 @@ if(isset($_REQUEST['authcode'])) {
|
||||||
<?php echo $conf['apply_gg']?>
|
<?php echo $conf['apply_gg']?>
|
||||||
</div>
|
</div>
|
||||||
<form action="" method="POST" AUTOCOMPLETE="OFF">
|
<form action="" method="POST" AUTOCOMPLETE="OFF">
|
||||||
<div class="form-group has-feedback feedback-left row">
|
<div class="form-group">
|
||||||
<div class="col-xs-12">
|
<label>*URL链接地址:</label>
|
||||||
<label>* 网站链接:</label>
|
<div class="input-group">
|
||||||
<input type="text" id="url" class="form-control" name="url" value="" onchange="get_head()" required placeholder="完整网址或域名">
|
<input type="text" class="form-control" name="url" placeholder="完整链接或域名" value="" onchange="gurl()" required >
|
||||||
<span class="mdi mdi-link-variant form-control-feedback" aria-hidden="true"></span>
|
<span class="input-group-btn">
|
||||||
</div>
|
<button class="btn btn-default" onclick="geturl()" type="button">自动获取</button>
|
||||||
</div>
|
</span>
|
||||||
|
</div></div>
|
||||||
<div class="form-group has-feedback feedback-left row">
|
<div class="form-group has-feedback feedback-left row">
|
||||||
<div class="col-xs-12">
|
<div class="col-xs-12">
|
||||||
<label>* 选择分组:</label>
|
<label>* 选择分组:</label>
|
||||||
|
@ -220,25 +168,18 @@ if(isset($_REQUEST['authcode'])) {
|
||||||
<label>* 网站名称:</label>
|
<label>* 网站名称:</label>
|
||||||
<input type="text" class="form-control" id="title" name="name" value="" required placeholder="网站名称">
|
<input type="text" class="form-control" id="title" name="name" value="" required placeholder="网站名称">
|
||||||
<span class="mdi mdi-format-title form-control-feedback" aria-hidden="true"></span>
|
<span class="mdi mdi-format-title form-control-feedback" aria-hidden="true"></span>
|
||||||
<small class="help-block">填写网站链接后点击空白处自动获取</small>
|
<small class="help-block">填写网站名称</small>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group has-feedback feedback-left row">
|
<div class="form-group has-feedback feedback-left row">
|
||||||
<div class="col-xs-12">
|
<div class="col-xs-12">
|
||||||
<label>网站图标:</label>
|
<label>网站图标:</label>
|
||||||
<textarea type="text" id="icon" class="form-control" name="icon" placeholder="如:https://hao.lylme.com/assets/img/logo.png"></textarea>
|
<textarea type="text" id="icon" class="form-control" name="icon" placeholder="填写图标的URL地址"></textarea>
|
||||||
<span class="mdi mdi-emoticon form-control-feedback" aria-hidden="true"></span>
|
<span class="mdi mdi-emoticon form-control-feedback" aria-hidden="true"></span>
|
||||||
<small class="help-block">填写图标的<code>URL</code>地址,如:<code>http://www.xxx.com/img/logo.png</code><br>
|
<small class="help-block">填写图标的<code>URL</code>地址,如:<code>http://www.xxx.com/logo.png</code><br>
|
||||||
部分网站无法自动获取,请手动填写</small>
|
部分网站无法自动获取,请手动填写</small>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<!--<div class="form-group has-feedback feedback-left row">-->
|
|
||||||
<!-- <div class="col-xs-12">-->
|
|
||||||
<!-- <label>* 联系邮箱:</label>-->
|
|
||||||
<!-- <input type="text" class="form-control" name="mail" value="" autocomplete="off" required placeholder="填写邮箱">-->
|
|
||||||
<!-- <span class="mdi mdi-email form-control-feedback" aria-hidden="true"></span>-->
|
|
||||||
<!-- </div>-->
|
|
||||||
<!--</div>-->
|
|
||||||
<label>* 验证码:</label>
|
<label>* 验证码:</label>
|
||||||
<div class="form-group has-feedback feedback-left row">
|
<div class="form-group has-feedback feedback-left row">
|
||||||
<div class="col-xs-8">
|
<div class="col-xs-8">
|
||||||
|
@ -258,65 +199,51 @@ if(isset($_REQUEST['authcode'])) {
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
|
<script src="https://lf3-cdn-tos.bytecdntp.com/cdn/expire-2-M/jquery/3.5.1/jquery.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>
|
<script>
|
||||||
function get_head() {
|
function geturl(){
|
||||||
var xmlhttp;
|
var url = $("input[name=\'url\']").val();
|
||||||
if (window.XMLHttpRequest) {
|
if(!url){
|
||||||
// IE7+, Firefox, Chrome, Opera, Safari 浏览器执行代码
|
layer.msg('链接地址不能为空');
|
||||||
xmlhttp=new XMLHttpRequest();
|
return false;
|
||||||
} else {
|
|
||||||
// IE6, IE5 浏览器执行代码
|
|
||||||
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
|
|
||||||
}
|
}
|
||||||
xmlhttp.onreadystatechange=function() {
|
$('#loading').css("display","flex");
|
||||||
if (xmlhttp.readyState==4 && xmlhttp.status==200) {
|
if (!/^http[s]?:\/\/+/.test(url)&&url!="") {
|
||||||
document.getElementById('loading').style.display = "none";
|
|
||||||
var data=xmlhttp.responseText;
|
|
||||||
var jsonobj=eval("("+data+")");
|
|
||||||
document.getElementById("title").value=jsonobj.title;
|
|
||||||
if(jsonobj.title==''&& jsonobj.icon==''){
|
|
||||||
document.getElementById('title').placeholder="自动获取失败!可能原因:网站无法访问、被防火墙拦截或代码不规范";
|
|
||||||
}
|
|
||||||
document.getElementById("icon").value=jsonobj.icon;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
document.getElementById('loading').style.display = "flex";
|
|
||||||
document.getElementById('title').placeholder="网站名称";
|
|
||||||
var url = document.getElementById('url').value;
|
|
||||||
var re =/^http[s]?:\/\/+/;
|
|
||||||
if (!re.test(url)&&url!="") {
|
|
||||||
var url = "http://"+url;
|
var url = "http://"+url;
|
||||||
document.getElementById("url").value=url;
|
$("input[name=\'url\']").val(url);
|
||||||
}
|
}
|
||||||
|
|
||||||
var strSendUrl = "?url=" + url;
|
$.ajax({
|
||||||
xmlhttp.open("GET",strSendUrl,true);
|
url:"index.php",
|
||||||
xmlhttp.send();
|
type:"GET",
|
||||||
|
dataType:"json",
|
||||||
|
data:{url:url},
|
||||||
|
success:function(data){
|
||||||
|
var head = eval(data);
|
||||||
|
$("input[name=\'name\']").val(head.title);
|
||||||
|
if(!head.icon){
|
||||||
|
layer.msg('未获取到网站图标');
|
||||||
|
}
|
||||||
|
$("textarea[name=\'icon\']").val(head.icon);
|
||||||
|
$('#loading').css("display","none");
|
||||||
|
return true;
|
||||||
|
},
|
||||||
|
error:function(data){
|
||||||
|
layer.msg('获取失败,网站无法访问或对方防火墙限制!');
|
||||||
|
$('#loading').css("display","none");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
function gurl(){
|
||||||
|
var url = $("input[name=\'url\']").val();
|
||||||
|
if (!/^http[s]?:\/\/+/.test(url)&&url!="") {
|
||||||
|
var url = "http://"+url;
|
||||||
|
$("input[name=\'url\']").val(url);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
// window.onload = function() {
|
|
||||||
// var inputInt = document.getElementById('icon');
|
|
||||||
// var submit = document.getElementById("submit");
|
|
||||||
// function sw_on() {
|
|
||||||
// inputInt.style.borderColor = "#ebebeb";
|
|
||||||
// submit.disabled = false;
|
|
||||||
// submit.value = "提交";
|
|
||||||
// }
|
|
||||||
// function sw_off() {
|
|
||||||
// inputInt.style.borderColor = "#ff0000";
|
|
||||||
// submit.disabled = true;
|
|
||||||
// submit.value = "输入不符合要求";
|
|
||||||
// }
|
|
||||||
// inputInt.oninput = function() {
|
|
||||||
// var re =/^http[s]?:\/\/([\w-]+\.)+[\w]+(\/[\w-./%&=]*)\.(jpg|png|ico|gif)$/
|
|
||||||
// if (!re.test(this.value)) {
|
|
||||||
// sw_off();
|
|
||||||
// } else {
|
|
||||||
// sw_on();
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// ;
|
|
||||||
// sw_on();
|
|
||||||
// }
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
</html>
|
</html>
|
Loading…
Reference in New Issue