Browse Source

清空

pull/5/head
xiaoz 6 years ago
parent
commit
5ea88507b3
  1. 201
      LICENSE
  2. 29
      README.md
  3. 34
      about.php
  4. 13
      admin/index.php
  5. 77
      admin/pics.php
  6. 17
      api/PublicClass.php
  7. 38
      api/delete.php
  8. 3
      api/functions.php
  9. 30
      config.php
  10. BIN
      data/imgurl.db3
  11. 154
      explore.php
  12. BIN
      favicon.ico
  13. 95
      found.php
  14. 94
      functions.php
  15. 44
      import.php
  16. 83
      index.php
  17. 52
      login.php
  18. 21
      pro.php
  19. 102
      recycle.php
  20. 5
      recycle/.htaccess
  21. 7
      robots.txt
  22. 1509
      sdk/Medoo.php
  23. 96
      sdk/tinypng/Tinify.php
  24. 160
      sdk/tinypng/Tinify/Client.php
  25. 36
      sdk/tinypng/Tinify/Exception.php
  26. 36
      sdk/tinypng/Tinify/Result.php
  27. 23
      sdk/tinypng/Tinify/ResultMeta.php
  28. 69
      sdk/tinypng/Tinify/Source.php
  29. 3550
      sdk/tinypng/data/cacert.pem
  30. 48
      sdk/wxyt/QcloudImage/Auth.php
  31. 1258
      sdk/wxyt/QcloudImage/CIClient.php
  32. 46
      sdk/wxyt/QcloudImage/Conf.php
  33. 28
      sdk/wxyt/QcloudImage/Error.php
  34. 108
      sdk/wxyt/QcloudImage/HttpClient.php
  35. 224
      sdk/wxyt/README.md
  36. 11
      sdk/wxyt/autoload.php
  37. 3
      sdk/wxyt/index.php
  38. 150
      sdk/wxyt/sample.php
  39. 42
      static/admin.css
  40. 86
      static/style.css
  41. 19
      tpl/admin/footer.php
  42. 76
      tpl/admin/header.php
  43. 0
      tpl/admin/left.php
  44. 73
      tpl/header.php
  45. 147
      upload.php

201
LICENSE

@ -1,201 +0,0 @@ @@ -1,201 +0,0 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

29
README.md

