Browse Source

v1.1

pull/16/head
xiaoz 7 years ago
parent
commit
fad9d0645e
  1. 1
      README.md
  2. 14
      admin/delete.php
  3. 1
      admin/senioradmin.php
  4. 97
      admin/smadmin.php
  5. BIN
      db/imgurl.db3
  6. 2
      dispose.php
  7. 53
      functions/class/class.admin.php
  8. 0
      functions/class/class.sm.php
  9. 23
      functions/class/class.user.php
  10. 59
      functions/sm.php
  11. 2
      functions/upload.php
  12. 2
      functions/version.txt
  13. 1
      index.php
  14. 68
      sm.php
  15. 106
      static/embed.js
  16. 43
      static/style.css
  17. 2
      tpl/admin/footer.php
  18. 2
      tpl/admin/header.php
  19. 7
      tpl/admin/left.php
  20. 2
      tpl/user/footer.php
  21. 3
      tpl/user/header.php
  22. 40
      upgrade.php

1
README.md

@ -49,6 +49,7 @@ ImgURL普通版和捐赠版功能上没有任何区别,不过您可以请xiaoz
#### 捐赠列表 #### 捐赠列表
* 2018-05-02 lackk.com 捐赠30元 * 2018-05-02 lackk.com 捐赠30元
* 2018-05-04 zip30.com 捐赠30元
### 鸣谢 ### 鸣谢
ImgURL的诞生离不开以下开源项目。 ImgURL的诞生离不开以下开源项目。

14
admin/delete.php

@ -1,13 +1,27 @@
<?php <?php
error_reporting(E_ALL^E_NOTICE^E_WARNING^E_DEPRECATED);
include_once("../functions/class/class.admin.php"); include_once("../functions/class/class.admin.php");
//获取图片ID //获取图片ID
$id = $_GET['id']; $id = $_GET['id'];
$id = (int) $id; $id = (int) $id;
//获取类型
$type = $_GET['type'];
if((!isset($id) || ($id == ''))) { if((!isset($id) || ($id == ''))) {
echo 'ID错误'; echo 'ID错误';
exit; exit;
} }
// 判断类型
switch ($type) {
case 'sm':
$pic->deletesm($id);
break;
default:
//删除图片 //删除图片
$pic->delete($id); $pic->delete($id);
break;
}
?> ?>

1
admin/senioradmin.php

@ -81,6 +81,7 @@
<?php }else{ ?> <?php }else{ ?>
<a href="javascript:;" class="layui-btn layui-btn-xs layui-btn-normal" onclick = "compress(<?php echo $id; ?>)">压缩</a> <a href="javascript:;" class="layui-btn layui-btn-xs layui-btn-normal" onclick = "compress(<?php echo $id; ?>)">压缩</a>
<?php } ?> <?php } ?>
<a href="javascript:;" class="layui-btn layui-btn-xs layui-btn-normal" onclick = "copyurl('<?php echo $imgurl; ?>')">复制</a>
<a href="javascript:;" class="layui-btn layui-btn-xs layui-btn-danger" onclick = "deleteimg(<?php echo $id; ?>)">删除</a> <a href="javascript:;" class="layui-btn layui-btn-xs layui-btn-danger" onclick = "deleteimg(<?php echo $id; ?>)">删除</a>
</td> </td>
</tr> </tr>

97
admin/smadmin.php

