增加PHP文件
This commit is contained in:
parent
eac5fe0a40
commit
02818b27bc
|
@ -1,6 +1,11 @@
|
||||||
<?php
|
<?php
|
||||||
header ("Content-type:text/html;charset=utf-8");
|
header ("Content-type:text/html;charset=utf-8");
|
||||||
include_once 'config.php';
|
|
||||||
|
define('SYS_KEY', 'lylme_key');
|
||||||
|
define('SYSTEM_ROOT', dirname(__FILE__).'/');
|
||||||
|
define('ROOT', dirname(SYSTEM_ROOT).'/');
|
||||||
|
|
||||||
|
include ROOT.'config.php';
|
||||||
if(!$con =mysqli_connect($dbconfig['host'],$dbconfig['user'],$dbconfig['pwd'],$dbconfig['dbname'],$dbconfig['port'])) {
|
if(!$con =mysqli_connect($dbconfig['host'],$dbconfig['user'],$dbconfig['pwd'],$dbconfig['dbname'],$dbconfig['port'])) {
|
||||||
if(mysqli_connect_errno()==2002) {
|
if(mysqli_connect_errno()==2002) {
|
||||||
echo '连接数据库失败,数据库地址填写错误!';
|
echo '连接数据库失败,数据库地址填写错误!';
|
||||||
|
@ -13,36 +18,35 @@ if(!$con =mysqli_connect($dbconfig['host'],$dbconfig['user'],$dbconfig['pwd'],$d
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 判断UA
|
mysqli_query($con,"set sql_mode = ''");
|
||||||
function isMobile() {
|
//字符转换,读库
|
||||||
// 如果有HTTP_X_WAP_PROFILE则一定是移动设备
|
mysqli_query($con,"set character set 'utf8'");
|
||||||
if (isset($_SERVER['HTTP_X_WAP_PROFILE'])) {
|
//写库
|
||||||
return true;
|
mysqli_query($con,"set names 'utf8'");
|
||||||
}
|
|
||||||
// 如果via信息含有wap则一定是移动设备,部分服务商会屏蔽该信息
|
$rs= mysqli_query($con,"SELECT * FROM `lylme_config`");
|
||||||
if (isset($_SERVER['HTTP_VIA'])) {
|
while($row = mysqli_fetch_assoc($rs)) {
|
||||||
// 找不到为flase,否则为true
|
$conf[$row['k']]=$row['v'];
|
||||||
return stristr($_SERVER['HTTP_VIA'], "wap") ? true : false;
|
|
||||||
}
|
|
||||||
// 判断手机发送的客户端标志,兼容性有待提高。其中'MicroMessenger'是电脑微信
|
|
||||||
if (isset($_SERVER['HTTP_USER_AGENT'])) {
|
|
||||||
$clientkeywords = array('nokia', 'sony', 'ericsson', 'mot', 'samsung', 'htc', 'sgh', 'lg', 'sharp', 'sie-', 'philips', 'panasonic', 'alcatel', 'lenovo', 'iphone', 'ipod', 'blackberry', 'meizu', 'android', 'netfront', 'symbian', 'ucweb', 'windowsce', 'palm', 'operamini', 'operamobi', 'openwave', 'nexusone', 'cldc', 'midp', 'wap', 'mobile', 'MicroMessenger');
|
|
||||||
// 从HTTP_USER_AGENT中查找手机浏览器的关键字
|
|
||||||
if (preg_match("/(" . implode('|', $clientkeywords) . ")/i", strtolower($_SERVER['HTTP_USER_AGENT']))) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// 协议法,因为有可能不准确,放到最后判断
|
|
||||||
if (isset($_SERVER['HTTP_ACCEPT'])) {
|
|
||||||
// 如果只支持wml并且不支持html那一定是移动设备
|
|
||||||
// 如果支持wml和html但是wml在html之前则是移动设备
|
|
||||||
if ((strpos($_SERVER['HTTP_ACCEPT'], 'vnd.wap.wml') !== false) && (strpos($_SERVER['HTTP_ACCEPT'], 'text/html') === false || (strpos($_SERVER['HTTP_ACCEPT'], 'vnd.wap.wml') < strpos($_SERVER['HTTP_ACCEPT'], 'text/html')))) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
if (ismobile() == true) {$ua = 'wap';}else {$ua = 'pc';}
|
|
||||||
|
if(strpos($_SERVER['REQUEST_URI'],'admin')==false){
|
||||||
|
if(!file_exists(SYSTEM_ROOT."log.txt")){
|
||||||
|
$one_file=fopen(SYSTEM_ROOT."log.txt","w+"); //建立一个统计文本,如果不存在就创建
|
||||||
|
fwrite(SYSTEM_ROOT."log.txt",1); //把数字1写入文本
|
||||||
|
fclose("$one_file");
|
||||||
|
}else{ //如果不是第一次访问直接读取内容,并+1,写入更新后再显示新的访客数
|
||||||
|
$num=file_get_contents(SYSTEM_ROOT."log.txt");
|
||||||
|
$num++;
|
||||||
|
file_put_contents(SYSTEM_ROOT."log.txt","$num");
|
||||||
|
//$pvnum=file_get_contents(SYSTEM_ROOT."log.txt");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$pvnum=file_get_contents(SYSTEM_ROOT."log.txt");
|
||||||
|
include_once(SYSTEM_ROOT."function.php");
|
||||||
|
include_once(SYSTEM_ROOT."member.php");
|
||||||
|
mysqli_query($con,'set names utf8');
|
||||||
|
$links = mysqli_query($con, "SELECT * FROM `lylme_links`");
|
||||||
|
$numrows=mysqli_num_rows($links);
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
||||||
|
|
|
@ -2,90 +2,134 @@
|
||||||
作者: D.Young Github:https://github.com/5iux/5iux.github.io
|
作者: D.Young Github:https://github.com/5iux/5iux.github.io
|
||||||
二开: LyLme Github:https://github.com/lylme/lylme_spage
|
二开: LyLme Github:https://github.com/lylme/lylme_spage
|
||||||
-->
|
-->
|
||||||
<div style="display:none;" class="back-to" id="toolBackTop">
|
|
||||||
<a title="返回顶部" onclick="window.scrollTo(0,0);return false;" href="#top" class="back-top"></a>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="mt-5 mb-3 footer text-muted text-center">
|
<div style="display:none;" class="back-to" id="toolBackTop">
|
||||||
<img src="./assets/img/icp.png" width="16px" height="16px" />
|
<a title="返回顶部" onclick="window.scrollTo(0,0);return false;" href="#top" class="back-top"></a>
|
||||||
<a href="http://beian.miit.gov.cn/" class="icp" target="_blank" _mstmutation="1" _istranslated="1">京ICP备xxxxxxxxxx号</a> <!--备案信息-->
|
</div>
|
||||||
<p id='copyright'> Copyright ©<?php echo date("Y");?> By <a href="/">LyLme</a>六零导航页 .</p> <!--版权信息-->
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<script>
|
<div class="mt-5 mb-3 footer text-muted text-center">
|
||||||
//切换搜索引擎
|
<!--备案信息-->
|
||||||
!
|
<?php if($conf['icp'] != NULL){
|
||||||
function() {
|
echo '<img src="./assets/img/icp.png" width="16px" height="16px" /><a href="http://beian.miit.gov.cn/" class="icp" target="_blank" _mstmutation="1" _istranslated="1">'.$conf['icp'].'</a>'; } ?>
|
||||||
function g() {
|
|
||||||
h(), i(), j(), k()
|
|
||||||
}
|
|
||||||
function h() {
|
|
||||||
d.checked = s()
|
|
||||||
}
|
|
||||||
function i() {
|
|
||||||
var a = document.querySelector('input[name="type"][value="' + p() + '"]');
|
|
||||||
a && (a.checked = !0, l(a))
|
|
||||||
}
|
|
||||||
function j() {
|
|
||||||
v(u())
|
|
||||||
}
|
|
||||||
function k() {
|
|
||||||
w(t())
|
|
||||||
}
|
|
||||||
function l(a) {
|
|
||||||
for (var b = 0; b < e.length; b++) e[b].classList.remove("s-current");
|
|
||||||
a.parentNode.parentNode.parentNode.classList.add("s-current")
|
|
||||||
}
|
|
||||||
function m(a, b) {
|
|
||||||
window.localStorage.setItem("superSearch" + a, b)
|
|
||||||
}
|
|
||||||
function n(a) {
|
|
||||||
return window.localStorage.getItem("superSearch" + a)
|
|
||||||
}
|
|
||||||
function o(a) {
|
|
||||||
f = a.target, v(u()), w(a.target.value), m("type", a.target.value), c.focus(), l(a.target)
|
|
||||||
}
|
|
||||||
function p() {
|
|
||||||
var b = n("type");
|
|
||||||
return b || a[0].value
|
|
||||||
}
|
|
||||||
function q(a) {
|
|
||||||
m("newWindow", a.target.checked ? 1 : -1), x(a.target.checked)
|
|
||||||
}
|
|
||||||
function r(a) {
|
|
||||||
return a.preventDefault(), "" == c.value ? (c.focus(), !1) : (w(t() + c.value), x(s()), s() ? window.open(b.action, +new Date) : location.href = b.action, void 0)
|
|
||||||
}
|
|
||||||
function s() {
|
|
||||||
var a = n("newWindow");
|
|
||||||
return a ? 1 == a : !0
|
|
||||||
}
|
|
||||||
function t() {
|
|
||||||
return document.querySelector('input[name="type"]:checked').value
|
|
||||||
}
|
|
||||||
function u() {
|
|
||||||
return document.querySelector('input[name="type"]:checked').getAttribute("data-placeholder")
|
|
||||||
}
|
|
||||||
function v(a) {
|
|
||||||
c.setAttribute("placeholder", a)
|
|
||||||
}
|
|
||||||
function w(a) {
|
|
||||||
b.action = a
|
|
||||||
}
|
|
||||||
function x(a) {
|
|
||||||
a ? b.target = "_blank" : b.removeAttribute("target")
|
|
||||||
}
|
|
||||||
var y, a = document.querySelectorAll('input[name="type"]'),
|
|
||||||
b = document.querySelector("#super-search-fm"),
|
|
||||||
c = document.querySelector("#search-text"),
|
|
||||||
d = document.querySelector("#set-search-blank"),
|
|
||||||
e = document.querySelectorAll(".search-group"),
|
|
||||||
f = a[0];
|
|
||||||
for (g(), y = 0; y < a.length; y++) a[y].addEventListener("change", o);
|
|
||||||
d.addEventListener("change", q), b.addEventListener("submit", r)
|
|
||||||
}();
|
|
||||||
</script>
|
|
||||||
|
|
||||||
|
|
||||||
|
<!--版权信息-->
|
||||||
|
<p>©2021 - <?php echo date("Y");?> By <a href="/"><?php echo $conf['copyright']?></a> LyLme Spage.</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
//切换搜索引擎
|
||||||
|
!
|
||||||
|
function() {
|
||||||
|
function g() {
|
||||||
|
h(), i(), j(), k()
|
||||||
|
}
|
||||||
|
function h() {
|
||||||
|
d.checked = s()
|
||||||
|
}
|
||||||
|
function i() {
|
||||||
|
var a = document.querySelector('input[name="type"][value="' + p() + '"]');
|
||||||
|
a && (a.checked = !0, l(a))
|
||||||
|
}
|
||||||
|
function j() {
|
||||||
|
v(u())
|
||||||
|
}
|
||||||
|
function k() {
|
||||||
|
w(t())
|
||||||
|
}
|
||||||
|
function l(a) {
|
||||||
|
for (var b = 0; b < e.length; b++) e[b].classList.remove("s-current");
|
||||||
|
a.parentNode.parentNode.parentNode.classList.add("s-current")
|
||||||
|
}
|
||||||
|
function m(a, b) {
|
||||||
|
window.localStorage.setItem("superSearch" + a, b)
|
||||||
|
}
|
||||||
|
function n(a) {
|
||||||
|
return window.localStorage.getItem("superSearch" + a)
|
||||||
|
}
|
||||||
|
function o(a) {
|
||||||
|
f = a.target, v(u()), w(a.target.value), m("type", a.target.value), c.focus(), l(a.target)
|
||||||
|
}
|
||||||
|
function p() {
|
||||||
|
var b = n("type");
|
||||||
|
return b || a[0].value
|
||||||
|
}
|
||||||
|
function q(a) {
|
||||||
|
m("newWindow", a.target.checked ? 1 : -1), x(a.target.checked)
|
||||||
|
}
|
||||||
|
function r(a) {
|
||||||
|
return a.preventDefault(), "" == c.value ? (c.focus(), !1) : (w(t() + c.value), x(s()), s() ? window.open(b.action, +new Date) : location.href = b.action, void 0)
|
||||||
|
}
|
||||||
|
function s() {
|
||||||
|
var a = n("newWindow");
|
||||||
|
return a ? 1 == a : !0
|
||||||
|
}
|
||||||
|
function t() {
|
||||||
|
return document.querySelector('input[name="type"]:checked').value
|
||||||
|
}
|
||||||
|
function u() {
|
||||||
|
return document.querySelector('input[name="type"]:checked').getAttribute("data-placeholder")
|
||||||
|
}
|
||||||
|
function v(a) {
|
||||||
|
c.setAttribute("placeholder", a)
|
||||||
|
}
|
||||||
|
function w(a) {
|
||||||
|
b.action = a
|
||||||
|
}
|
||||||
|
function x(a) {
|
||||||
|
a ? b.target = "_blank" : b.removeAttribute("target")
|
||||||
|
}
|
||||||
|
var y, a = document.querySelectorAll('input[name="type"]'),
|
||||||
|
b = document.querySelector("#super-search-fm"),
|
||||||
|
c = document.querySelector("#search-text"),
|
||||||
|
d = document.querySelector("#set-search-blank"),
|
||||||
|
e = document.querySelectorAll(".search-group"),
|
||||||
|
f = a[0];
|
||||||
|
for (g(), y = 0; y < a.length; y++) a[y].addEventListener("change", o);
|
||||||
|
d.addEventListener("change", q), b.addEventListener("submit", r)
|
||||||
|
}();
|
||||||
|
|
||||||
</body>
|
</script>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
var _hmt = _hmt || [];
|
||||||
|
(function() {
|
||||||
|
var hm = document.createElement("script");
|
||||||
|
hm.src = "https://hm.baidu.com/hm.js?da909acf5145a279a505611d16ce5c30";
|
||||||
|
var s = document.getElementsByTagName("script")[0];
|
||||||
|
s.parentNode.insertBefore(hm, s);
|
||||||
|
})();
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
(function(a) {
|
||||||
|
a.fn.scrollToTop = function(c) {
|
||||||
|
var d = {
|
||||||
|
speed: 800
|
||||||
|
};
|
||||||
|
c && a.extend(d, {
|
||||||
|
speed: c
|
||||||
|
});
|
||||||
|
return this.each(function() {
|
||||||
|
var b = a(this);
|
||||||
|
a(window).scroll(function() {
|
||||||
|
100 < a(this).scrollTop() ? b.fadeIn() : b.fadeOut()
|
||||||
|
});
|
||||||
|
b.click(function(b) {
|
||||||
|
b.preventDefault();
|
||||||
|
a("body, html").animate({
|
||||||
|
scrollTop: 0
|
||||||
|
},
|
||||||
|
d.speed)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})(jQuery);
|
||||||
|
$(function() {
|
||||||
|
ahtml = '<a href="javascript:void(0)" title="回到顶部" id="toTop" style="display:none;position:fixed;bottom:66px;right:15px;width:50px;height:50px;border-radius:50%;overflow:hidden;background-image:url(\'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABcAAAAWBAMAAADZWBo2AAAALVBMVEUAAAB5eXl5eXl5eXl5eXl5eXl5eXl5eXl5eXl5eXl5eXl5eXl5eXl5eXl5eXl4rtNiAAAADnRSTlMARHe7Zu7dMxGIIqqZzHSj3DwAAAB/SURBVBjTYwADPgYk8OABgs2HLPUAjBA6+JAk4FJ8UJLqYLKxsQNTXhIDs/GWBoZCPcEFeop6CnyKvhMYGOQYGJIYmBL4BBgfgDjsrxi4nvMJsCSAOCChh3yHjjqAZV4wcDznO6TFANYTwsASwCfAAOFMFRCdAOd0v3vdAOIAANnHHKk0/kXuAAAAAElFTkSuQmCC\');background-repeat:no-repeat;background-position:center;z-index:999;cursor:pointer;border:1px solid #d8d8d8;box-sizing:border-box;opacity:0.9;"></a>';
|
||||||
|
$("body").append(ahtml);
|
||||||
|
$("#toTop").scrollToTop(300);
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
</html>
|
</html>
|
|
@ -0,0 +1,294 @@
|
||||||
|
<?php
|
||||||
|
function isMobile() {
|
||||||
|
// 如果有HTTP_X_WAP_PROFILE则一定是移动设备
|
||||||
|
if (isset($_SERVER['HTTP_X_WAP_PROFILE'])) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
// 如果via信息含有wap则一定是移动设备,部分服务商会屏蔽该信息
|
||||||
|
if (isset($_SERVER['HTTP_VIA'])) {
|
||||||
|
// 找不到为flase,否则为true
|
||||||
|
return stristr($_SERVER['HTTP_VIA'], "wap") ? true : false;
|
||||||
|
}
|
||||||
|
// 判断手机发送的客户端标志,兼容性有待提高。其中'MicroMessenger'是电脑微信
|
||||||
|
if (isset($_SERVER['HTTP_USER_AGENT'])) {
|
||||||
|
$clientkeywords = array('nokia', 'sony', 'ericsson', 'mot', 'samsung', 'htc', 'sgh', 'lg', 'sharp', 'sie-', 'philips', 'panasonic', 'alcatel', 'lenovo', 'iphone', 'ipod', 'blackberry', 'meizu', 'android', 'netfront', 'symbian', 'ucweb', 'windowsce', 'palm', 'operamini', 'operamobi', 'openwave', 'nexusone', 'cldc', 'midp', 'wap', 'mobile', 'MicroMessenger');
|
||||||
|
// 从HTTP_USER_AGENT中查找手机浏览器的关键字
|
||||||
|
if (preg_match("/(" . implode('|', $clientkeywords) . ")/i", strtolower($_SERVER['HTTP_USER_AGENT']))) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 协议法,因为有可能不准确,放到最后判断
|
||||||
|
if (isset($_SERVER['HTTP_ACCEPT'])) {
|
||||||
|
// 如果只支持wml并且不支持html那一定是移动设备
|
||||||
|
// 如果支持wml和html但是wml在html之前则是移动设备
|
||||||
|
if ((strpos($_SERVER['HTTP_ACCEPT'], 'vnd.wap.wml') !== false) && (strpos($_SERVER['HTTP_ACCEPT'], 'text/html') === false || (strpos($_SERVER['HTTP_ACCEPT'], 'vnd.wap.wml') < strpos($_SERVER['HTTP_ACCEPT'], 'text/html')))) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (ismobile() == true) {$ua = 'wap';}else {$ua = 'pc';}
|
||||||
|
|
||||||
|
|
||||||
|
function get_curl($url,$post=0,$referer=0,$cookie=0,$header=0,$ua=0,$nobaody=0){
|
||||||
|
$ch = curl_init();
|
||||||
|
curl_setopt($ch, CURLOPT_URL,$url);
|
||||||
|
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
||||||
|
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
|
||||||
|
$httpheader[] = "Accept:*/*";
|
||||||
|
$httpheader[] = "Accept-Encoding:gzip,deflate,sdch";
|
||||||
|
$httpheader[] = "Accept-Language:zh-CN,zh;q=0.8";
|
||||||
|
$httpheader[] = "Connection:close";
|
||||||
|
curl_setopt($ch, CURLOPT_HTTPHEADER, $httpheader);
|
||||||
|
curl_setopt($ch, CURLOPT_TIMEOUT, 5);
|
||||||
|
if($post){
|
||||||
|
curl_setopt($ch, CURLOPT_POST, 1);
|
||||||
|
curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
|
||||||
|
}
|
||||||
|
if($header){
|
||||||
|
curl_setopt($ch, CURLOPT_HEADER, TRUE);
|
||||||
|
}
|
||||||
|
if($cookie){
|
||||||
|
curl_setopt($ch, CURLOPT_COOKIE, $cookie);
|
||||||
|
}
|
||||||
|
if($referer){
|
||||||
|
if($referer==1){
|
||||||
|
curl_setopt($ch, CURLOPT_REFERER, 'http://m.qzone.com/infocenter?g_f=');
|
||||||
|
}else{
|
||||||
|
curl_setopt($ch, CURLOPT_REFERER, $referer);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if($ua){
|
||||||
|
curl_setopt($ch, CURLOPT_USERAGENT,$ua);
|
||||||
|
}else{
|
||||||
|
curl_setopt($ch, CURLOPT_USERAGENT,'Mozilla/5.0 (Linux; Android 4.4.2; NoxW Build/KOT49H) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/30.0.0.0 Mobile Safari/537.36');
|
||||||
|
}
|
||||||
|
if($nobaody){
|
||||||
|
curl_setopt($ch, CURLOPT_NOBODY,1);
|
||||||
|
}
|
||||||
|
curl_setopt($ch, CURLOPT_ENCODING, "gzip");
|
||||||
|
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
|
||||||
|
$ret = curl_exec($ch);
|
||||||
|
curl_close($ch);
|
||||||
|
return $ret;
|
||||||
|
}
|
||||||
|
function real_ip(){
|
||||||
|
$ip = $_SERVER['REMOTE_ADDR'];
|
||||||
|
if(isset($_SERVER['HTTP_X_FORWARDED_FOR']) && preg_match_all('#\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}#s', $_SERVER['HTTP_X_FORWARDED_FOR'], $matches)) {
|
||||||
|
foreach ($matches[0] AS $xip) {
|
||||||
|
if (!preg_match('#^(10|172\.16|192\.168)\.#', $xip)) {
|
||||||
|
$ip = $xip;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} elseif (isset($_SERVER['HTTP_CLIENT_IP']) && preg_match('/^([0-9]{1,3}\.){3}[0-9]{1,3}$/', $_SERVER['HTTP_CLIENT_IP'])) {
|
||||||
|
$ip = $_SERVER['HTTP_CLIENT_IP'];
|
||||||
|
} elseif (isset($_SERVER['HTTP_CF_CONNECTING_IP']) && preg_match('/^([0-9]{1,3}\.){3}[0-9]{1,3}$/', $_SERVER['HTTP_CF_CONNECTING_IP'])) {
|
||||||
|
$ip = $_SERVER['HTTP_CF_CONNECTING_IP'];
|
||||||
|
} elseif (isset($_SERVER['HTTP_X_REAL_IP']) && preg_match('/^([0-9]{1,3}\.){3}[0-9]{1,3}$/', $_SERVER['HTTP_X_REAL_IP'])) {
|
||||||
|
$ip = $_SERVER['HTTP_X_REAL_IP'];
|
||||||
|
}
|
||||||
|
return $ip;
|
||||||
|
}
|
||||||
|
function get_ip_city($ip)
|
||||||
|
{
|
||||||
|
$url = 'http://int.dpool.sina.com.cn/iplookup/iplookup.php?format=json&ip=';
|
||||||
|
@$city = get_curl($url . $ip);
|
||||||
|
$city = json_decode($city, true);
|
||||||
|
if ($city['city']) {
|
||||||
|
$location = $city['province'].$city['city'];
|
||||||
|
} else {
|
||||||
|
$location = $city['province'];
|
||||||
|
}
|
||||||
|
if($location){
|
||||||
|
return $location;
|
||||||
|
}else{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function send_mail($to, $sub, $msg) {
|
||||||
|
global $conf;
|
||||||
|
include_once ROOT.'includes/smtp.class.php';
|
||||||
|
$From = $conf['mail_name'];
|
||||||
|
$Host = $conf['mail_stmp'];
|
||||||
|
$Port = $conf['mail_port'];
|
||||||
|
$SMTPAuth = 1;
|
||||||
|
$Username = $conf['mail_name'];
|
||||||
|
$Password = $conf['mail_pwd'];
|
||||||
|
$Nickname = $conf['sitename'];
|
||||||
|
$SSL = false;
|
||||||
|
$mail = new SMTP($Host , $Port , $SMTPAuth , $Username , $Password , $SSL);
|
||||||
|
$mail->att = array();
|
||||||
|
if($mail->send($to , $From , $sub , $msg, $Nickname)) {
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return $mail->log;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function daddslashes($string, $force = 0, $strip = FALSE) {
|
||||||
|
!defined('MAGIC_QUOTES_GPC') && define('MAGIC_QUOTES_GPC', get_magic_quotes_gpc());
|
||||||
|
if(!MAGIC_QUOTES_GPC || $force) {
|
||||||
|
if(is_array($string)) {
|
||||||
|
foreach($string as $key => $val) {
|
||||||
|
$string[$key] = daddslashes($val, $force, $strip);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$string = addslashes($strip ? stripslashes($string) : $string);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $string;
|
||||||
|
}
|
||||||
|
|
||||||
|
function strexists($string, $find) {
|
||||||
|
return !(strpos($string, $find) === FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
|
function dstrpos($string, $arr) {
|
||||||
|
if(empty($string)) return false;
|
||||||
|
foreach((array)$arr as $v) {
|
||||||
|
if(strpos($string, $v) !== false) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
function checkmobile() {
|
||||||
|
$useragent = strtolower($_SERVER['HTTP_USER_AGENT']);
|
||||||
|
$ualist = array('android', 'midp', 'nokia', 'mobile', 'iphone', 'ipod', 'blackberry', 'windows phone');
|
||||||
|
if((dstrpos($useragent, $ualist) || strexists($_SERVER['HTTP_ACCEPT'], "VND.WAP") || strexists($_SERVER['HTTP_VIA'],"wap"))){
|
||||||
|
return true;
|
||||||
|
}else{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function authcode($string, $operation = 'DECODE', $key = '', $expiry = 0) {
|
||||||
|
$ckey_length = 4;
|
||||||
|
$key = md5($key ? $key : ENCRYPT_KEY);
|
||||||
|
$keya = md5(substr($key, 0, 16));
|
||||||
|
$keyb = md5(substr($key, 16, 16));
|
||||||
|
$keyc = $ckey_length ? ($operation == 'DECODE' ? substr($string, 0, $ckey_length): substr(md5(microtime()), -$ckey_length)) : '';
|
||||||
|
$cryptkey = $keya.md5($keya.$keyc);
|
||||||
|
$key_length = strlen($cryptkey);
|
||||||
|
$string = $operation == 'DECODE' ? base64_decode(substr($string, $ckey_length)) : sprintf('%010d', $expiry ? $expiry + time() : 0).substr(md5($string.$keyb), 0, 16).$string;
|
||||||
|
$string_length = strlen($string);
|
||||||
|
$result = '';
|
||||||
|
$box = range(0, 255);
|
||||||
|
$rndkey = array();
|
||||||
|
for($i = 0; $i <= 255; $i++) {
|
||||||
|
$rndkey[$i] = ord($cryptkey[$i % $key_length]);
|
||||||
|
}
|
||||||
|
for($j = $i = 0; $i < 256; $i++) {
|
||||||
|
$j = ($j + $box[$i] + $rndkey[$i]) % 256;
|
||||||
|
$tmp = $box[$i];
|
||||||
|
$box[$i] = $box[$j];
|
||||||
|
$box[$j] = $tmp;
|
||||||
|
}
|
||||||
|
for($a = $j = $i = 0; $i < $string_length; $i++) {
|
||||||
|
$a = ($a + 1) % 256;
|
||||||
|
$j = ($j + $box[$a]) % 256;
|
||||||
|
$tmp = $box[$a];
|
||||||
|
$box[$a] = $box[$j];
|
||||||
|
$box[$j] = $tmp;
|
||||||
|
$result .= chr(ord($string[$i]) ^ ($box[($box[$a] + $box[$j]) % 256]));
|
||||||
|
}
|
||||||
|
if($operation == 'DECODE') {
|
||||||
|
if((substr($result, 0, 10) == 0 || substr($result, 0, 10) - time() > 0) && substr($result, 10, 16) == substr(md5(substr($result, 26).$keyb), 0, 16)) {
|
||||||
|
return substr($result, 26);
|
||||||
|
} else {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return $keyc.str_replace('=', '', base64_encode($result));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function random($length, $numeric = 0) {
|
||||||
|
$seed = base_convert(md5(microtime().$_SERVER['DOCUMENT_ROOT']), 16, $numeric ? 10 : 35);
|
||||||
|
$seed = $numeric ? (str_replace('0', '', $seed).'012340567890') : ($seed.'zZ'.strtoupper($seed));
|
||||||
|
$hash = '';
|
||||||
|
$max = strlen($seed) - 1;
|
||||||
|
for($i = 0; $i < $length; $i++) {
|
||||||
|
$hash .= $seed{mt_rand(0, $max)};
|
||||||
|
}
|
||||||
|
return $hash;
|
||||||
|
}
|
||||||
|
function getSetting($k, $force = false){
|
||||||
|
global $DB,$CACHE;
|
||||||
|
if($force) return $setting[$k] = $DB->get_row("SELECT v FROM web_config WHERE k='$k' limit 1");
|
||||||
|
$cache = $CACHE->get($k);
|
||||||
|
return $cache[$k];
|
||||||
|
}
|
||||||
|
|
||||||
|
function saveSetting($k, $v){
|
||||||
|
$v = daddslashes($v);
|
||||||
|
return mysqli_query($GLOBALS['con'],"UPDATE `lylme_config` SET `v` = '$v' WHERE `lylme_config`.`k` = '$k';");
|
||||||
|
}
|
||||||
|
|
||||||
|
function showmsg($content = '未知的异常',$type = 4,$back = false)
|
||||||
|
{
|
||||||
|
switch($type)
|
||||||
|
{
|
||||||
|
case 1:
|
||||||
|
$panel="success";
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
$panel="info";
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
$panel="warning";
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
$panel="danger";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
echo '<div class="panel panel-'.$panel.'">
|
||||||
|
<div class="panel-heading">
|
||||||
|
<h3 class="panel-title">提示信息</h3>
|
||||||
|
</div>
|
||||||
|
<div class="panel-body">';
|
||||||
|
echo $content;
|
||||||
|
|
||||||
|
if ($back) {
|
||||||
|
echo '<hr/><a href="'.$back.'"><< 返回上一页</a>';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
echo '<hr/><a href="javascript:history.back(-1)"><< 返回上一页</a>';
|
||||||
|
|
||||||
|
echo '</div>
|
||||||
|
</div>';
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
function sysmsg($msg = '未知的异常',$die = true) {
|
||||||
|
?>
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html xmlns="http://www.w3.org/1999/xhtml" lang="zh-CN">
|
||||||
|
<head>
|
||||||
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>站点提示信息</title>
|
||||||
|
<style type="text/css">
|
||||||
|
html{background:#eee}body{background:#fff;color:#333;font-family:"微软雅黑","Microsoft YaHei",sans-serif;margin:2em auto;padding:1em 2em;max-width:700px;-webkit-box-shadow:10px 10px 10px rgba(0,0,0,.13);box-shadow:10px 10px 10px rgba(0,0,0,.13);opacity:.8}h1{border-bottom:1px solid #dadada;clear:both;color:#666;font:24px "微软雅黑","Microsoft YaHei",,sans-serif;margin:30px 0 0 0;padding:0;padding-bottom:7px}#error-page{margin-top:50px}h3{text-align:center}#error-page p{font-size:9px;line-height:1.5;margin:25px 0 20px}#error-page code{font-family:Consolas,Monaco,monospace}ul li{margin-bottom:10px;font-size:9px}a{color:#21759B;text-decoration:none;margin-top:-10px}a:hover{color:#D54E21}.button{background:#f7f7f7;border:1px solid #ccc;color:#555;display:inline-block;text-decoration:none;font-size:9px;line-height:26px;height:28px;margin:0;padding:0 10px 1px;cursor:pointer;-webkit-border-radius:3px;-webkit-appearance:none;border-radius:3px;white-space:nowrap;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;-webkit-box-shadow:inset 0 1px 0 #fff,0 1px 0 rgba(0,0,0,.08);box-shadow:inset 0 1px 0 #fff,0 1px 0 rgba(0,0,0,.08);vertical-align:top}.button.button-large{height:29px;line-height:28px;padding:0 12px}.button:focus,.button:hover{background:#fafafa;border-color:#999;color:#222}.button:focus{-webkit-box-shadow:1px 1px 1px rgba(0,0,0,.2);box-shadow:1px 1px 1px rgba(0,0,0,.2)}.button:active{background:#eee;border-color:#999;color:#333;-webkit-box-shadow:inset 0 2px 5px -3px rgba(0,0,0,.5);box-shadow:inset 0 2px 5px -3px rgba(0,0,0,.5)}table{table-layout:auto;border:1px solid #333;empty-cells:show;border-collapse:collapse}th{padding:4px;border:1px solid #333;overflow:hidden;color:#333;background:#eee}td{padding:4px;border:1px solid #333;overflow:hidden;color:#333}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body id="error-page">
|
||||||
|
<?php echo '<h3>站点提示信息</h3>';
|
||||||
|
echo $msg; ?>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
<?php
|
||||||
|
if ($die == true) {
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function checkIfActive($string) {
|
||||||
|
$array=explode(',',$string);
|
||||||
|
$php_self=substr($_SERVER['REQUEST_URI'],strrpos($_SERVER['REQUEST_URI'],'/')+1,strrpos($_SERVER['REQUEST_URI'],'.')-strrpos($_SERVER['REQUEST_URI'],'/')-1);
|
||||||
|
if (in_array($php_self,$array)){
|
||||||
|
return 'active';
|
||||||
|
}else
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
?>
|
|
@ -2,12 +2,12 @@
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="zh-CN" element::-webkit-scrollbar {display:none}>
|
<html lang="zh-CN" element::-webkit-scrollbar {display:none}>
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||||
<meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1"/>
|
<meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1"/>
|
||||||
<title>上网导航 - LyLme Spage</title>
|
<title><?php echo $conf['title']?></title>
|
||||||
<meta name="keywords" content="六零起始页,百度搜索,哔哩哔哩搜索,知乎搜索,六零导航,LyLme Start Page,六零,LyLme小窝,LyLme,叮当云,网站导航,上网导航">
|
<meta name="keywords" content="<?php echo $conf['keywords']?>">
|
||||||
<meta name="description" content="六零起始页(LyLme Start Page)致力于简洁高效无广告的上网导航和搜索入口,沉淀最具价值链接,全站无商业推广,简约而不简单。">
|
<meta name="description" content="<?php echo $conf['description']?>">
|
||||||
<link rel="icon" sizes="any" mask href="./assets/img/logo.png">
|
<link rel="icon" sizes="any" mask href="<?php echo $conf['logo']?>">
|
||||||
<meta name="apple-mobile-web-app-capable" content="yes">
|
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||||
<meta name="apple-touch-fullscreen" content="yes">
|
<meta name="apple-touch-fullscreen" content="yes">
|
||||||
<meta name="apple-mobile-web-app-status-bar-style" content="black">
|
<meta name="apple-mobile-web-app-status-bar-style" content="black">
|
||||||
|
@ -22,34 +22,5 @@
|
||||||
<link rel="stylesheet" id="font-awesome-css" href="./assets/css/fontawesome-free5.13.0.css" type="text/css" media="all">
|
<link rel="stylesheet" id="font-awesome-css" href="./assets/css/fontawesome-free5.13.0.css" type="text/css" media="all">
|
||||||
<script src="./assets/js/svg.js"></script>
|
<script src="./assets/js/svg.js"></script>
|
||||||
<script src="./assets/js/script.js"></script>
|
<script src="./assets/js/script.js"></script>
|
||||||
<script>
|
|
||||||
(function(a) {
|
|
||||||
a.fn.scrollToTop = function(c) {
|
|
||||||
var d = {
|
|
||||||
speed: 800
|
|
||||||
};
|
|
||||||
c && a.extend(d, {
|
|
||||||
speed: c
|
|
||||||
});
|
|
||||||
return this.each(function() {
|
|
||||||
var b = a(this);
|
|
||||||
a(window).scroll(function() {
|
|
||||||
100 < a(this).scrollTop() ? b.fadeIn() : b.fadeOut()
|
|
||||||
});
|
|
||||||
b.click(function(b) {
|
|
||||||
b.preventDefault();
|
|
||||||
a("body, html").animate({
|
|
||||||
scrollTop: 0
|
|
||||||
},
|
|
||||||
d.speed)
|
|
||||||
})
|
|
||||||
})
|
|
||||||
}
|
|
||||||
})(jQuery);
|
|
||||||
$(function() {
|
|
||||||
ahtml = '<a href="javascript:void(0)" title="回到顶部" id="toTop" style="display:none;position:fixed;bottom:66px;right:15px;width:50px;height:50px;border-radius:50%;overflow:hidden;background-image:url(\'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABcAAAAWBAMAAADZWBo2AAAALVBMVEUAAAB5eXl5eXl5eXl5eXl5eXl5eXl5eXl5eXl5eXl5eXl5eXl5eXl5eXl5eXl4rtNiAAAADnRSTlMARHe7Zu7dMxGIIqqZzHSj3DwAAAB/SURBVBjTYwADPgYk8OABgs2HLPUAjBA6+JAk4FJ8UJLqYLKxsQNTXhIDs/GWBoZCPcEFeop6CnyKvhMYGOQYGJIYmBL4BBgfgDjsrxi4nvMJsCSAOCChh3yHjjqAZV4wcDznO6TFANYTwsASwCfAAOFMFRCdAOd0v3vdAOIAANnHHKk0/kXuAAAAAElFTkSuQmCC\');background-repeat:no-repeat;background-position:center;z-index:999;cursor:pointer;border:1px solid #d8d8d8;box-sizing:border-box;opacity:0.9;"></a>';
|
|
||||||
$("body").append(ahtml);
|
|
||||||
$("#toTop").scrollToTop(300);
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
</head>
|
</head>
|
|
@ -0,0 +1,12 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
if(isset($_COOKIE["admin_token"]))
|
||||||
|
{
|
||||||
|
$token=authcode(daddslashes($_COOKIE['admin_token']), 'DECODE', SYS_KEY);
|
||||||
|
list($user, $sid) = explode("\t", $token);
|
||||||
|
$session=md5($conf['admin_user'].$conf['admin_pwd'].$password_hash);
|
||||||
|
if($session==$sid) {
|
||||||
|
$islogin=1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
Loading…
Reference in New Issue