Browse Source

修复一些BUG

pull/36/head
xiaoz 6 years ago
parent
commit
7e71450339
  1. 4
      application/controllers/User.php
  2. 8
      application/libraries/Basic.php
  3. 54
      application/views/user/multiple.php
  4. 7
      application/views/user/page.php
  5. 4
      static/embed.js

4
application/controllers/User.php

@ -68,9 +68,9 @@
} }
} }
public function logout(){ public function logout(){
echo '您已退出,将在5s后返回首页!'; echo '您已退出,将在3s后返回首页!';
$this->clean_cookies(); $this->clean_cookies();
header("Refresh:5;url=/"); header("Refresh:3;url=/");
exit; exit;
} }
//清除COOKIE //清除COOKIE

8
application/libraries/Basic.php

@ -51,7 +51,10 @@
return false; return false;
} }
else{ else{
echo '权限不足!'; echo "权限不足,请<a href = '/user/login'>重新登录</a> 。";
//清除cookies
setcookie("user", '', time()-3600,"/");
setcookie("token", '', time()-3600,"/");
exit; exit;
} }
} }
@ -71,7 +74,7 @@
curl_setopt($curl, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36"); curl_setopt($curl, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36");
//伪造reffer //伪造reffer
curl_setopt ($ch, CURLOPT_REFERER, $url); curl_setopt ($curl, CURLOPT_REFERER, $url);
curl_setopt($curl, CURLOPT_FAILONERROR, true); curl_setopt($curl, CURLOPT_FAILONERROR, true);
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true); curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
@ -81,6 +84,7 @@
curl_setopt($curl , CURLOPT_TIMEOUT, 60); curl_setopt($curl , CURLOPT_TIMEOUT, 60);
$html = curl_exec($curl); $html = curl_exec($curl);
curl_close($curl); curl_close($curl);
//返回数据 //返回数据
return $html; return $html;

54
application/views/user/multiple.php

@ -50,57 +50,3 @@
<!-- 首页主要区域END --> <!-- 首页主要区域END -->
</div> </div>
</div> </div>
<!--Ctrl + V粘贴上传-->
<script src = "/static/js/PasteUpload.js"></script>
<script>
var load1 = document.querySelector("#upimg");
// 实例化即可
new ctrlVUtil({
uploadUrl: "/upload/parse",
targetElement: load1,
isCompleteImg:false,
data:{
name:"alanzhang",
},
success:function(data){
//转为对象
var res = data;
//上传成功
if(res.code == 200){
layer.closeAll('loading');
//layer.closeAll('loading');
$("#img-thumb a").attr('href','/img/' + res.imgid);
$("#img-thumb img").attr('src',res.thumbnail_url);
$("#url").val(res.url);
$("#html").val("<img src = '" + res.url + "' />");
$("#markdown").val("![](" + res.url + ")");
$("#bbcode").val("[img]" + res.url + "[/img]");
$("#imgshow").show();
//对图片进行鉴黄识别
$.get("/deal/identify/" + res.id,function(data,status){
var re = JSON.parse(data);
//状态码为400,说明该图片存在异常
if(re.code == 400){
layer.open({
title: '警告!'
,content: '您的IP已被记录,请不要上传违规图片!'
});
}
else{
console.log(re.code);
}
});
}
else{
layer.msg(res.msg);
}
},
error: function(error){
layer.closeAll('loading');
layer.msg('上传失败!');
}
});
</script>
<!--粘贴上传END-->

7
application/views/user/page.php

@ -6,7 +6,12 @@
<div class="layui-col-lg3"> <div class="layui-col-lg3">
<div id="page-sidebar"> <div id="page-sidebar">
<div class = "sidebar"> <div class = "sidebar">
<a href="https://e.aiguobit.com/?from=xiaoz" target="_blank" rel="nofollow noopener"><img class="alignnone size-full wp-image-6279" src="https://www.xiaoz.me/wp-content/uploads/2017/06/netssocks_300.png" /></a> <a href="https://e.aiguobit.com/?from=xiaoz" target="_blank" rel="nofollow noopener"><img src = 'https://i.bmp.ovh/imgs/2019/03/009e7ca037f6a1a2.png' /></a>
</div>
<div class = "sidebar">
<a href="https://dwz.ovh/tencent" target="_blank" rel="nofollow">
<img src = 'https://i.bmp.ovh/imgs/2019/03/f77699ba0787ee47.jpg' />
</a>
</div> </div>
<div class = "sidebar"> <div class = "sidebar">
<a href="https://www.xiaoz.me/laoxue" target="_blank" rel="nofollow"> <a href="https://www.xiaoz.me/laoxue" target="_blank" rel="nofollow">

4
static/embed.js

@ -105,6 +105,10 @@ layui.use(['upload','form','element','layer'], function(){
identify(res.id); identify(res.id);
//element.progress('up-status', col + '%'); //element.progress('up-status', col + '%');
} }
else if(res.code == 0){
layer.msg(res.msg);
return false;
}
} }
,error: function(index, upload){ ,error: function(index, upload){
layer.closeAll('loading'); //关闭loading layer.closeAll('loading'); //关闭loading

Loading…
Cancel
Save