@ -0,0 +1,97 @@
<?php
$title = "后台管理 - ImgURL";
include_once("../functions/class/class.admin.php");
// 载入头部
include_once("../tpl/admin/header.php");
// 获取类型
$type = $_GET['type'];
//获取页数
$page = $_GET['page'];
//查询sm.ms图片
$imgs = $pic->querysm($page);
//var_dump($imgs);
$up = (int)$page - 1;
if($up <= 0){
$up = 1;
}
$down = (int)$page +1;
?>
<div class="layui-container" style = "margin-top:2em;">
<div class="layui-row layui-col-space20">
<div class="layui-col-lg3">
<!-- 载入左侧导航栏 -->
<?php include_once("../tpl/admin/left.php"); ?>
</div>
<!-- 后台内容部分 -->
<div id = "adminpic">
<div class="layui-col-lg9">
<?php if($type == 'preview') { ?>
<!-- 预览图片 -->
<div class="layui-col-lg9 layui-col-space10">
<?php foreach ($imgs as $img) {
?>
<div class="layui-col-lg4 picadmin">
<a id = "imgid<?php echo $img['id']; ?>" href="javascript:;" onclick = "smshow('<?php echo $img['url'] ?>',<?php echo $img['id']; ?>)"><img src="<?php echo $img['url'] ?>"></a>
</div>
<?php } ?>
</div>
<?php }else{ ?>
<!-- 预览图片END -->
<!-- 表格 -->
<table class="layui-table">
<colgroup>
<col width="60">
<col width="380">
<col width="150">
<col width="120">
<col>
</colgroup>
<thead>
<tr>
<th>ID</th>
<th>图片路径(点击可查看)</th>
<th>IP</th>
<th>日期</th>
<th>操作</th>
</tr>
</thead>
<tbody>
<?php foreach ($imgs as $img) {
?>
<tr id = "imgid<?php echo $img['id']; ?>">
<td><?php echo $img['id']; ?></td>
<td><a id = "imgid<?php echo $img['id']; ?>" href="javascript:;" onclick = "smshow('<?php echo $img['url'] ?>',<?php echo $img['id']; ?>)"><?php echo $img['url']; ?></a></td>
<td><a href="javascript:;" onclick = "ipquery('<?php echo $img['ip']; ?>')"><?php echo $img['ip']; ?></a></td>
<td><?php echo $img['date']; ?></td>
<td>
<a href="javascript:;" class="layui-btn layui-btn-xs layui-btn-normal" onclick = "copyurl('<?php echo $img['url']; ?>')">复制</a>
<a href="javascript:;" class="layui-btn layui-btn-xs layui-btn-danger" onclick = "deletesm(<?php echo $img['id']; ?>)">删除</a>
</td>
</tr>
<?php } ?>
</tbody>
</table>
<?php } ?>
<!-- 表格END -->
</div>
<!-- 翻页按钮 -->
<div class="layui-col-lg9 layui-col-md-offset3">
<div class="page">
<a href="?type=<?php echo $type; ?>&page=<?php echo $up; ?>" class="layui-btn">上一页</a>
<a href="?type=<?php echo $type; ?>&page=<?php echo $down; ?>" class="layui-btn">下一页</a>
</div>
</div>
<!-- 翻页按钮END -->
<!-- 后台内容部分END -->
</div>
</div>
<?php
// 载入页脚
// 载入头部
include_once("../tpl/admin/footer.php");
?>

BIN
db/imgurl.db3

Binary file not shown.

2
dispose.php

@ -1,4 +1,5 @@
<?php <?php
error_reporting(E_ALL^E_NOTICE^E_WARNING^E_DEPRECATED);
//载入配置文件 //载入配置文件
include_once("./config.php"); include_once("./config.php");
//载入TinyPNG //载入TinyPNG
@ -88,7 +89,6 @@
$database->update("imginfo",["level" => $level],["id" => $id]); $database->update("imginfo",["level" => $level],["id" => $id]);
$dispose['level'] = $level; $dispose['level'] = $level;
} }
//返回json数据 //返回json数据
$dispose['code'] = 1; $dispose['code'] = 1;
$dispose = json_encode($dispose); $dispose = json_encode($dispose);

53
functions/class/class.admin.php

