xiaoz 7 years ago
parent
commit
6878edde29
  1. 83
      admin/index.php
  2. 72
      admin/pics.php
  3. 5
      config.php
  4. 2
      import.php
  5. 36
      static/admin.css
  6. 19
      tpl/admin/footer.php
  7. 77
      tpl/admin/header.php
  8. 0
      tpl/admin/left.php
  9. 2
      upload.php

83
admin/index.php

@ -1,51 +1,32 @@ @@ -1,51 +1,32 @@
<!DOCTYPE html>
<html lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8" />
<title>ImgURL后台管理</title>
<meta name="generator" content="EverEdit" />
<meta name="author" content="" />
<meta name="keywords" content="" />
<meta name="description" content="" />
<link rel="stylesheet" href="../static/layui/css/layui.css">
<link rel="stylesheet" href="../static/admin.css">
<script src = "../static/layui/layui.js"></script>
<script src = "../static/admin.js"></script>
</head>
<body>
<!--导航栏-->
<div id="menu">
<div class="layui-container">
<div class="layui-row">
<div class="layui-col-lg9 layui-col-md-offset1">
<div style = "float: left;">
<ul class="layui-nav" lay-filter="">
<li class="layui-nav-item"><a href="">首页</a></li>
<li class="layui-nav-item layui-this"><a href="">探索发现</a></li>
<li class="layui-nav-item"><a href="">捐赠版</a></li>
<li class="layui-nav-item"><a href="">帮助文档</a></li>
<li class="layui-nav-item"><a href="">关于</a></li>
</ul>
</div>
<div style = "float: right;">
<ul class="layui-nav">
<li class="layui-nav-item">
<a href="">回收站<span class="layui-badge">9</span></a>
</li>
<li class="layui-nav-item">
<a href=""><img src="http://t.cn/RCzsdCq" class="layui-nav-img">后台管理</a>
<dl class="layui-nav-child">
<dd><a href="javascript:;">修改信息</a></dd>
<dd><a href="javascript:;">安全管理</a></dd>
<dd><a href="javascript:;">退出</a></dd>
</dl>
</li>
</ul>
</div>
</div>
</div>
</div>
</div>
<!--导航栏END-->
</body>
</html>
<?php
include_once('../tpl/admin/header.php');
?>
<!--内容区域-->
<div class="layui-col-lg9" id = "showpic">
<table class = "layui-table">
<tbody>
<tr>
<td>人生就像是一场修行</td>
<td>人生就像是一场修行</td>
<td>人生就像是一场修行</td>
<td>人生就像是一场修行</td>
</tr>
<tr>
<td>人生就像是一场修行</td>
<td>人生就像是一场修行</td>
<td>人生就像是一场修行</td>
<td>人生就像是一场修行</td>
</tr>
<tr>
<td>人生就像是一场修行</td>
<td>人生就像是一场修行</td>
<td>人生就像是一场修行</td>
<td>人生就像是一场修行</td>
</tr>
</tbody>
</table>
</div>
<!--内容区域END-->
<?php
include_once('../tpl/admin/footer.php');
?>

72
admin/pics.php

@ -0,0 +1,72 @@ @@ -0,0 +1,72 @@
<?php
include_once('../tpl/admin/header.php');
$type = $_GET['type'];
switch ( $type )
{
case 'user':
$listpic = $database->select("uploads",["id","dir","date"],["user" => "user","ORDER" => ["id" => "DESC"],"LIMIT" => 12]);
break;
case 'admin':
$listpic = $database->select("uploads",["id","dir","date"],["user" => "admin","ORDER" => ["id" => "DESC"],"LIMIT" => 12]);
break;
default:
;
break;
}
?>
<!--内容区域-->
<div class="layui-col-lg8 layui-col-md-offset1" id = "showpic">
<table class = "layui-table">
<thead>
<tr>
<th width = "60%">图片路径</th>
<th width = "20%">上传时间</th>
<th width = "20%">选项</th>
</tr>
</thead>
<tbody>
<?php for($i = 0;$i < 12;$i++){
$imgurl = $config['domain'].$listpic[$i]['dir'];
?>
<tr>
<td><a href="javascript:;" onclick = "showimg('<?php echo $imgurl ?>');"><?php echo $listpic[$i]['dir']; ?></a></td>
<td><a href="javascript:;"><?php echo $listpic[$i]['date']; ?></td>
<td><a href="javascript:;" class = "layui-btn layui-btn-danger layui-btn-xs" onclick = "delimg();">删除</a></td>
</tr>
<?php } ?>
</tbody>
</table>
</div>
<!--内容区域END-->
<?php
include_once('../tpl/admin/footer.php');
?>
<script>
function showimg(imgurl){
layui.use('layer', function(){
var layer = layui.layer;
layer.open({
type: 1,
title:"图片预览",
area: ['600px', '400px'],
content: "<img width = '100%' src = '" + imgurl + "' />"
});
});
}
//删除图片
function delimg(){
layer.confirm('纳尼?', {
btn: ['按钮一', '按钮二', '按钮三'] //可以无限个按钮
,btn3: function(index, layero){
//按钮【按钮三】的回调
}
}, function(index, layero){
//按钮【按钮一】的回调
}, function(index){
//按钮【按钮二】的回调
});
}
</script>