@ -1,29 +0,0 @@ @@ -1,29 +0,0 @@
# ImgURL
ImgURL是一个简单、纯粹的图床程序,使用PHP脚本开发,不需要数据库支持,也没有复杂的配置。
### 环境要求
* PHP >= 5.6
* 需要exif函数支持
### 开发计划
- [x] 图片上传与预览
- [x] 一键生成链接
- [x] 浏览与删除图片
- [x] 图片压缩
- [x] 图片鉴黄
- [ ] 图片水印
- [ ] 多图上传
- [ ] API上传
### 安装
<p>访问:<a href="https://github.com/helloxz/imgurl/archive/master.zip" target = "_blank" rel = "nofollow">master.zip</a>下载最新版ImgURL程序,放到您的站点根目录并解压。修改一下<code>config.php</code>设置你自己的域名和密码,访问<code>http(s)://domain.com/</code>即可,就是这么简单。</p>
### 演示
Demo:[http://imgurl.org/](http://imgurl.org/)
![](https://i.bk.tn/uploads/1712/230615302734.png)
### 联系我
* Blog:[https://www.xiaoz.me/](https://www.xiaoz.me/)
* QQ:337003006

34
about.php

@ -1,34 +0,0 @@ @@ -1,34 +0,0 @@
<?php
include_once('tpl/header.php');
?>
<div class="container" style = "margin-top:40px;">
<div class="row">
<div class="col-lg-10 col-md-offset-1">
<h1>ImgURL</h1>
<p>ImgURL是一个简洁、纯粹的图床程序,使用PHP开发,不需要数据库支持,也没有复杂的配置。</p>
<p>没有永久免费的午餐,也没用永久免费的图床,ImgURL无法保障永久存储您的图片,但有了ImgURL让图床多了一个选择,我坚信只有图片掌握在自己手中才更安全。</p>
<h3>功能与特色</h3>
<ul>
<li>拽拖上传图片、实时预览</li>
<li>一键生成链接,一键复制</li>
<li>基本图片管理</li>
<li>TinyPNG图片压缩</li>
<li>图片智能鉴黄</li>
</ul>
<h3>安装</h3>
<p>访问:<a href="https://github.com/helloxz/imgurl/archive/master.zip" target = "_blank" rel = "nofollow">master.zip</a>下载最新版ImgURL程序,放到您的站点根目录并解压。修改一下<code>config.php</code>设置你自己的域名和密码,访问<code>http(s)://domain.com/</code>即可,就是这么简单。</p>
<h3>说明</h3>
<p><code>imgurl.org</code>虽然提供图片上传,但仅作为演示使用,游客上传的图片随时可能被删除,因此推荐您下载ImgURL自行部署。</p>
<p>ImgURL是一个开源免费的个人项目,请勿将ImgURL用于商业用途,未经授权也不要去除底部版权。</p>
<p><b>项目地址:</b><a href = "https://github.com/helloxz/imgurl" target = "_blank" rel = "nofollow">https://github.com/helloxz/imgurl</a></p>
<h3>联系我</h3>
<ul>
<li>Blog:<a href = "https://www.xiaoz.me/" target = "_blank">https://www.xiaoz.me/</a></li>
<li>QQ:337003006</li>
</ul>
</div>
</div>
</div>
<?php
include_once('tpl/footer.php');
?>

13
admin/index.php

@ -1,13 +0,0 @@ @@ -1,13 +0,0 @@
<?php
include_once('../tpl/admin/header.php');
?>
<!--内容区域-->
<div class="layui-col-lg9" id = "showpic">
<table class = "layui-table">
</table>
</div>
<!--内容区域END-->
<?php
include_once('../tpl/admin/footer.php');
?>

77
admin/pics.php

@ -1,77 +0,0 @@ @@ -1,77 +0,0 @@
<?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 id = "row<?php echo $listpic[$i]['id']; ?>">
<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(<?php echo $listpic[$i]['id']; ?>);">删除</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(id){
var msg = "确认删除?";
var id = id;
if (confirm(msg)==true){
$.get("../api/delete.php?id="+id,function(data,status){
//删除成功
if(data == 'ok') {
$("#row"+id).remove();
}
else{
alert(data); //删除失败,弹出报错
}
});
}else{
return false;
}
}
</script>

17
api/PublicClass.php

@ -1,17 +0,0 @@ @@ -1,17 +0,0 @@
<?php
include_once("../config.php");
class LgoinStatus {
var $uid = $_COOKIE['uid'];
var $login = md5($config['username'].$config['password']);
function status(){
$uid = $this->uid;
$loginid = $this->login;
if($uid != $loginid) {
return false;
echo '权限不足';
exit;
}
}
}
?>

38
api/delete.php

@ -1,38 +0,0 @@ @@ -1,38 +0,0 @@
<?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;
}
//图片ID
$id = $_GET['id'];
$imginfo = $database->get("uploads",["id","dir"],["id" => $id]);
//如果查询到了ID
if($imginfo) {
//如果文件删除成功
if(unlink("../".$imginfo['dir'])) {
//删除数据库记录
$delinfo = $database->delete("uploads",["id" => $id]);
if($delinfo) {
echo 'ok';
}
else{
echo '数据库删除失败';
exit;
}
}
else{
echo '删除失败,可能是文件不存在';
}
}
else {
echo 'ID不存在';
exit;
}
?>

3
api/functions.php

@ -1,3 +0,0 @@ @@ -1,3 +0,0 @@
<?php
?>

30
config.php

@ -1,30 +0,0 @@ @@ -1,30 +0,0 @@
<?php
$App = getcwd();
$App = str_replace('admin','',$App);
$App = str_replace('api','',$App);
require_once( 'sdk/Medoo.php' );
use Medoo\Medoo;
//echo $App;
$database = new medoo([
'database_type' => 'sqlite',
'database_file' => $App.'/data/imgurl.db3'
]);
$config = array(
'domain' => 'http://localhost/imgurl/', //网站域名
'watermark' => 'false', //文字水印
'userdir' => 'temp', //访客上传目录,一般保持默认
'admindir' => 'upload', //管理员上传目录,一般保持默认
'username' => 'xiaoz', //管理员账号
'password' => 'xiaoz.me', //管理员密码
'tinypng' => '' //使用TinyPNG压缩图片,填写TinyPNG KEY,为空则不启用压缩
);
//是否启用腾讯万象优图鉴黄识别
$identify = array(
'eroticism' => false, //如果此项为true则下面必须填写,请参考帮助文档。
'APP_ID' => '',
'SECRET_ID' => '',
'SECRET_KEY' => '',
'BUCKET' => ''
)
?>

BIN
data/imgurl.db3

Binary file not shown.

154
explore.php

@ -1,154 +0,0 @@ @@ -1,154 +0,0 @@
<?php
error_reporting(E_ALL^E_NOTICE^E_WARNING^E_DEPRECATED);
//载入配置
include_once('./config.php');
//载入header
include_once('tpl/header.php');
//获取页数
$page = $_GET['page'];
$current_time = date('ym',time()); //当前月份
$time = $_GET['time'];
$mydir = $_GET['dir'];
//时间不存在,用当前时间
if(!isset($time)) {
$time = $current_time;
}
//目录不存在,使用普通用户目录
if(!isset($mydir)) {
$mydir = $config['userdir'];
}
//目录存在,但是既不是用户目录也不是管理员目录
if(($mydir != $config['userdir']) && ($mydir != $config['admindir'])) {
$mydir = $config['userdir'];
}
//目录存在,并且是管理员目录
if($mydir == $config['admindir']) {
$mydir = $config['admindir'];
//改变下管理员链接地址
$geturl = "&dir=$mydir";
}
//还没有目录
if(!file_exists($mydir."/".$time."/")) {
//echo $mydir."/".$time."/";
echo "<h3 class = 'text-center'>空空如也!</h3>";
exit;
}
?>
<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
function get_files($dir) {
$files = array();
for (; $dir->valid(); $dir->next()) {
if ($dir->isDir() && !$dir->isDot()) {
if ($dir->haschildren()) {
$files = array_merge($files, get_files($dir->getChildren()));
};
}else if($dir->isFile()){
$files[] = $dir->getPathName();
}
}
return $files;
}
//如果页数不存在或者小于1
if((!isset($page)) || ($page <= 1)) {
$page = 1;
$i = 0;
$num = 15;
}
if($page > 1) {
$i = ($page - 1) * 15;
$num = $i + 15;
}
$path = $mydir.'/'.$time;
$dir = new RecursiveDirectoryIterator($path);
$fname = get_files($dir);
$allnum = count($fname) - 1; //文件总数
//echo $allnum;
//最大页数
$allpage = round($allnum / 15,0);
$uppage = $page - 1; //上一页
$downpage = $page + 1; //下一页
$downpage = ($page >= $allpage) ? $page : $downpage;
//echo $allpage;
//如果文件数小于15
//$num = count($allnum < 15) ? $allnum : $num;
if($allnum <= 15) {
$num = $allnum;
}
for($i;$i <= $num;$i++) {
$fname[$i] = str_replace("\\","/",$fname[$i]);
//如果文件是空的,则终止循环
?>
<tr id = "row<?php echo $i; ?>">
<td onmouseover = "return view('<?php echo $config['domain'].$fname[$i] ?>');">
<?php
echo "<a href = "."'".$config['domain'].$fname[$i]."' target = '_blank'>"."$fname[$i]</a>";
?>
</td>
<td>
<?php
if(isset($_COOKIE['uid'])) {
echo "<a href = \"javascript:;\" onclick = \"del('$fname[$i]',$i);\">删除</a>";
}
?>
</td>
</tr>
<?php } ?>
</tbody>
</table>
<a href="?page=<?php echo $uppage.$geturl; ?>" class = "btn btn-primary"><span class = "glyphicon glyphicon-chevron-left"></span> 上一页</a>
<a href="?page=<?php echo $downpage.$geturl; ?>" class = "btn btn-primary">下一页 <span class = "glyphicon glyphicon-chevron-right"></span></a>
</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');
?>

BIN
favicon.ico

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.2 KiB

95
found.php

@ -1,95 +0,0 @@ @@ -1,95 +0,0 @@
<?php
error_reporting(E_ALL^E_NOTICE^E_WARNING^E_DEPRECATED);
//载入配置
include_once('./config.php');
//载入header
include_once('tpl/header.php');
//获取当前时间
$thetime = date('Ym',time());
$query = "SELECT `id`,`dir` FROM `uploads` WHERE (`date` LIKE '%$thetime%') AND 'user' = 'user' ORDER BY random() LIMIT 10";
$datas = $database->query($query)->fetchAll();
//print_r($datas);
//var_dump($datas);
//var_dump( $database->log() );
//$datas = $database->select("uploads",[
// "id",
// "dir"
//],[
// "ORDER" => "random()",
// "LIMIT" => 10,
// "date[~]" => $thetime,
// "user" => 'user'
//]);
//var_dump( $database->log() );
$num = $database->count("uploads",["date[~]" => $thetime]);
//如果图片大于10张
if($num > 10){
$num = 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 < $num;$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>
</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');
?>

94
functions.php

@ -1,94 +0,0 @@ @@ -1,94 +0,0 @@
<?php
error_reporting(E_ALL^E_NOTICE^E_WARNING^E_DEPRECATED);
include_once('./config.php');
$type = $_GET['type']; //获取方法类型
$user = $_POST['user']; //用户名
$pass = $_POST['pass']; //密码
$imgname = $_GET['dir']; //获取图片路径
//用户ID
$userid = md5($config['username'].$config['password']);
//登录ID
$loginid = md5($user.$pass);
//方法判断
switch($type) {
case 'login':
login($userid,$loginid);
break;
case 'logout':
logout();
case 'delete':
$uid = $_COOKIE['uid'];
$loginid = md5($config['username'].$config['password']);
if($loginid == $uid) {
delete($imgname,$config['userdir'],$config['admindir']);
}
else{
echo '请先登录';
}
break;
default:
echo '错误的请求!';
exit;
}
//登录方法
function login($userid,$loginid) {
if($userid == $loginid) {
echo 'ok';
//设置Cookie,保存7天
setcookie(uid, $userid, time()+604800);
exit;
}
else {
echo 'no';
exit;
}
}
//退出
function logout(){
setcookie(uid, "", time() - 3600);
echo '已退出';
header("Location: ./index.php");
exit;
}
//删除
function delete($imgname,$userdir,$admindir) {
//字符串分割
$imgdir = explode("/",$imgname);
//只允许删除用户目录/管理员目录/回收站目录
switch ( $imgdir[0] )
{
case $userdir:
if(unlink($imgname)) {
echo 'ok'; //删除图片成功
}
else {
echo '删除失败,可能是图片不存在。';
}
break;
case $admindir:
if(unlink($imgname)) {
echo 'ok'; //删除图片成功
}
else {
echo '删除失败,可能是图片不存在。';
}
break;
case 'recycle':
if(unlink($imgname)) {
echo 'ok'; //删除图片成功
}
else {
echo '删除失败,可能是图片不存在。';
}
break;
default:
echo '非法操作';
break;
}
}
?>

44
import.php

@ -1,44 +0,0 @@ @@ -1,44 +0,0 @@
<?php
include_once( 'config.php' );
$dir = $_GET['dir'];
$year = $_GET['year'];
$month = $_GET['month'];
$date = $year.$month;
$user = $_GET['user'];
$thedate = '20'.$year.$month.'01';
//echo $thedate;
$dir = $dir.'/'.$date;
//echo $dir;
//exit;
$dir = new RecursiveDirectoryIterator($dir);
$arr = get_files($dir);
//print_r($arr);
$num = count($arr);
echo $num;
for($i=0;$i < $num;$i++){
$add = $database->insert("uploads",["dir" => $arr[$i],"date" => $thedate,"ip" => '127.0.0.1',"method" => 'localhost',"user" => $user]);
echo '导入成功!';
}
echo "共导入".$num;
//遍历目录
function get_files($dir) {
$files = array();
for (; $dir->valid(); $dir->next()) {
if ($dir->isDir() && !$dir->isDot()) {
if ($dir->haschildren()) {
$files = array_merge($files, get_files($dir->getChildren()));
};
}else if($dir->isFile()){
$files[] = $dir->getPathName();
}
}
return $files;
}
?>

83
index.php

@ -1,83 +0,0 @@ @@ -1,83 +0,0 @@
<?php
//载入header
include_once('tpl/header.php');
include_once('./config.php');
?>
<!--是否启用鉴黄-->
<?php
//如果启用鉴黄
if($identify['eroticism'] == true) {
$eroticism = 1;
}
else{
$eroticism = 0;
}
//判断启用图片压缩
switch ( $config['tinypng'] )
{
//为空,没启用
case '':
$tinypng = 0;
break;
default:
$tinypng = 1;
break;
}
?>
<div id="eroticism" style = "display: none;"><?php echo $eroticism; ?></div>
<!--是否启用鉴黄END-->
<!--是否启用图片压缩-->
<div id="tinypng" style = "display: none;"><?php echo $tinypng; ?></div>
<!--是否启用图片压缩END-->
<div style = "clear:both;"></div>
<div class="container" style = "margin-bottom:40px;">
<div class="row">
<div class="col-lg-10 col-md-offset-1">
<div id="fileuploader">Upload</div>
</div>
</div>
</div>
<!--上传成功后-->
<div class="container" style = "margin-bottom:40px;">
<div class="row">
<div class="col-lg-10 col-md-offset-1">
<!--显示-->
<div class="table-responsive" id = "relink">
<table class="table">
<tbody>
<tr>
<td width = "15%">URL</td>
<td width = "75%"><input type="text" id = "linkurl" class="form-control"></td>
<td width = "10%"><a href="javascript:;" class="btn btn-info" onclick = "copy('linkurl');">复制</a></td>
</tr>
<tr>
<td>HTML</td>
<td><input type="text" id = "htmlurl" class="form-control"></td>
<td><a href="javascript:;" class="btn btn-info" onclick = "copy('htmlurl');">复制</a></td>
</tr>
<tr>
<td>MarkDown</td>
<td><input type="text" id = "mdurl" class="form-control"></td>
<td><a href="javascript:;" class="btn btn-info" onclick = "copy('mdurl');">复制</a></td>
</tr>
<tr>
<td>BBcode</td>
<td><input type="text" id = "bbcode" class="form-control"></td>
<td><a href="javascript:;" class="btn btn-info" onclick = "copy('bbcode');">复制</a></td>
</tr>
</tbody>
</table>
<div id = "img-box">
<a href="" id = "img-url" target = "_blank"><img id = "show_img" src="" alt="" class = "img-responsive center-block img-thumbnail"></a>
</div>
</div>
<!--显示-->
</div>
</div>
</div>
<!--上传成功END-->
<?php
//载入页脚
include_once('tpl/footer.php');
?>

52
login.php

@ -1,52 +0,0 @@ @@ -1,52 +0,0 @@
<?php
//载入header
include_once('tpl/header.php');
?>
<!--登录页面-->
<div class="container" style = "margin-top:40px;">
<div class="row">
<div class="col-lg-6 col-md-offset-3">
<form class="form-horizontal" role="form" method = "post">
<div class="form-group">
<label class="col-sm-2 control-label">用户名</label>
<div class="col-sm-10">
<input type="text" class="form-control" id = "user">
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">密 码</label>
<div class="col-sm-10">
<input type="password" class="form-control" id="pass">
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<button type="button" class="btn btn-default" id = "login">登 录</button> <label for="" id = "loading" style = "color:#3E9827;display:none;">注册中...</label>
</div>
</div>
</form>
</div>
</div>
</div>
<script>
$(document).ready(function(){
$("#login").click(function(){
var user = $("#user").val();
var pass = $("#pass").val();
$.post("./functions.php?type=login",{user:user,pass:pass},function(data,status){
if(data == 'ok') {
window.location.href = "./index.php";
}
else{
alert('用户名或密码不对');
}
});
});
});
</script>
<!--登录页面end-->
<?php
//载入页脚
include_once('tpl/footer.php');
?>

21
pro.php

@ -1,21 +0,0 @@ @@ -1,21 +0,0 @@
<?php
include_once('tpl/header.php');
?>
<div class="container" style = "margin-top:40px;">
<div class="row">
<div class="col-lg-10 col-md-offset-1">
<h1>捐赠版</h1>
<p>ImgURL普通版和捐赠版功能上没有任何区别,不过您可以请作者喝一杯咖啡或吃一顿午餐即可获得捐赠版。可扫描下方二维码获取,留言请填写自己的网址。</p>
<p><img src="https://imgurl.org/upload/1712/cb349aa4a1b95997.png" alt="" width="260" height="309" class="alignnone size-full wp-image-9144" /></p>
<h3>技术支持</h3>
<p>获得捐赠版的童鞋,可以去除底部版权,可提供首次安装及调试。(但不提供代码再次开发)</p>
<ul>
<li>Blog:<a href = "https://www.xiaoz.me/" target = "_blank">https://www.xiaoz.me/</a></li>
<li>QQ:337003006</li>
</ul>
</div>
</div>
</div>
<?php
include_once('tpl/footer.php');
?>

102
recycle.php

@ -1,102 +0,0 @@ @@ -1,102 +0,0 @@
<?php
error_reporting(E_ALL^E_NOTICE^E_WARNING^E_DEPRECATED);
//载入配置
include_once('./config.php');
//载入header
include_once('tpl/header.php');
//权限判断
$id = md5($config['username'].$config['password']);
$uid = $_COOKIE['uid'];
if($id != $uid) {
echo "<h3 class = 'text-center'>权限不足</h3>";
exit;
}
?>
<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
function get_files($dir) {
$files = array();
for (; $dir->valid(); $dir->next()) {
if ($dir->isDir() && !$dir->isDot()) {
if ($dir->haschildren()) {
$files = array_merge($files, get_files($dir->getChildren()));
};
}else if($dir->isFile()){
$files[] = $dir->getPathName();
}
}
return $files;
}
$path = 'recycle';
$dir = new RecursiveDirectoryIterator($path);
$fname = get_files($dir);
$num = count($fname) - 1;
for($i = 0;$i <= $num;$i++) {
$fname[$i] = str_replace("\\","/",$fname[$i]);
//如果文件是空的,则终止循环
?>
<tr id = "row<?php echo $i; ?>">
<td onmouseover = "return view('<?php echo $config['domain'].$fname[$i] ?>');">
<?php
echo "<a href = "."'".$config['domain'].$fname[$i]."' target = '_blank'>"."$fname[$i]</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');
?>

5
recycle/.htaccess

@ -1,5 +0,0 @@ @@ -1,5 +0,0 @@
<IfModule mod_rewrite.c>
RewriteEngine On
order allow,deny
deny from all
</IfModule>

7
robots.txt

@ -1,7 +0,0 @@ @@ -1,7 +0,0 @@
User-Agent: *
Disallow: /recycle/
Disallow: /sdk/
Disallow: /api/
Disallow: /temp/
Disallow: /upload/
Disallow: /static/

1509
sdk/Medoo.php

File diff suppressed because it is too large Load Diff

96
sdk/tinypng/Tinify.php

@ -1,96 +0,0 @@ @@ -1,96 +0,0 @@
<?php
namespace Tinify;
const VERSION = "1.5.2";
class Tinify {
private static $key = NULL;
private static $appIdentifier = NULL;
private static $proxy = NULL;
private static $compressionCount = NULL;
private static $client = NULL;
public static function setKey($key) {
self::$key = $key;
self::$client = NULL;
}
public static function setAppIdentifier($appIdentifier) {
self::$appIdentifier = $appIdentifier;
self::$client = NULL;
}
public static function setProxy($proxy) {
self::$proxy = $proxy;
self::$client = NULL;
}
public static function getCompressionCount() {
return self::$compressionCount;
}
public static function setCompressionCount($compressionCount) {
self::$compressionCount = $compressionCount;
}
public static function getClient() {
if (!self::$key) {
throw new AccountException("Provide an API key with Tinify\setKey(...)");
}
if (!self::$client) {
self::$client = new Client(self::$key, self::$appIdentifier, self::$proxy);
}
return self::$client;
}
public static function setClient($client) {
self::$client = $client;
}
}
function setKey($key) {
return Tinify::setKey($key);
}
function setAppIdentifier($appIdentifier) {
return Tinify::setAppIdentifier($appIdentifier);
}
function setProxy($proxy) {
return Tinify::setProxy($proxy);
}
function getCompressionCount() {
return Tinify::getCompressionCount();
}
function compressionCount() {
return Tinify::getCompressionCount();
}
function fromFile($path) {
return Source::fromFile($path);
}
function fromBuffer($string) {
return Source::fromBuffer($string);
}
function fromUrl($string) {
return Source::fromUrl($string);
}
function validate() {
try {
Tinify::getClient()->request("post", "/shrink");
} catch (AccountException $err) {
if ($err->status == 429) return true;
throw $err;
} catch (ClientException $err) {
return true;
}
}

160
sdk/tinypng/Tinify/Client.php

@ -1,160 +0,0 @@ @@ -1,160 +0,0 @@
<?php
namespace Tinify;
class Client {
const API_ENDPOINT = "https://api.tinify.com";
const RETRY_COUNT = 1;
const RETRY_DELAY = 500;
private $options;
public static function userAgent() {
$curl = curl_version();
return "Tinify/" . VERSION . " PHP/" . PHP_VERSION . " curl/" . $curl["version"];
}
private static function caBundle() {
return __DIR__ . "/../data/cacert.pem";
}
function __construct($key, $app_identifier = NULL, $proxy = NULL) {
$curl = curl_version();
if (!($curl["features"] & CURL_VERSION_SSL)) {
throw new ClientException("Your curl version does not support secure connections");
}
if ($curl["version_number"] < 0x071201) {
$version = $curl["version"];
throw new ClientException("Your curl version ${version} is outdated; please upgrade to 7.18.1 or higher");
}
$this->options = array(
CURLOPT_BINARYTRANSFER => true,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HEADER => true,
CURLOPT_USERPWD => "api:" . $key,
CURLOPT_CAINFO => self::caBundle(),
CURLOPT_SSL_VERIFYPEER => true,
CURLOPT_USERAGENT => join(" ", array_filter(array(self::userAgent(), $app_identifier))),
);
if ($proxy) {
$parts = parse_url($proxy);
if (isset($parts["host"])) {
$this->options[CURLOPT_PROXYTYPE] = CURLPROXY_HTTP;
$this->options[CURLOPT_PROXY] = $parts["host"];
} else {
throw new ConnectionException("Invalid proxy");
}
if (isset($parts["port"])) {
$this->options[CURLOPT_PROXYPORT] = $parts["port"];
}
$creds = "";
if (isset($parts["user"])) $creds .= $parts["user"];
if (isset($parts["pass"])) $creds .= ":" . $parts["pass"];
if ($creds) {
$this->options[CURLOPT_PROXYAUTH] = CURLAUTH_ANY;
$this->options[CURLOPT_PROXYUSERPWD] = $creds;
}
}
}
function request($method, $url, $body = NULL) {
$header = array();
if (is_array($body)) {
if (!empty($body)) {
$body = json_encode($body);
array_push($header, "Content-Type: application/json");
} else {
$body = NULL;
}
}
for ($retries = self::RETRY_COUNT; $retries >= 0; $retries--) {
if ($retries < self::RETRY_COUNT) {
usleep(self::RETRY_DELAY * 1000);
}
$request = curl_init();
if ($request === false || $request === null) {
throw new ConnectionException(
"Error while connecting: curl extension is not functional or disabled."
);
}
curl_setopt_array($request, $this->options);
$url = strtolower(substr($url, 0, 6)) == "https:" ? $url : self::API_ENDPOINT . $url;
curl_setopt($request, CURLOPT_URL, $url);
curl_setopt($request, CURLOPT_CUSTOMREQUEST, strtoupper($method));
if (count($header) > 0) {
curl_setopt($request, CURLOPT_HTTPHEADER, $header);
}
if ($body) {
curl_setopt($request, CURLOPT_POSTFIELDS, $body);
}
$response = curl_exec($request);
if (is_string($response)) {
$status = curl_getinfo($request, CURLINFO_HTTP_CODE);
$headerSize = curl_getinfo($request, CURLINFO_HEADER_SIZE);
curl_close($request);
$headers = self::parseHeaders(substr($response, 0, $headerSize));
$body = substr($response, $headerSize);
if (isset($headers["compression-count"])) {
Tinify::setCompressionCount(intval($headers["compression-count"]));
}
if ($status >= 200 && $status <= 299) {
return (object) array("body" => $body, "headers" => $headers);
}
$details = json_decode($body);
if (!$details) {
$message = sprintf("Error while parsing response: %s (#%d)",
PHP_VERSION_ID >= 50500 ? json_last_error_msg() : "Error",
json_last_error());
$details = (object) array(
"message" => $message,
"error" => "ParseError"
);
}
if ($retries > 0 && $status >= 500) continue;
throw Exception::create($details->message, $details->error, $status);
} else {
$message = sprintf("%s (#%d)", curl_error($request), curl_errno($request));
curl_close($request);
if ($retries > 0) continue;
throw new ConnectionException("Error while connecting: " . $message);
}
}
}
protected static function parseHeaders($headers) {
if (!is_array($headers)) {
$headers = explode("\r\n", $headers);
}
$res = array();
foreach ($headers as $header) {
if (empty($header)) continue;
$split = explode(":", $header, 2);
if (count($split) === 2) {
$res[strtolower($split[0])] = trim($split[1]);
}
}
return $res;
}
}

36
sdk/tinypng/Tinify/Exception.php

@ -1,36 +0,0 @@ @@ -1,36 +0,0 @@
<?php
namespace Tinify;
class Exception extends \Exception {
public $status;
public static function create($message, $type, $status) {
if ($status == 401 || $status == 429) {
$klass = "Tinify\AccountException";
} else if($status >= 400 && $status <= 499) {
$klass = "Tinify\ClientException";
} else if($status >= 500 && $status <= 599) {
$klass = "Tinify\ServerException";
} else {
$klass = "Tinify\Exception";
}
if (empty($message)) $message = "No message was provided";
return new $klass($message, $type, $status);
}
function __construct($message, $type = NULL, $status = NULL) {
$this->status = $status;
if ($status) {
parent::__construct($message . " (HTTP " . $status . "/" . $type . ")");
} else {
parent::__construct($message);
}
}
}
class AccountException extends Exception {}
class ClientException extends Exception {}
class ServerException extends Exception {}
class ConnectionException extends Exception {}

36
sdk/tinypng/Tinify/Result.php

@ -1,36 +0,0 @@ @@ -1,36 +0,0 @@
<?php
namespace Tinify;
class Result extends ResultMeta {
protected $data;
public function __construct($meta, $data) {
$this->meta = $meta;
$this->data = $data;
}
public function data() {
return $this->data;
}
public function toBuffer() {
return $this->data;
}
public function toFile($path) {
return file_put_contents($path, $this->toBuffer());
}
public function size() {
return intval($this->meta["content-length"]);
}
public function mediaType() {
return $this->meta["content-type"];
}
public function contentType() {
return $this->mediaType();
}
}

23
sdk/tinypng/Tinify/ResultMeta.php

@ -1,23 +0,0 @@ @@ -1,23 +0,0 @@
<?php
namespace Tinify;
class ResultMeta {
protected $meta;
public function __construct($meta) {
$this->meta = $meta;
}
public function width() {
return intval($this->meta["image-width"]);
}
public function height() {
return intval($this->meta["image-height"]);
}
public function location() {
return isset($this->meta["location"]) ? $this->meta["location"] : null;
}
}

69
sdk/tinypng/Tinify/Source.php

@ -1,69 +0,0 @@ @@ -1,69 +0,0 @@
<?php
namespace Tinify;
class Source {
private $url, $commands;
public static function fromFile($path) {
return self::fromBuffer(file_get_contents($path));
}
public static function fromBuffer($string) {
$response = Tinify::getClient()->request("post", "/shrink", $string);
return new self($response->headers["location"]);
}
public static function fromUrl($url) {
$body = array("source" => array("url" => $url));
$response = Tinify::getClient()->request("post", "/shrink", $body);
return new self($response->headers["location"]);
}
public function __construct($url, $commands = array()) {
$this->url = $url;
$this->commands = $commands;
}
public function preserve() {
$options = $this->flatten(func_get_args());
$commands = array_merge($this->commands, array("preserve" => $options));
return new self($this->url, $commands);
}
public function resize($options) {
$commands = array_merge($this->commands, array("resize" => $options));
return new self($this->url, $commands);
}
public function store($options) {
$response = Tinify::getClient()->request("post", $this->url,
array_merge($this->commands, array("store" => $options)));
return new Result($response->headers, $response->body);
}
public function result() {
$response = Tinify::getClient()->request("get", $this->url, $this->commands);
return new Result($response->headers, $response->body);
}
public function toFile($path) {
return $this->result()->toFile($path);
}
public function toBuffer() {
return $this->result()->toBuffer();
}
private static function flatten($options) {
$flattened = array();
foreach ($options as $option) {
if (is_array($option)) {
$flattened = array_merge($flattened, $option);
} else {
array_push($flattened, $option);
}
}
return $flattened;
}
}

3550
sdk/tinypng/data/cacert.pem

File diff suppressed because it is too large Load Diff

48
sdk/wxyt/QcloudImage/Auth.php

@ -1,48 +0,0 @@ @@ -1,48 +0,0 @@
<?php
/**
* Signature create related functions.
*/
namespace QcloudImage;
/**
* Auth class for creating reusable signature.
*/
class Auth {
public function __construct($appId, $secretId, $secretKey) {
$this->appId = $appId;
$this->secretId = $secretId;
$this->secretKey = $secretKey;
}
/**
* Return the appId
*/
public function getAppId() {
return $this->appId;
}
/**
* Create reusable signature.
* This signature will expire at time()+$howlong timestamp.
* Return the signature on success.
* Return false on fail.
*/
public function getSign($bucket, $howlong = 30) {
if ($howlong <= 0) {
return false;
}
$now = time();
$expiration = $now + $howlong;
$random = rand();
$plainText = "a=".$this->appId."&b=$bucket&k=".$this->secretId."&e=$expiration&t=$now&r=$random&f=";
$bin = hash_hmac('SHA1', $plainText, $this->secretKey, true);
return base64_encode($bin.$plainText);
}
private $appId = "";
private $secretId = "";
private $secretKey = "";
}

1258
sdk/wxyt/QcloudImage/CIClient.php

File diff suppressed because it is too large Load Diff

46
sdk/wxyt/QcloudImage/Conf.php

@ -1,46 +0,0 @@ @@ -1,46 +0,0 @@
<?php
/**
* Some settings for SDK.
*/
namespace QcloudImage;
/**
* Conf class.
*/
class Conf {
private static $VERSION = '1.0.0';
private static $SERVER_ADDR = 'service.image.myqcloud.com';
private static $HEADER_HOST = 'service.image.myqcloud.com';
private $REQ_TIMEOUT = 60;
private $SCHEME = 'http';
public function useHttp() {
$this->SCHEME = 'http';
}
public function useHttps() {
$this->SCHEME = 'https';
}
public function setTimeout($timeout) {
if ($timeout > 0) {
$this->REQ_TIMEOUT = $timeout;
}
}
public function timeout() {
return $this->REQ_TIMEOUT;
}
public function host() {
return self::$HEADER_HOST;
}
public function buildUrl($uri) {
return $this->SCHEME.'://'.self::$SERVER_ADDR.'/'.ltrim($uri, "/");
}
public static function getUa($appid = null) {
$ua = 'CIPhpSDK/'.self::$VERSION.' ('.php_uname().')';
if ($appid) {
$ua .= " User($appid)";
}
return $ua;
}
}

28
sdk/wxyt/QcloudImage/Error.php

@ -1,28 +0,0 @@ @@ -1,28 +0,0 @@
<?php
/**
* Error defination.
*/
namespace QcloudImage;
class Error {
/**
* Create reusable signature.
* This signature will expire at time()+$howlong timestamp.
* Return the signature on success.
* Return false on fail.
*/
public static function json($code, $message, $httpcode = 0) {
return json_encode(array(
'code' => $code,
'message' => $message,
'httpcode' => $httpcode,
'data' => json_decode('{}',true)
));
}
public static $Param = -1;
public static $Network = -2;
public static $FilePath = -3;
public static $Unknown = -4;
}

108
sdk/wxyt/QcloudImage/HttpClient.php

@ -1,108 +0,0 @@ @@ -1,108 +0,0 @@
<?php
/**
* Http Client use curl.
*/
namespace QcloudImage;
function my_curl_reset($handler) {
curl_setopt($handler, CURLOPT_URL, '');
curl_setopt($handler, CURLOPT_HTTPHEADER, array());
curl_setopt($handler, CURLOPT_POSTFIELDS, array());
curl_setopt($handler, CURLOPT_TIMEOUT, 0);
curl_setopt($handler, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($handler, CURLOPT_SSL_VERIFYHOST, 0);
}
class HttpClient {
public function __destory() {
if ($this->curlHandler) {
curl_close($this->curlHandler);
}
}
/**
* send http request
* @param array $request http请求信息
* url : 请求的url地址
* method : 请求方法,'get', 'post', 'put', 'delete', 'head'
* data : 请求数据,如有设置,则method为post
* header : 需要设置的http头部
* host : 请求头部host
* timeout : 请求超时时间
* cert : ca文件路径
* ssl_version: SSL版本号
* @return string http请求响应
*/
public function sendRequest($request) {
if (!is_array($request) || !isset($request["url"])) {
return false;
}
if ($this->curlHandler) {
if (function_exists('curl_reset')) {
curl_reset($this->curlHandler);
} else {
my_curl_reset($this->curlHandler);
}
} else {
$this->curlHandler = curl_init();
}
curl_setopt($this->curlHandler, CURLOPT_URL, $request['url']);
$method = 'GET';
if (isset($request['method']) &&
in_array(strtolower($request['method']), array('get', 'post', 'put', 'delete', 'head'))) {
$method = strtoupper($request['method']);
} else if (isset($request['data'])) {
$method = 'POST';
}
$header = isset($request['header']) ? $request['header'] : array();
$header[] = 'Method:'.$method;
$header[] = 'Connection: keep-alive';
if ('POST' == $method) {
$header[] = 'Expect: ';
}
isset($request['host']) && $header[] = 'Host:' . $request['host'];
curl_setopt($this->curlHandler, CURLOPT_HTTPHEADER, $header);
curl_setopt($this->curlHandler, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($this->curlHandler, CURLOPT_CUSTOMREQUEST, $method);
isset($request['timeout']) && curl_setopt($this->curlHandler, CURLOPT_TIMEOUT, $request['timeout']);
isset($request['data']) && in_array($method, array('POST', 'PUT')) &&
curl_setopt($this->curlHandler, CURLOPT_POSTFIELDS, $request['data']);
$ssl = substr($request['url'], 0, 8) == "https://" ? true : false;
if (isset($request['cert'])) {
curl_setopt($this->curlHandler, CURLOPT_SSL_VERIFYPEER,true);
curl_setopt($this->curlHandler, CURLOPT_CAINFO, $request['cert']);
curl_setopt($this->curlHandler, CURLOPT_SSL_VERIFYHOST,2);
if (isset($request['ssl_version'])) {
curl_setopt($this->curlHandler, CURLOPT_SSLVERSION, $request['ssl_version']);
} else {
curl_setopt($this->curlHandler, CURLOPT_SSLVERSION, 4);
}
} else if ($ssl) {
curl_setopt($this->curlHandler, CURLOPT_SSL_VERIFYPEER,false); //true any ca
curl_setopt($this->curlHandler, CURLOPT_SSL_VERIFYHOST,1); //check only host
if (isset($request['ssl_version'])) {
curl_setopt($this->curlHandler, CURLOPT_SSLVERSION, $request['ssl_version']);
} else {
curl_setopt($this->curlHandler, CURLOPT_SSLVERSION, 4);
}
}
$ret = curl_exec($this->curlHandler);
$this->httpInfo = curl_getinfo($this->curlHandler);
return $ret;
}
public function statusCode() {
if ($this->httpInfo) {
return $this->httpInfo['http_code'];
}
return 0;
}
private $httpInfo;
private $curlHandler;
}

224
sdk/wxyt/README.md

@ -1,224 +0,0 @@ @@ -1,224 +0,0 @@
# tencentyun/image-php-sdk-v2.0
腾讯云 [万象优图(Cloud Image)](https://www.qcloud.com/product/ci) SDK for PHP
## 安装(直接下载源码集成)
### 直接下载源码集成
从github下载源码,并加载image-php-sdk-v2.0/index.php就可以了。
调用请参考sample.php
### 1. 在腾讯云申请业务的授权
授权包括:
APP_ID
SECRET_ID
SECRET_KEY
BUCKET
### 2. 创建对应操作类的对象
如果要使用图片,需要创建图片操作类对象
require_once __DIR__ . '/index.php';
use QcloudImage\CIClient;
$client = new CIClient('APP_ID', 'SECRET_ID', 'SECRET_KEY', 'BUCKET');
$client->setTimeout(30);
### 3. 调用对应的方法
在创建完对象后,根据实际需求,调用对应的操作方法就可以了。sdk提供的方法包括:图片识别、人脸识别及人脸核身等。
#### 3.1 图片识别
图片识别包括:图片鉴黄、图片标签、OCR-身份证识别及OCR-名片识别。
##### 图片鉴黄
```php
//单个或多个图片Url
var_dump ($client->pornDetect(array('urls'=>array('YOUR URL A',
'YOUR URL B'))));
//单个或多个图片File
var_dump ($client->pornDetect(array('files'=>array('F:\pic\你好.jpg','G:\pic\test2.jpg'))));
```
##### 图片标签
```php
//单个图片url
var_dump ($client->tagDetect(array('url'=>'YOUR URL')));
//单个图片file
var_dump ($client->tagDetect(array('file'=>'G:\pic\hot1.jpg')));
//单个图片内容
var_dump ($client->tagDetect(array('buffer'=>file_get_contents('G:\pic\hot1.jpg'))));
```
##### OCR-身份证识别
```php
//单个或多个图片Url,识别身份证正面
var_dump ($client->idcardDetect(array('urls'=>array('YOUR URL A',
'YOUR URL B')), 0));
//单个或多个图片file,识别身份证正面
var_dump ($client->idcardDetect(array('files'=>array('F:\pic\id6_zheng.jpg', 'F:\pic\id2_zheng.jpg')), 0));
//单个或多个图片内容,识别身份证正面
var_dump ($client->idcardDetect(array('buffers'=>array(file_get_contents('F:\pic\id6_zheng.jpg'),
file_get_contents('F:\pic\id2_zheng.jpg'))), 0));
//单个或多个图片Url,识别身份证反面
var_dump ($client->idcardDetect(array('urls'=>array('YOUR URL C',
'YOUR URL D')), 1));
//单个或多个图片file,识别身份证反面
var_dump ($client->idcardDetect(array('files'=>array('F:\pic\id5_fan.jpg', 'F:\pic\id7_fan.png')), 1));
//单个或多个图片内容,识别身份证反面
var_dump ($client->idcardDetect(array('buffers'=>array(file_get_contents('F:\pic\id5_fan.jpg'),
file_get_contents('F:\pic\id7_fan.jpg'))), 1));
```
##### OCR-名片识别
```php
//单个或多个图片Url
var_dump ($client->namecardDetect(array('urls'=>array('YOUR URL A',
'YOUR URL B')), 0));
//单个或多个图片file,
var_dump ($client->namecardDetect(array('files'=>array('F:\pic\r.jpg', 'F:\pic\name2.jpg')), 1));
//单个或多个图片内容
var_dump ($client->namecardDetect(array('buffers'=>array(file_get_contents('F:\pic\name1.jpg'),
file_get_contents('F:\pic\name2.jpg'))), 0));
```
#### 3.2 人脸识别
人脸识别包括:人脸检测、五官定位、个体信息管理、人脸验证、人脸对比及人脸检索。
#### 人脸检测
```php
//单个图片Url, mode:1为检测最大的人脸 , 0为检测所有人脸
var_dump ($client->faceDetect(array('url'=>'YOUR URL'), 1));
//单个图片file,mode:1为检测最大的人脸 , 0为检测所有人脸
var_dump ($client->faceDetect(array('file'=>'F:\pic\face1.jpg'),0));
//单个图片内容,mode:1为检测最大的人脸 , 0为检测所有人脸
var_dump ($client->faceDetect(array('buffer'=>file_get_contents('F:\pic\face1.jpg')), 1));
```
##### 五官定位
```php
//单个图片Url,mode:1为检测最大的人脸 , 0为检测所有人脸
var_dump ($client->faceShape(array('url'=>'YOUR URL'),1));
//单个图片file,mode:1为检测最大的人脸 , 0为检测所有人脸
var_dump ($client->faceShape(array('file'=>'F:\pic\face1.jpg'),0));
//单个图片内容,mode:1为检测最大的人脸 , 0为检测所有人脸
var_dump ($client->faceShape(array('buffer'=>file_get_contents('F:\pic\face1.jpg')), 1));
```
##### 个体信息管理
```php
//个体创建,创建一个Person,并将Person放置到group_ids指定的组当中,不存在的group_id会自动创建。
//创建一个Person, 使用图片url
var_dump ($client->faceNewPerson('person1111', array('group11',), array('url'=>'YOUR URL'), 'xiaoxin'));
//创建一个Person, 使用图片file
var_dump ($client->faceNewPerson('person2111', array('group11',), array('file'=>'F:\pic\hot1.jpg')));
//创建一个Person, 使用图片内容
var_dump ($client->faceNewPerson('person3111', array('group11',), array('buffer'=>file_get_contents('F:\pic\zhao1.jpg'))));
//增加人脸,将一组Face加入到一个Person中。
//将单个或者多个Face的url加入到一个Person中
var_dump ($client->faceAddFace('person1111', array('urls'=>array('YOUR URL A',
'YOUR URL B'))));
//将单个或者多个Face的file加入到一个Person中
var_dump ($client->faceAddFace('person2111', array('files'=>array('F:\pic\yang.jpg','F:\pic\yang2.jpg'))));
//将单个或者多个Face的文件内容加入到一个Person中
var_dump ($client->faceAddFace('person3111', array('buffers'=>array(file_get_contents('F:\pic\yang.jpg'),file_get_contents('F:\pic\yang2.jpg')))));
// 删除人脸,删除一个person下的face
var_dump ($client->faceDelFace('person1', array('12346',)));
//设置信息
var_dump ($client->faceSetInfo('person1', 'fanbing'));
//获取信息
var_dump ($client->faceGetInfo('person1'));
//获取组列表
var_dump ($client->faceGetGroupIds());
//获取人列表
var_dump ($client->faceGetPersonIds('group1'));
//获取人脸列表
var_dump ($client->faceGetFaceIds('person1'));
//获取人脸信息
var_dump ($client->faceGetFaceInfo('1704147773393235686'));
//删除个人
var_dump ($client->faceDelPerson('person11'));
```
##### 人脸验证
给定一个Face和一个Person,返回是否是同一个人的判断以及置信度
```php
//单个图片Url
var_dump ($client->faceVerify('person1', array('url'=>'YOUR URL')));
//单个图片file
var_dump ($client->faceVerify('person3111', array('file'=>'F:\pic\yang3.jpg')));
//单个图片内容
var_dump ($client->faceVerify('person3111', array('buffer'=>file_get_contents('F:\pic\yang3.jpg'))));
```
##### 人脸检索
对于一个待识别的人脸图片,在一个Group中识别出最相似的Top5 Person作为其身份返回,返回的Top5中按照相似度从大到小排列。
```php
//单个文件url
var_dump ($client->faceIdentify('group1', array('url'=>'YOUR URL')));
//单个文件file
var_dump ($client->faceIdentify('group11', array('file'=>'F:\pic\yang3.jpg')));
//单个文件内容
var_dump ($client->faceIdentify('group11', array('buffer'=>file_get_contents('F:\pic\yang3.jpg'))));
```
##### 人脸对比
```php
//两个对比图片的文件url
var_dump ($client->faceCompare(array('url'=>"YOUR URL A"),
array('url'=>'YOUR URL B')));
//两个对比图片的文件file
var_dump ($client->faceCompare(array('file'=>'F:\pic\yang.jpg'), array('file'=>'F:\pic\yang2.jpg')));
//两个对比图片的文件内容
var_dump ($client->faceCompare(array('file'=>'F:\pic\yang.jpg'), array('file'=>'F:\pic\yang2.jpg')));
```
#### 3.3 人脸核身
##### 身份证识别对比
```php
//身份证url
var_dump ($client->faceIdCardCompare('xxxxxxxxxxx', 'xxxxxxxxxxx', array('url'=>'YOUR URL')));
//身份证文件file
var_dump ($client->faceIdCardCompare('xxxxxxxxxxx', 'xxxxxxxxxxx', array('file'=>'F:\pic\idcard.jpg')));
//身份证文件内容
var_dump ($client->faceIdCardCompare('xxxxxxxxxxx', 'xxxxxxxxxxx', array('buffer'=>file_get_contents('F:\pic\idcard.jpg'))));
```
##### 活体检测—获取唇语验证码
```php
$obj = $client->faceLiveGetFour();
var_dump ($obj);
$validate_data = $obj['data']['validate_data'];
```
##### 活体检测-视频与用户照片的比对
```php
var_dump ($client->faceLiveDetectFour($validate_data, array('file'=>'F:\pic\ZOE_0171.mp4'), False, array('F:\pic\idcard.jpg')));
```
##### 活体检测-视频与身份证高清照片的比对
```php
var_dump ($client->faceIdCardLiveDetectFour($validate_data, array('file'=>'F:\pic\ZOE_0171.mp4'), 'xxxxxxxxxxx', 'xxxxxxxxxxx'));
```

11
sdk/wxyt/autoload.php

@ -1,11 +0,0 @@ @@ -1,11 +0,0 @@
<?php
function classLoader($class)
{
$path = str_replace('\\', DIRECTORY_SEPARATOR, $class);
$file = __DIR__ . DIRECTORY_SEPARATOR . $path . '.php';
if (file_exists($file)) {
require_once $file;
}
}
spl_autoload_register('classLoader');

3
sdk/wxyt/index.php

@ -1,3 +0,0 @@ @@ -1,3 +0,0 @@
<?php
require_once __DIR__ . '/autoload.php';

150
sdk/wxyt/sample.php

@ -1,150 +0,0 @@ @@ -1,150 +0,0 @@
<?php
require_once __DIR__ . '/index.php';
use QcloudImage\CIClient;
$appid = 'YOUR_APPID';
$secretId = 'YOUR_SECRETID';
$secretKey = 'YOUR_SECRETKEY';
$bucket = 'YOUR_BUCKET';
$client = new CIClient($appid, $secretId, $secretKey, $bucket);
$client->setTimeout(30);
//图片鉴黄
//单个或多个图片Url
var_dump ($client->pornDetect(array('urls'=>array('YOUR URL A','YOUR URL B'))));
//单个或多个图片File
var_dump ($client->pornDetect(array('files'=>array('F:\pic\你好.jpg','G:\pic\test2.jpg'))));
//图片标签
//单个图片url
var_dump ($client->tagDetect(array('url'=>'YOUR URL')));
//单个图片file
var_dump ($client->tagDetect(array('file'=>'G:\pic\hot1.jpg')));
//单个图片内容
var_dump ($client->tagDetect(array('buffer'=>file_get_contents('G:\pic\hot1.jpg'))));
//身份证识别
//单个或多个图片Url,识别身份证正面
var_dump ($client->idcardDetect(array('urls'=>array('YOUR URL A', 'YOUR URL B')), 0));
//单个或多个图片file,识别身份证正面
var_dump ($client->idcardDetect(array('files'=>array('F:\pic\id6_zheng.jpg', 'F:\pic\id2_zheng.jpg')), 0));
//单个或多个图片内容,识别身份证正面
var_dump ($client->idcardDetect(array('buffers'=>array(file_get_contents('F:\pic\id6_zheng.jpg'), file_get_contents('F:\pic\id2_zheng.jpg'))), 0));
//单个或多个图片Url,识别身份证反面
var_dump ($client->idcardDetect(array('urls'=>array('YOUR URL A', 'YOUR URL B')), 1));
//单个或多个图片file,识别身份证反面
var_dump ($client->idcardDetect(array('files'=>array('F:\pic\id5_fan.jpg', 'F:\pic\id7_fan.png')), 1));
//单个或多个图片内容,识别身份证反面
var_dump ($client->idcardDetect(array('buffers'=>array(file_get_contents('F:\pic\id5_fan.jpg'), file_get_contents('F:\pic\id7_fan.png'))), 1));
//名片识别
//单个或多个图片Url
var_dump ($client->namecardDetect(array('urls'=>array('YOUR URL A', 'YOUR URL B')), 0));
//单个或多个图片file,
var_dump ($client->namecardDetect(array('files'=>array('F:\pic\r.jpg', 'F:\pic\name2.jpg')), 1));
//单个或多个图片内容
var_dump ($client->namecardDetect(array('buffers'=>array(file_get_contents('F:\pic\name1.jpg'), file_get_contents('F:\pic\name2.jpg'))), 0));
//人脸检测
//单个图片Url, mode:1为检测最大的人脸 , 0为检测所有人脸
var_dump ($client->faceDetect(array('url'=>'YOUR URL'), 1));
//单个图片file,mode:1为检测最大的人脸 , 0为检测所有人脸
var_dump ($client->faceDetect(array('file'=>'F:\pic\face1.jpg'),0));
//单个图片内容,mode:1为检测最大的人脸 , 0为检测所有人脸
var_dump ($client->faceDetect(array('buffer'=>file_get_contents('F:\pic\face1.jpg')), 1));
//五官定位
//单个图片Url,检测最大的人脸
var_dump ($client->faceShape(array('url'=>'YOUR URL'),1));
//单个图片Url,检测所有人脸
var_dump ($client->faceShape(array('file'=>'F:\pic\face1.jpg'),0));
//单个图片Url,检测所有人脸
var_dump ($client->faceShape(array('buffer'=>file_get_contents('F:\pic\face1.jpg')), 1));
//创建一个Person,并将Person放置到group_ids指定的组当中, 使用图片url
var_dump ($client->faceNewPerson('person1111', array('group11',), array('url'=>'YOUR URL'), 'xiaoxin'));
//创建一个Person,并将Person放置到group_ids指定的组当中, 使用图片file
var_dump ($client->faceNewPerson('person2111', array('group11',), array('file'=>'F:\pic\hot1.jpg')));
//创建一个Person,并将Person放置到group_ids指定的组当中, 使用图片内容
var_dump ($client->faceNewPerson('person3111', array('group11',), array('buffer'=>file_get_contents('F:\pic\zhao1.jpg'))));
//增加人脸,将单个或者多个Face的url加入到一个Person中.注意,一个Face只能被加入到一个Person中。 一个Person最多允许包含20个Face
var_dump ($client->faceAddFace('person_one', array('urls'=>array('YOUR URL A','YOUR URL B'))));
//增加人脸,将单个或者多个Face的file加入到一个Person中.注意,一个Face只能被加入到一个Person中。 一个Person最多允许包含20个Face
var_dump ($client->faceAddFace('person_two', array('files'=>array('F:\pic\yang.jpg','F:\pic\yang2.jpg'))));
//增加人脸,将单个或者多个Face的文件内容加入到一个Person中.注意,一个Face只能被加入到一个Person中。 一个Person最多允许包含20个Face
var_dump ($client->faceAddFace('person_three', array('buffers'=>array(file_get_contents('F:\pic\yang.jpg'),file_get_contents('F:\pic\yang2.jpg')))));
//删除人脸
var_dump ($client->faceDelFace('person_one', array('one',)));
//设置信息
var_dump ($client->faceSetInfo('person_one', 'fanbing'));
//获取信息
var_dump ($client->faceGetInfo('person_one'));
//获取组列表
var_dump ($client->faceGetGroupIds());
//获取人列表
var_dump ($client->faceGetPersonIds('group1'));
//获取人脸列表
var_dump ($client->faceGetFaceIds('person_one'));
//获取人脸信息
var_dump ($client->faceGetFaceInfo('1704147773393235686'));
//删除个人
var_dump ($client->faceDelPerson('person_one'));
//人脸验证
//单个图片Url
var_dump ($client->faceVerify('person1', array('url'=>'YOUR URL')));
//单个图片file
var_dump ($client->faceVerify('person3111', array('file'=>'F:\pic\yang3.jpg')));
//单个图片内容
var_dump ($client->faceVerify('person3111', array('buffer'=>file_get_contents('F:\pic\yang3.jpg'))));
//人脸检索
//单个文件url
var_dump ($client->faceIdentify('group1', array('url'=>'YOUR URL')));
//单个文件file
var_dump ($client->faceIdentify('group11', array('file'=>'F:\pic\yang3.jpg')));
//单个文件内容
var_dump ($client->faceIdentify('group11', array('buffer'=>file_get_contents('F:\pic\yang3.jpg'))));
//人脸对比
//两个对比图片的文件url
var_dump ($client->faceCompare(array('url'=>"YOUR URL A"), array('url'=>'YOUR URL B')));
//两个对比图片的文件file
var_dump ($client->faceCompare(array('file'=>'F:\pic\yang.jpg'), array('file'=>'F:\pic\yang2.jpg')));
//两个对比图片的文件内容
var_dump ($client->faceCompare( array('buffer'=>file_get_contents('F:\pic\yang.jpg')), array('buffer'=>file_get_contents('F:\pic\yang3.jpg'))));
//身份证识别对比
//身份证url
var_dump ($client->faceIdCardCompare('ID CARD NUM', 'NAME', array('url'=>'YOUR URL')));
//身份证文件file
var_dump ($client->faceIdCardCompare('ID CARD NUM', 'NAME', array('file'=>'F:\pic\idcard.jpg')));
//身份证文件内容
var_dump ($client->faceIdCardCompare('ID CARD NUM', 'NAME', array('buffer'=>file_get_contents('F:\pic\idcard.jpg'))));
//人脸核身
//活体检测第一步:获取唇语(验证码)
$obj = $client->faceLiveGetFour();
var_dump ($obj);
$faceObj = json_decode($obj, true);
var_dump ($faceObj);
$validate_data = '';
if ($faceObj && isset($faceObj['data']['validate_data'])) {
$validate_data = $faceObj['data']['validate_data'];
}
var_dump ($validate_data);
//活体检测第二步:检测
var_dump ($client->faceLiveDetectFour($validate_data, array('file'=>'F:\pic\ZOE_0171.mp4'), False, array('F:\pic\idcard.jpg')));
//活体检测第二步:检测--对比指定身份信息
var_dump ($client->faceIdCardLiveDetectFour($validate_data, array('file'=>'F:\pic\ZOE_0171.mp4'), '330782198802084329', '季锦锦'));

42
static/admin.css

@ -1,42 +0,0 @@ @@ -1,42 +0,0 @@
#menu{
width:100%;
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;
}

86
static/style.css

@ -1,86 +0,0 @@ @@ -1,86 +0,0 @@
.ajax-file-upload-container {
display: none;
}
.ajax-upload-dragdrop{
height:200px;
}
#fileuploader {
/*width:100%;*/
}
.ajax-file-upload {
margin-left:auto;
margin-right:auto;
}
#loading{
margin:0;
padding:0;
display:none;
width:100%;
position:fixed;
clear:both;
}
#fileuploader {
margin-top:10%;
}
#relink{
display: none;
margin-top:36px;
width:100%;
}
#relink lable{
color:#2BD5AA;
padding:10px;
}
#msg{
margin:0;
padding:0;
width:100%;
position:fixed;
display: none;
z-index: 100;
top:60px;
clear:both;
}
.msg{
color:green;
border:1px solid #EFEFEF;
background-color:#E6E6E6;
text-align:center;
padding:12px;
border-radius:5px;
width:16%;
margin:auto;
font-size:16px;
}
#img-box{
margin-bottom:20px;
}
#img-box img{
max-width: 100%;
max-height: 100%;
}
#menu{
margin:0;
padding:0;
width:100%;
background-color:#222222;
}
#menu .navbar {
margin-bottom:0;
border-left:0;
border-right:0;
}
#footer{
width:100%;
background-color: #F5F5F5;
color:#999999;
position:fixed;
bottom:0;
padding:14px;
}