@ -155,6 +155,59 @@
} }
} }
//查询SM.MS图片
//查询图片
function querysm($page){
$config = $this->config;
$database = $this->database;
//分页计算
$start = ($page - 1) * 12;
//$end = $page * 12;
if(($page == '') || (!isset($page))) {
$page = 1;
}
//要查询的条数
$num = 12;
//判断类型
$datas = $database->select("sm", "*", [
"ORDER" => ["id" => "DESC"],
"LIMIT" => [$start,$num]
]);
return $datas;
}
//删除SM.MS图片
function deletesm($id){
$config = $this->config;
$database = $this->database;
//先查询数据库
$query = $database->get("sm","*",[
"id" => $id
]);
$delete = $database->delete("sm", [
"AND" => [
"id" => $id
]
]);
//请求接口删除图片
$curl = curl_init($query['delete']);
curl_setopt($curl, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.139 Safari/537.36");
curl_setopt($curl, CURLOPT_FAILONERROR, true);
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
#设置超时时间,最小为1s(可选)
curl_setopt($curl , CURLOPT_TIMEOUT, 2);
$html = curl_exec($curl);
curl_close($curl);
echo 'ok';
}
} }
$pic = new Admin($config,$database); $pic = new Admin($config,$database);

0
functions/class/class.sm.php

23
functions/class/class.user.php

@ -104,6 +104,29 @@
exit; exit;
} }
} }
//获取访客真实IP
function getip(){
if (getenv('HTTP_CLIENT_IP')) {
$ip = getenv('HTTP_CLIENT_IP');
}
elseif (getenv('HTTP_X_FORWARDED_FOR')) {
$ip = getenv('HTTP_X_FORWARDED_FOR');
}
elseif (getenv('HTTP_X_FORWARDED')) {
$ip = getenv('HTTP_X_FORWARDED');
}
elseif (getenv('HTTP_FORWARDED_FOR')) {
$ip = getenv('HTTP_FORWARDED_FOR');
}
elseif (getenv('HTTP_FORWARDED')) {
$ip = getenv('HTTP_FORWARDED');
}
else {
$ip = $_SERVER['REMOTE_ADDR'];
}
return $ip;
}
} }

59
functions/sm.php

@ -0,0 +1,59 @@
<?php
//载入类
include_once("./class/class.user.php");
//获取sm.ms API返回数据
$data = $_POST['data'];
//获取访客IP
$sm['ip'] = $basis->getip();
//获取访客UA
$sm['ua'] = $_SERVER['HTTP_USER_AGENT'];
//获取当前时间
$sm['date'] = date('Y-m-d',time());
//获取图片URL
$sm['url'] = $data['url'];
//获取删除链接
$sm['delete'] = $data['delete'];
//进行基本的判断
if((!isset($data)) || ($data == '') || (!is_array($data))) {
echo '获取数据失败!';
exit;
}
//再次判断地址是否合法
if(!filter_var($sm['url'], FILTER_VALIDATE_URL)) {
echo '不是合法的地址!';
exit;
}
if(!filter_var($sm['delete'], FILTER_VALIDATE_URL)) {
echo '不是合法的地址!';
exit;
}
//写入数据库
$last_user_id = $database->insert("sm", [
"ip" => $sm['ip'],
"ua" => $sm['ua'],
"date" => $sm['date'],
"url" => $sm['url'],
"delete"=> $sm['delete']
]);
//返回ID
$smid = $database->id();
if($last_user_id) {
$redata = array(
"code" => 1,
"id" => $smid,
"msg" => "写入成功!"
);
echo json_encode($redata);
exit;
}
else{
$redata = array(
"code" => 0,
"id" => $smid,
"msg" => "该图片可能已经上传过!"
);
echo json_encode($redata);
}
?>

2
functions/upload.php

@ -16,7 +16,7 @@
} }
//获取上传者信息 //获取上传者信息
$ip = $_SERVER['REMOTE_ADDR']; $ip = $basis->getip();
$ua = $_SERVER['HTTP_USER_AGENT']; $ua = $_SERVER['HTTP_USER_AGENT'];
$date = date('Y-m-d',time()); $date = date('Y-m-d',time());
//载入上传类 //载入上传类

2
functions/version.txt