5
config.php

@ -1,9 +1,12 @@ @@ -1,9 +1,12 @@
<?php
$App = getcwd();
$App = str_replace('admin','',$App);
require_once( 'sdk/Medoo.php' );
use Medoo\Medoo;
//echo $App;
$database = new medoo([
'database_type' => 'sqlite',
'database_file' => 'data/imgurl.db3'
'database_file' => $App.'/data/imgurl.db3'
]);
$config = array(

2
import.php

@ -6,7 +6,7 @@ @@ -6,7 +6,7 @@
$month = $_GET['month'];
$date = $year.$month;
$user = $_GET['user'];
$thedate = '20'.$year.'-'.$month.'-01';
$thedate = '20'.$year.$month.'01';
//echo $thedate;

36
static/admin.css

@ -3,4 +3,40 @@ @@ -3,4 +3,40 @@
margin:0;
padding:0;
background-color:#393D49;
}
#footer{
width:100%;
margin-top:40px;
padding:0;
background-color:#F5F5F5;
position:fixed;
bottom:0;
}
#footer p{
padding:16px;
color:#999999;
}
#sidebar{
margin-top:40px;
margin-bottom:80px;
}
.left-menu{
margin-left:30px;
}
.left-menu li{
padding:5px;
}
.left-menu li a{
padding-left:12px;
}
.left-menu h2{
font-size:16px;
border-left:5px #009E94 solid;
padding:8px;
background-color:#F2F2F2;
}
#showpic td{
width:177px;
}

19
tpl/admin/footer.php

@ -0,0 +1,19 @@ @@ -0,0 +1,19 @@
</div>
</div>
</div>
</div>
<!--侧边栏END-->
<!---->
<!--页脚-->
<div id="footer">
<div class="layui-container">
<div class="layui-row">
<div class="layui-col-lg10 layui-col-md-offset1">
<p>Copyright Ⓒ 2017 Powered by ImgURL. Author: xiaoz.me. 请勿上传违反中国大陆法律的图片,违者后果自负。</p>
</div>
</div>
</div>
</div>
<!--页脚-->
</body>
</html>

77
tpl/admin/header.php

@ -0,0 +1,77 @@ @@ -0,0 +1,77 @@
<?php
error_reporting(E_ALL^E_NOTICE^E_WARNING^E_DEPRECATED);
include_once('../config.php');
$uid = $_COOKIE['uid'];
$loginid = md5($config['username'].$config['password']);
if($uid != $loginid) {
echo '权限不足';
exit;
}
?>
<!DOCTYPE html>
<html lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8" />
<title>ImgURL后台管理</title>
<meta name="generator" content="EverEdit" />
<meta name="author" content="" />
<meta name="keywords" content="" />
<meta name="description" content="" />
<link rel="stylesheet" href="../static/layui/css/layui.css">
<link rel="stylesheet" href="../static/admin.css">
<script src = "../static/layui/layui.js"></script>
<script src = "../static/admin.js"></script>
</head>
<body>
<!--导航栏-->
<div id="menu">
<div class="layui-container">
<div class="layui-row">
<div class="layui-col-lg10 layui-col-md-offset1">
<div style = "float: left;">
<ul class="layui-nav" lay-filter="">
<li class="layui-nav-item"><a href="">首页</a></li>
<li class="layui-nav-item"><a href="">探索发现</a></li>
<li class="layui-nav-item"><a href="">捐赠版</a></li>
<li class="layui-nav-item"><a href="">帮助文档</a></li>
<li class="layui-nav-item"><a href="">关于</a></li>
</ul>
</div>
<div style = "float: right;">
<ul class="layui-nav">
<li class="layui-nav-item">
<a href="">回收站<span class="layui-badge">9</span></a>
</li>
<li class="layui-nav-item">
<a href="">后台管理</a>
<dl class="layui-nav-child">
<dd><a href="javascript:;">修改信息</a></dd>
<dd><a href="javascript:;">安全管理</a></dd>
<dd><a href="javascript:;">退出</a></dd>
</dl>
</li>
</ul>
</div>
</div>
</div>
</div>
</div>
<div style = "clear:both;"></div>
<!--导航栏END-->
<!--侧边栏-->
<div id = "sidebar">
<div class="layui-container">
<div class="layui-row">
<div class="layui-col-lg10 layui-col-md-offset1">
<div class="layui-col-lg3">
<div class = "left-menu">
<ul>
<li><h2>后台管理</h2></li>
<li><a href="./pics.php?type=user">游客上传</a></li>
<li><a href="./pics.php?type=admin">管理员上传</a></li>
<li><a href="">API上传</a></li>
<li><a href="">API管理</a></li>
</ul>
</div>
</div>

0
tpl/admin/left.php

2
upload.php

@ -6,7 +6,7 @@ @@ -6,7 +6,7 @@
//用户IP
$ip = $_SERVER["REMOTE_ADDR"];
//获取当前时间
$thetime = date('Y-m-d',time());
$thetime = date('Ymd',time());
//获取浏览器信息
$ua = $_SERVER['HTTP_USER_AGENT'];

Loading…
Cancel
Save