xiaoz 7 years ago
parent
commit
4aa01400b6
  1. 4
      about.php
  2. BIN
      data/imgurl.db3
  3. 4
      explore.php
  4. 92
      found.php
  5. 4
      index.php
  6. 4
      login.php
  7. 4
      pro.php
  8. 1509
      sdk/Medoo.php
  9. BIN
      temp/1801/8a63cf6dfbe8d8ab.png
  10. BIN
      temp/1801/9d3f64bc1050ec0b.jpg
  11. 12
      tpl/footer.php
  12. 73
      tpl/header.php
  13. 29
      upload.php

4
about.php

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
<?php
include_once('header.php');
include_once('tpl/header.php');
?>
<div class="container" style = "margin-top:40px;">
<div class="row">
@ -30,5 +30,5 @@ @@ -30,5 +30,5 @@
</div>
</div>
<?php
include_once('footer.php');
include_once('tpl/footer.php');
?>

BIN
data/imgurl.db3

Binary file not shown.

4
explore.php

@ -3,7 +3,7 @@ @@ -3,7 +3,7 @@
//载入配置
include_once('./config.php');
//载入header
include_once('./header.php');
include_once('tpl/header.php');
//获取页数
$page = $_GET['page'];
@ -150,5 +150,5 @@ @@ -150,5 +150,5 @@
<?php
//载入页脚
include_once('./footer.php');
include_once('tpl/footer.php');
?>

92
found.php

@ -0,0 +1,92 @@ @@ -0,0 +1,92 @@
<?php
error_reporting(E_ALL^E_NOTICE^E_WARNING^E_DEPRECATED);
//载入配置
include_once('./config.php');
//载入header
include_once('tpl/header.php');
require_once( 'sdk/Medoo.php' );
use Medoo\Medoo;
$database = new medoo([
'database_type' => 'sqlite',
'database_file' => 'data/imgurl.db3'
]);
$datas = $database->select("uploads",[
"id",
"dir"
],[
"ORDER" => "random()",
"LIMIT" => 10
]);
//print_r($datas);
?>
<div class="container" style = "margin-top:40px;">
<div class="row">
<div class="col-lg-10 col-md-offset-1">
<!--图片预览-->
<div class="col-lg-6">
<img id = "viewid" src="./static/view.jpg" class="img-thumbnail img-responsive">
</div>
<!--图片预览END-->
<div class="col-lg-6">
<table class="table table-striped">
<tbody>
<?php
for($i = 0;$i < 10;$i++) {
//如果文件是空的,则终止循环
$imgdir = $datas[$i]['dir'];
?>
<tr id = "row<?php echo $i; ?>">
<td onmouseover = "return view('<?php echo $config['domain'].$imgdir ?>');">
<?php
echo "<a href = "."'".$config['domain'].$imgdir."' target = '_blank'>"."$imgdir</a>";
?>
</td>
<td>
<?php
if(isset($_COOKIE['uid'])) {
echo "<a href = \"javascript:;\" onclick = \"del('$fname[$i]',$i);\">删除</a>";
}
?>
</td>
</tr>
<?php } ?>
</tbody>
</table>
</div>
</div>
</div>
</div>
<script>
function view(imgurl) {
$("#viewid").src;
$("#viewid").attr('src',imgurl);
}
//删除图片
function del(filedir,rowid) {
//行id
var rowid = 'row' + rowid;
//确认删除?
var msg = "确认删除?";
if (confirm(msg)==true){
$.get("./functions.php?type=delete&dir="+filedir,function(data,status){
//删除成功
if(data == 'ok') {
$("#"+rowid).remove();
}
else{
alert(data); //删除失败,弹出报错
}
});
}else{
return false;
}
}
</script>
<?php
//载入页脚
include_once('tpl/footer.php');
?>

4
index.php

@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
<?php
//载入header
include_once('./header.php');
include_once('tpl/header.php');
include_once('./config.php');
?>
<!--是否启用鉴黄-->
@ -79,5 +79,5 @@ @@ -79,5 +79,5 @@
<!--上传成功END-->
<?php
//载入页脚
include_once('./footer.php');
include_once('tpl/footer.php');
?>

4
login.php

@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
<?php
//载入header
include_once('./header.php');
include_once('tpl/header.php');
?>
<!--登录页面-->
<div class="container" style = "margin-top:40px;">
@ -48,5 +48,5 @@ @@ -48,5 +48,5 @@
<!--登录页面end-->
<?php
//载入页脚
include_once('./footer.php');
include_once('tpl/footer.php');
?>

4
pro.php

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
<?php
include_once('header.php');
include_once('tpl/header.php');
?>
<div class="container" style = "margin-top:40px;">
<div class="row">
@ -17,5 +17,5 @@ @@ -17,5 +17,5 @@
</div>
</div>
<?php
include_once('footer.php');
include_once('tpl/footer.php');
?>

1509
sdk/Medoo.php

File diff suppressed because it is too large Load Diff