@ -1 +1 @@
v1.0(20180502) v1.1(20180504)

1
index.php

@ -6,6 +6,7 @@
<div class="layui-container"> <div class="layui-container">
<div class="layui-row"> <div class="layui-row">
<div class="layui-col-lg12 layui-col-xs10"> <div class="layui-col-lg12 layui-col-xs10">
<div class="msg"><i class="layui-icon">&#xe645;</i> 注意:您上传的图片将会公开显示,勿上传隐私图片。游客限制每天5张,最大支持2M</div>
<!-- 上传图片表单 --> <!-- 上传图片表单 -->
<div class="layui-upload-drag" id="upimg"> <div class="layui-upload-drag" id="upimg">
<i class="layui-icon">&#xe67c;</i> <i class="layui-icon">&#xe67c;</i>

68
sm.php

@ -0,0 +1,68 @@
<?php
$title = "ImgURL - 简单、纯粹的图床程序。";
include_once("./tpl/user/header.php");
?>
<div class="layui-container">
<div class="layui-row">
<div class="layui-col-lg12 layui-col-xs10">
<div class="msg"><i class="layui-icon">&#xe645;</i> 该功能可以将图片上传至SM.MS图床。</div>
<!-- 上传图片表单 -->
<div class = "smfile">
<a href="javascript:;" class="file">
<input type="file" name="smfile" id="sm">
<i class="layui-icon" style = "font-size:6em;">&#xe67c;</i>
</a>
</div>
<!-- 上传图片表单END -->
</div>
</div>
<div style = "clear:both;"></div>
<!-- 图片上传成功 -->
<div class="layui-row" id = "upok">
<div>
<div id="showpic" class = "layui-col-lg5"><a href="" target = "_blank"><img src=""></a></div>
<div id="piclink" class = "layui-col-lg6 layui-col-md-offset1">
<table class="layui-table" lay-skin="nob">
<colgroup>
<col width="80">
<col width="400">
<col>
</colgroup>
<tbody>
<tr>
<td>URL</td>
<td><input type="text" class="layui-input" id = "url"></td>
<td><a href="javascript:;" class = "layui-btn layui-btn-sm" onclick = "copy('url')">复制</a></td>
</tr>
<tr>
<td>HTML</td>
<td><input type="text" class="layui-input" id = "html"></td>
<td><a href="javascript:;" class = "layui-btn layui-btn-sm" onclick = "copy('html')">复制</a></td>
</tr>
<tr>
<td>MarkDown</td>
<td><input type="text" class="layui-input" id = "markdown"></td>
<td><a href="javascript:;" class = "layui-btn layui-btn-sm" onclick = "copy('markdown')">复制</a></td>
</tr>
<tr>
<td>BBcode</td>
<td><input type="text" class="layui-input" id = "bbcode"></td>
<td><a href="javascript:;" class = "layui-btn layui-btn-sm" onclick = "copy('bbcode')">复制</a></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<!-- 图片上传成功END -->
</div>
<?php
include_once("./tpl/user/footer.php");
?>
<script>
$(document).ready(function(){
$("#smfile input:text").attr("name",'smfile');
});
</script>

106
static/embed.js