19
tpl/admin/footer.php

@ -1,19 +0,0 @@ @@ -1,19 +0,0 @@
</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>

76
tpl/admin/header.php

@ -1,76 +0,0 @@ @@ -1,76 +0,0 @@
<?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>
<script src="https://cdn.bootcss.com/jquery/2.2.4/jquery.min.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="../index.php">首页</a></li>
<li class="layui-nav-item"><a href="../found.php">探索发现</a></li>
<li class="layui-nav-item"><a href="../pro.php">捐赠版</a></li>
<li class="layui-nav-item"><a href="https://wiki.xiaoz.me/docs/imgurl/">帮助文档</a></li>
<li class="layui-nav-item"><a href="../about.php">关于</a></li>
</ul>
</div>
<div style = "float: right;">
<ul class="layui-nav">
<li class="layui-nav-item">
<a href="../recycle.php">回收站<span class="layui-badge">9</span></a>
</li>
<li class="layui-nav-item">
<a href="">后台管理</a>
<dl class="layui-nav-child">
<dd><a href="../functions.php?type=logout">退出</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

73
tpl/header.php

@ -1,73 +0,0 @@ @@ -1,73 +0,0 @@
<!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="./found.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='./admin/'>管理员</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-->

147
upload.php

@ -1,147 +0,0 @@ @@ -1,147 +0,0 @@
<?php
error_reporting(E_ALL^E_NOTICE^E_WARNING^E_DEPRECATED);
include_once('./config.php');
require_once( 'sdk/Medoo.php' );
//用户IP
$ip = $_SERVER["REMOTE_ADDR"];
//获取当前时间
$thetime = date('Ymd',time());
//获取浏览器信息
$ua = $_SERVER['HTTP_USER_AGENT'];
//验证用户,并设置上传目录
$dir = check($_COOKIE['uid'],$config['username'],$config['password'],$config['userdir'],$config['admindir']);
if($dir == $config['userdir']) {
$theuser = 'user';
}
if($dir == $config['admindir']) {
$theuser = 'admin';
}
$img_name = $_FILES["file"]["name"]; //文件名称
$suffix = substr(strrchr($img_name, '.'), 1);//文件后缀
$suffix = strtolower($suffix); //文件后缀转换为小写
$rnum = date('dhis',time()).rand(1000,9999); //生成一个随机数
//$new_name = substr(md5($img_name.$rnum), 8, 16).'.'.$suffix; //新的文件名
$img_type = $_FILES["file"]["type"]; //文件类型
$img_size = $_FILES["file"]["size"]; //文件大小
$img_tmp = $_FILES["file"]["tmp_name"]; //临时文件名称
//生成文件HASH
$fhash = hash_file("md5",$img_tmp,FALSE);
$fhash = substr($fhash,8,16);
//新的文件名
$new_name = $fhash.'.'.$suffix;
$img_error = $_FILES["file"]["error"]; //错误代码
$max_size = 2097152; //最大上传大小2M
$current_time = date('ym',time()); //当前月份
$dir = $dir.'/'.$current_time; //图片目录
$dir_name = $dir.'/'.$new_name; //完整路径
//使用exif_imagetype函数来判断文件类型
$file_type = exif_imagetype($img_tmp);
switch ( $file_type )
{
case IMAGETYPE_GIF:
$status = 1;
break;
case IMAGETYPE_JPEG:
$status = 1;
break;
case IMAGETYPE_PNG:
$status = 1;
break;
case IMAGETYPE_BMP:
$status = 1;
break;
default:
$status = 0;
break;
}
//判断文件后缀
switch ( $suffix )
{
case jpg:
$suffix_status = 1;
break;
case png:
$suffix_status = 1;
break;
case jpeg:
$suffix_status = 1;
break;
case bmp:
$suffix_status = 1;
break;
case gif:
$suffix_status = 1;
break;
default:
$suffix_status = 0;
break;
}
//判断文件夹是否存在,不存在则创建目录
if(!file_exists($dir)){
mkdir($dir,0777,true);
}
//开始上传
if(($img_size <= $max_size) && ($status == 1) && ($suffix_status == 1)) {
if ($_FILES["file"]["error"] > 0)
{
echo "Return Code: " . $_FILES["file"]["error"] . "<br />";
}
else {
//如果上传成功
if(move_uploaded_file($img_tmp,$dir_name)){
$img_url = $config['domain'].$dir_name; //自定义图片路径
$img_info = getimagesize($dir_name);
$img_width = $img_info['0']; //图片宽度
$img_height = $img_info['1']; //图片高度
$re_data = array("linkurl" => $img_url,width => $img_width,"height" => $img_height,"status" => 'ok');
//查询图片是否存在
$isdir = $database->count("uploads",["dir" => $dir_name]);
//var_dump( $database->log());
//如果图片存在
if($isdir >= 1) {
echo json_encode($re_data);
exit;
}
//图片不存在继续执行
$last_id = $database->insert("uploads",["dir" => $dir_name,"date" => $thetime,"ip" => $ip,"method" => $ua,"user" => $theuser]);
//写入成功
if($last_id) {
//返回json格式
echo json_encode($re_data);
exit;
}
else{
echo "写入数据库失败!";
}
}
//没有上传成功
else{
echo "上传失败!";
}
}
}
else{
$re_data = array("linkurl" => $img_url,width => $img_width,"height" => $img_height,"status" => 'no');
//返回json格式
echo json_encode($re_data);
}
//判断用户是否登录,5个参数,cookie,用户名、密码、用户上传目录、管理员上传目录
function check($cookie,$user,$pass,$udir,$adir){
$loginid = $cookie;
$userid = md5($user.$pass);
if($loginid == $userid) {
return $adir;
}
else {
return $udir;
}
}
?>
Loading…
Cancel
Save