BIN
temp/1801/8a63cf6dfbe8d8ab.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 67 KiB

BIN
temp/1801/9d3f64bc1050ec0b.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 224 KiB

12
tpl/footer.php

@ -0,0 +1,12 @@ @@ -0,0 +1,12 @@
<!--页脚-->
<div id = "footer">
<div class="container">
<div class="row">
<!--这是一个开源免费的作品,请为她保留版权-->
<div class="col-lg-10 col-md-offset-1">Copyright Ⓒ 2017 Powered by <a href="https://github.com/helloxz/imgurl" title = "ImgURL" target = "_blank" rel = "nofollow">ImgURL</a>. Author: <a href="https://www.xiaoz.me/" title = "小z博客" target = "_blank">xiaoz.me</a>. 请勿上传违反中国大陆法律的图片,违者后果自负。</div>
</div>
</div>
</div>
</body>
</html>

73
tpl/header.php

@ -0,0 +1,73 @@ @@ -0,0 +1,73 @@
<!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="xiaoz.me" />
<meta name="keywords" content="ImgURL,免费图床,图床程序,小z图床,XZ Pic" />
<meta name="description" content="ImgURL是一个简单、纯粹的图床程序,让个人图床多一个选择。" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="shortcut icon" href="favicon.ico" type="image/x-icon" />
<link rel="Bookmark" href="favicon.ico" />
<link href="https://cdn.bootcss.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">
<link href="./static/uploadfile.css" rel="stylesheet">
<link href="./static/style.css" rel="stylesheet">
<script src="https://cdn.bootcss.com/jquery/2.2.4/jquery.min.js"></script>
<script src="https://cdn.bootcss.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<script src="./static/jquery.uploadfile.min.js"></script>
<script src = "https://libs.xiaoz.top/clipBoard.js/clipBoard.min.js"></script>
<script src = "./static/embed.js"></script>
</head>
<body>
<div id="msg">
<div class = "msg">复制成功!</div>
</div>
<div id = "loading"><center><img src="./static/ajax-load.gif" alt="" class = "img-responsive center-block"></center></div>
<!--导航栏-->
<div id="menu">
<div class="container">
<div class="row">
<div class="col-lg-10 col-md-offset-1">
<nav class="navbar navbar-inverse" role="navigation">
<div class="container-fluid">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse"
data-target="#example-navbar-collapse">
<span class="sr-only">切换导航</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="./index.php">ImgURL</a>
</div>
<div class="collapse navbar-collapse" id="example-navbar-collapse">
<ul class="nav navbar-nav">
<li><a href="./explore.php">探索发现</a></li>
<li><a href="./pro.php">捐赠版</a></li>
<li><a href="https://wiki.xiaoz.me/docs/imgurl/" rel = "nofollow" target = "_blank">帮助文档</a></li>
<li><a href="./about.php">关于</a></li>
</ul>
<ul class="nav navbar-nav navbar-right">
<?php
if(isset($_COOKIE['uid'])) {
include_once('./config.php');
$mydir = $config['admindir'];
echo "<li><a href='./recycle.php'>回收站</a></li>";
echo "<li><a href='./explore.php?dir=$mydir'>管理员</a></li>";
echo "<li><a href='./functions.php?type=logout'>退出</a></li>";
}
else {
echo "<li><a href='./login.php'>登录</a></li>";
}
?>
</ul>
</div>
</div>
</nav>
</div>
</div>
</div>
</div>
<!--导航栏END-->

29
upload.php

@ -1,6 +1,21 @@ @@ -1,6 +1,21 @@
<?php
error_reporting(E_ALL^E_NOTICE^E_WARNING^E_DEPRECATED);
include_once('./config.php');
require_once( 'sdk/Medoo.php' );
use Medoo\Medoo;
$database = new medoo([
'database_type' => 'sqlite',
'database_file' => 'data/imgurl.db3'
]);
//用户IP
$ip = $_SERVER["REMOTE_ADDR"];
//获取当前时间
$thetime = date('Y-m-d H:i:s',time());
//获取浏览器信息
$ua = $_SERVER['HTTP_USER_AGENT'];
//验证用户,并设置上传目录
$dir = check($_COOKIE['uid'],$config['username'],$config['password'],$config['userdir'],$config['admindir']);
@ -87,9 +102,17 @@ @@ -87,9 +102,17 @@
$img_width = $img_info['0']; //图片宽度
$img_height = $img_info['1']; //图片高度
$re_data = array("linkurl" => $img_url,width => $img_width,"height" => $img_height,"status" => 'ok');
//返回json格式
echo json_encode($re_data);
exit;
$last_id = $database->insert("uploads",["dir" => $dir_name,"date" => $thetime,"ip" => $ip,"method" => $ua]);
//写入成功
if($last_id) {
//返回json格式
echo json_encode($re_data);
exit;
}
else{
echo "写入数据库失败!";
}
}
//没有上传成功
else{

Loading…
Cancel
Save