@ -1,3 +1,7 @@
//layui 根目录配置
layui.config({
base: '/static/layui/',
})
//载入layui组建 //载入layui组建
layui.use(['layer', 'form','element','upload','flow'], function(){ layui.use(['layer', 'form','element','upload','flow'], function(){
var form = layui.form; var form = layui.form;
@ -10,10 +14,11 @@ layui.use(['layer', 'form','element','upload','flow'], function(){
// elem:'#found-img img' // elem:'#found-img img'
// }); // });
//拖拽上传 //首页拖拽上传
upload.render({ upload.render({
elem: '#upimg' elem: '#upimg'
,url: 'functions/upload.php' ,url: 'functions/upload.php'
,size: 2048 //限制上传大小为2M
,before: function(obj){ //obj参数包含的信息,跟 choose回调完全一致,可参见上文。 ,before: function(obj){ //obj参数包含的信息,跟 choose回调完全一致,可参见上文。
layer.load(); //上传loading layer.load(); //上传loading
} }
@ -48,6 +53,38 @@ layui.use(['layer', 'form','element','upload','flow'], function(){
} }
} }
}); });
//上传到sm.ms
upload.render({
elem: '#sm'
,url: 'https://sm.ms/api/upload'
,before: function(obj){ //obj参数包含的信息,跟 choose回调完全一致,可参见上文。
layer.load(); //上传loading
}
,done: function(res){
//如果上传失败
if(res.code == 'error'){
layer.open({
title: '温馨提示'
,content: res.msg
});
layer.closeAll('loading');
}
else if(res.code == 'success'){
layer.closeAll('loading');
$("#showpic a").attr('href',res.data.url);
$("#showpic img").attr('src',res.data.url);
$("#url").val(res.data.url);
$("#html").val("<img src = '" + res.data.url + "' />");
$("#markdown").val("![](" + res.data.url + ")");
$("#bbcode").val("[img]" + res.data.url + "[/img]");
$("#upok").show();
$.post("./functions/sm.php",{data:res.data},function(data,status){
});
}
}
});
//上传到sm.ms end
}); });
//复制链接 //复制链接
@ -69,6 +106,25 @@ function copy(info){
layer.msg('复制成功!', {time: 2000}) layer.msg('复制成功!', {time: 2000})
}); });
} }
//后台复制URL
function copyurl(url){
var copy = new clipBoard(document.getElementById('adminpic'), {
beforeCopy: function() {
},
copy: function() {
return url;
},
afterCopy: function() {
}
});
layui.use('layer', function(){
var layer = layui.layer;
layer.msg('链接已复制!', {time: 2000})
});
}
//用户登录方法 //用户登录方法
function login(){ function login(){
@ -128,6 +184,39 @@ function adminshow(imgurl,id){
}); });
} }
//后台管理员查看SM.MS图片
function smshow(imgurl,id){
var showimg = "<center><img style = 'max-width:100%;max-height:100%;' src = '" + imgurl + "' /></center>";
layui.use('layer', function(){
var layer = layui.layer;
layer.open({
type: 1,
title:"图片预览",
area: ['80%', '80%'],
content: showimg,
btn: ['压缩', '删除'],
yes: function(index, layero){
layer.msg('SM.MS图片不支持压缩!', {time: 2000})
}
//删除按钮
,btn2: function(index, layero){
layer.confirm('确认删除?', {icon: 3, title:'温馨提示!'}, function(index){
$.get("./delete.php?type=sm&id="+id,function(data,status){
if(data == 'ok') {
$("#imgid"+id).remove();
}
else{
alert(data);
}
});
layer.close(index);
});
}
});
});
}
//删除某张图片 //删除某张图片
function deleteimg(id){ function deleteimg(id){
layer.confirm('确认删除?', {icon: 3, title:'温馨提示!'}, function(index){ layer.confirm('确认删除?', {icon: 3, title:'温馨提示!'}, function(index){
@ -143,6 +232,21 @@ function deleteimg(id){
layer.close(index); layer.close(index);
}); });
} }
//删除SM.MS图片
function deletesm(id){
layer.confirm('确认删除?', {icon: 3, title:'温馨提示!'}, function(index){
$.get("./delete.php?type=sm&id="+id,function(data,status){
if(data == 'ok') {
$("#imgid"+id).remove();
}
else{
alert(data);
}
});
layer.close(index);
});
}
//取消图片可疑状态 //取消图片可疑状态
function cdubious(id){ function cdubious(id){

43
static/style.css

@ -34,7 +34,7 @@
margin-left:auto; margin-left:auto;
margin-right:auto; margin-right:auto;
margin-top:4em; margin-top:2em;
width:94.6%; width:94.6%;
left:0%; left:0%;
background-color:#F9F9F9; background-color:#F9F9F9;
@ -76,7 +76,7 @@
margin-right:auto; margin-right:auto;
} }
.msg{ .msg{
width:100%; /* width:100%; */
background-color:#f2f2f2; background-color:#f2f2f2;
line-height: 1em; line-height: 1em;
padding:12px; padding:12px;
@ -120,3 +120,42 @@
margin-top:1em; margin-top:1em;
margin-bottom:1em; margin-bottom:1em;
} }
.smfile{
width:100%;
height:188px;
border: 1px dashed #e2e2e2;
margin-top:2em;
}
.smfile .file {
position: relative;
display: inline-block;
/* background: #D0EEFF; */
/* border: 1px solid #99D3F5;
border-radius: 4px;
padding: 4px 12px; */
overflow: hidden;
color: #009688;
text-decoration: none;
text-indent: 0;
line-height: 188px;
display: block;
height: 100%;
text-align: center;
margin-left:auto;
margin-right:auto;
background-color: #F9F9F9;
}
.smfile .file input {
position: absolute;
font-size: 100px;
right: 0;
top: 0;
opacity: 0;
}
.smfile .file:hover {
/* background: #AADFFD;
border-color: #78C3F3; */
color:#009688;
text-decoration: none;
}

2
tpl/admin/footer.php

@ -13,6 +13,6 @@
<script src="https://cdn.bootcss.com/jquery/2.2.4/jquery.min.js"></script> <script src="https://cdn.bootcss.com/jquery/2.2.4/jquery.min.js"></script>
<script src="../static/layui/layui.js"></script> <script src="../static/layui/layui.js"></script>
<script src="../static/embed.js?v=1.0.1"></script> <script src="../static/embed.js?v=1.1"></script>
</body> </body>
</html> </html>

2
tpl/admin/header.php

@ -11,7 +11,7 @@
<link rel="shortcut icon" href="../favicon.ico" type="image/x-icon" /> <link rel="shortcut icon" href="../favicon.ico" type="image/x-icon" />
<link rel="Bookmark" href="../favicon.ico" /> <link rel="Bookmark" href="../favicon.ico" />
<link rel="stylesheet" href="../static/layui/css/layui.css"> <link rel="stylesheet" href="../static/layui/css/layui.css">
<link rel="stylesheet" href="../static/style.css?v=1.0"> <link rel="stylesheet" href="../static/style.css?v=1.1">
<script src = "https://libs.xiaoz.top/clipBoard.js/clipBoard.min.js"></script> <script src = "https://libs.xiaoz.top/clipBoard.js/clipBoard.min.js"></script>
</head> </head>
<body> <body>

7
tpl/admin/left.php

@ -17,6 +17,13 @@
<dd><a href="senioradmin.php?type=dubious&page=1">可疑图片</a></dd> <dd><a href="senioradmin.php?type=dubious&page=1">可疑图片</a></dd>
</dl> </dl>
</li> </li>
<li class="layui-nav-item layui-nav-itemed">
<a href="javascript:;">SM.MS管理<span class="layui-nav-more"></span></a>
<dl class="layui-nav-child">
<dd><a href="smadmin.php?type=preview&page=1">预览模式</a></dd>
<dd><a href="smadmin.php?type=admin&page=1">管理模式</a></dd>
</dl>
</li>
<li class="layui-nav-item layui-nav-itemed"> <li class="layui-nav-item layui-nav-itemed">
<a href="javascript:;">系统设置<span class="layui-nav-more"></span></a> <a href="javascript:;">系统设置<span class="layui-nav-more"></span></a>
<dl class="layui-nav-child"> <dl class="layui-nav-child">

2
tpl/user/footer.php

@ -18,6 +18,6 @@
<!-- 底部END --> <!-- 底部END -->
<script src="https://cdn.bootcss.com/jquery/2.2.4/jquery.min.js"></script> <script src="https://cdn.bootcss.com/jquery/2.2.4/jquery.min.js"></script>
<script src="./static/layui/layui.js"></script> <script src="./static/layui/layui.js"></script>
<script src="./static/embed.js?v=1.0"></script> <script src="./static/embed.js?v=1.1"></script>
</body> </body>
</html> </html>

3
tpl/user/header.php

@ -12,7 +12,7 @@
<link rel="shortcut icon" href="favicon.ico" type="image/x-icon" /> <link rel="shortcut icon" href="favicon.ico" type="image/x-icon" />
<link rel="Bookmark" href="favicon.ico" /> <link rel="Bookmark" href="favicon.ico" />
<link rel="stylesheet" href="./static/layui/css/layui.css"> <link rel="stylesheet" href="./static/layui/css/layui.css">
<link rel="stylesheet" href="./static/style.css?v=1.0"> <link rel="stylesheet" href="./static/style.css?v=1.1">
<script src = "https://libs.xiaoz.top/clipBoard.js/clipBoard.min.js"></script> <script src = "https://libs.xiaoz.top/clipBoard.js/clipBoard.min.js"></script>
</head> </head>
<body> <body>
@ -26,6 +26,7 @@
<ul class="layui-nav menu" lay-filter=""> <ul class="layui-nav menu" lay-filter="">
<li class="layui-nav-item"><a href="./"><i class="layui-icon">&#xe68e;</i> 首页</a></li> <li class="layui-nav-item"><a href="./"><i class="layui-icon">&#xe68e;</i> 首页</a></li>
<li class="layui-nav-item"><a href="found.php"><i class="layui-icon">&#xe60d;</i> 探索发现</a></li> <li class="layui-nav-item"><a href="found.php"><i class="layui-icon">&#xe60d;</i> 探索发现</a></li>
<li class="layui-nav-item"><a href="sm.php"><i class="layui-icon">&#xe681;</i> SM.MS</a></li>
<li class="layui-nav-item"><a href="https://doc.xiaoz.me/docs/imgurl" target = "_blank" rel = "nofollow"><i class="layui-icon">&#xe705;</i> 帮助文档</a></li> <li class="layui-nav-item"><a href="https://doc.xiaoz.me/docs/imgurl" target = "_blank" rel = "nofollow"><i class="layui-icon">&#xe705;</i> 帮助文档</a></li>
<li class="layui-nav-item"><a href="https://github.com/helloxz/imgurl" target = "_blank" rel = "nofollow"><i class="layui-icon">&#xe857;</i> 源码</a></li> <li class="layui-nav-item"><a href="https://github.com/helloxz/imgurl" target = "_blank" rel = "nofollow"><i class="layui-icon">&#xe857;</i> 源码</a></li>
<li class="layui-nav-item"><a href="about.php"><i class="layui-icon">&#xe60b;</i> 关于</a></li> <li class="layui-nav-item"><a href="about.php"><i class="layui-icon">&#xe60b;</i> 关于</a></li>

40
upgrade.php

@ -0,0 +1,40 @@
<?php
//载入配置文件
include_once("./config.php");
//获取要升级的版本
$v = $_GET['v'];
//如果版本为空或不存在
if(($v == '') || (!isset($v))) {
echo '版本号错误!';
exit;
}
//判断版本号
switch ( $v )
{
case "1.1":
//增加表
$sql = 'CREATE TABLE "main"."sm" (
"id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
"ip" TEXT NOT NULL,
"ua" TEXT NOT NULL,
"date" TEXT NOT NULL,
"url" TEXT NOT NULL,
"delete" TEXT NOT NULL,
CONSTRAINT "delete" UNIQUE ("delete")
)
;'; $data = $database->query($sql);
if($data) {
echo '数据表创建成功!';
}
else{
echo '数据表创建失败,可能是数据库不可写或已经升级过!';
}
break;
default:
echo '未知的版本号!';
exit;
break;
}
?>
Loading…
Cancel
Save