@ -0,0 +1,72 @@ |
|||||||
|
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. |
@ -0,0 +1,43 @@ |
|||||||
|
# ImgURL |
||||||
|
ImgURL是一款简单、纯粹的图床程序,使用PHP + SQLite 3开发,不需要复杂的配置,做到开箱即用。 |
||||||
|
|
||||||
|
### 环境要求 |
||||||
|
* PHP >= 5.6 |
||||||
|
* 需要exif函数支持 |
||||||
|
* SQLite 3 |
||||||
|
|
||||||
|
### 开发计划 |
||||||
|
- [x] 图片上传与预览 |
||||||
|
- [x] 一键生成链接 |
||||||
|
- [x] 浏览与删除图片 |
||||||
|
- [x] 图片压缩 |
||||||
|
- [x] 图片鉴黄 |
||||||
|
- [ ] 图片水印 |
||||||
|
- [ ] API上传 |
||||||
|
|
||||||
|
### 安装 |
||||||
|
* 访问:<a href = "https://github.com/helloxz/imgurl/archive/master.zip" target = "_blank" rel = "nofollow">master.zip</a>下载最新版ImgURL程序,放到您的站点根目录并解压。 |
||||||
|
* 访问`http(s)://domain.com/check.php`获取配置信息,并记录下来。 |
||||||
|
* 修改`config.php`设置你自己的域名和密码,访问http(s)://domain.com/ 即可,就是这么简单。 |
||||||
|
* 更多设置请参考帮助文档:[https://doc.xiaoz.me/docs/imgurl](https://doc.xiaoz.me/docs/imgurl) |
||||||
|
|
||||||
|
|
||||||
|
### 安全设置 |
||||||
|
* 配置完毕后测试功能没问题,请删除根目录的`check.php` |
||||||
|
* Apache默认已经通过`.htaccess`文件来屏蔽数据库下载 |
||||||
|
* Nginx用户请在server段内添加如下配置,并重启Nginx |
||||||
|
``` |
||||||
|
location ~* \.(db3)$ { |
||||||
|
deny all; |
||||||
|
} |
||||||
|
``` |
||||||
|
|
||||||
|
### Demo |
||||||
|
* [http://test.imgurl.org/](http://test.imgurl.org/) ,账号:`xiaoz`,密码:`xiaoz.me` |
||||||
|
|
||||||
|
![](https://imgurl.org/upload/1804/3ccc55eeb47965c3.png) |
||||||
|
|
||||||
|
|
||||||
|
### 联系我 |
||||||
|
* Blog:[https://www.xiaoz.me/](https://www.xiaoz.me/) |
||||||
|
* QQ:337003006 |
@ -0,0 +1,38 @@ |
|||||||
|
<?php |
||||||
|
$title = "ImgURL - 简单、纯粹的图床程序。"; |
||||||
|
include_once("./tpl/user/header.php"); |
||||||
|
?> |
||||||
|
|
||||||
|
<div class="layui-container"> |
||||||
|
<div class="layui-row"> |
||||||
|
<div class="layui-col-lg10 layui-col-md-offset1" id = "about"> |
||||||
|
<h1>ImgURL</h1> |
||||||
|
<p>ImgURL是一款简洁、纯粹的图床程序,使用PHP + Sqlite开发,开箱即用。</p> |
||||||
|
<h3>功能与特色</h3> |
||||||
|
<ul> |
||||||
|
<li>拽拖上传图片、实时预览</li> |
||||||
|
<li>一键生成链接,一键复制</li> |
||||||
|
<li>基本图片管理</li> |
||||||
|
<li>TinyPNG图片压缩</li> |
||||||
|
<li>图片智能鉴黄</li> |
||||||
|
</ul> |
||||||
|
<h3>使用说明</h3> |
||||||
|
<ul> |
||||||
|
<li>图片最大上传限制为2M</li> |
||||||
|
<li>游客每天限制上传5张图片</li> |
||||||
|
<li>图片定期清理,重要图片建议自行下载ImgURL部署</li> |
||||||
|
<li>勿上传暴力、色情、反动图片,否则后果自负</li> |
||||||
|
<li>如果您使用ImgURL代表同意以上协议</li> |
||||||
|
</ul> |
||||||
|
<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/user/footer.php"); |
||||||
|
?> |
@ -0,0 +1,13 @@ |
|||||||
|
<?php |
||||||
|
include_once("../functions/class/class.admin.php"); |
||||||
|
//获取图片ID |
||||||
|
$id = $_GET['id']; |
||||||
|
$id = (int) $id; |
||||||
|
|
||||||
|
if((!isset($id) || ($id == ''))) { |
||||||
|
echo 'ID错误'; |
||||||
|
exit; |
||||||
|
} |
||||||
|
//删除图片 |
||||||
|
$pic->delete($id); |
||||||
|
?> |
@ -0,0 +1,50 @@ |
|||||||
|
<?php |
||||||
|
$title = "后台管理 - ImgURL"; |
||||||
|
include_once("../functions/class/class.admin.php"); |
||||||
|
// 载入头部 |
||||||
|
include_once("../tpl/admin/header.php"); |
||||||
|
//获取统计数据 |
||||||
|
$data = $pic->data(); |
||||||
|
?> |
||||||
|
|
||||||
|
<div class="layui-container" style = "margin-top:2em;"> |
||||||
|
<div class="layui-row"> |
||||||
|
<div class="layui-col-lg3"> |
||||||
|
<!-- 载入左侧导航栏 --> |
||||||
|
<?php include_once("../tpl/admin/left.php"); ?> |
||||||
|
</div> |
||||||
|
<!-- 后台内容部分 --> |
||||||
|
<div class="layui-col-lg9"> |
||||||
|
<div> |
||||||
|
<table class="layui-table"> |
||||||
|
<colgroup> |
||||||
|
<col width="33%"> |
||||||
|
<col width="33%"> |
||||||
|
<col> |
||||||
|
</colgroup> |
||||||
|
<thead> |
||||||
|
<tr> |
||||||
|
<th>本月上传数量</th> |
||||||
|
<th>今日上传</th> |
||||||
|
<th>可疑图片</th> |
||||||
|
</tr> |
||||||
|
</thead> |
||||||
|
<tbody> |
||||||
|
<tr> |
||||||
|
<td><?php echo $data['month']; ?></td> |
||||||
|
<td><?php echo $data['day']; ?></td> |
||||||
|
<td><?php echo $data['level']; ?></td> |
||||||
|
</tr> |
||||||
|
</tbody> |
||||||
|
</table> |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
<!-- 后台内容部分END --> |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
|
||||||
|
<?php |
||||||
|
// 载入页脚 |
||||||
|
// 载入头部 |
||||||
|
include_once("../tpl/admin/footer.php"); |
||||||
|
?> |
@ -0,0 +1,47 @@ |
|||||||
|
<?php |
||||||
|
$title = "登录 - ImgURL"; |
||||||
|
// 简单的判断用户是否登录 |
||||||
|
if(isset($_COOKIE['user'])) { |
||||||
|
header('Location:index.php'); |
||||||
|
} |
||||||
|
?> |
||||||
|
<?php |
||||||
|
// 载入头部 |
||||||
|
include_once("../tpl/admin/header.php"); |
||||||
|
?> |
||||||
|
<!-- 内容部分 --> |
||||||
|
<div id="container"> |
||||||
|
<div class="layui-container"> |
||||||
|
<div class="layui-row"> |
||||||
|
<div class="layui-col-lg6 layui-col-md-offset3"> |
||||||
|
<!-- 登录表单 --> |
||||||
|
<div class="login"> |
||||||
|
<div class="layui-form-item"> |
||||||
|
<label class="layui-form-label">用户名</label> |
||||||
|
<div class="layui-input-block"> |
||||||
|
<input id = "user" type="text" name="title" required lay-verify="required" placeholder="请输入用户名" autocomplete="off" class="layui-input"> |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
<div class="layui-form-item"> |
||||||
|
<label class="layui-form-label">密码</label> |
||||||
|
<div class="layui-input-block"> |
||||||
|
<input id = "password" type="password" name="password" required lay-verify="required" placeholder="请输入密码" autocomplete="off" class="layui-input"> |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
<div class="layui-form-item"> |
||||||
|
<div class="layui-input-block"> |
||||||
|
<button class="layui-btn" lay-submit lay-filter="formDemo" onclick = "login()">登录</button> |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
<!-- 登录表单END --> |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
<!-- 内容部分end --> |
||||||
|
<?php |
||||||
|
// 载入页脚 |
||||||
|
// 载入头部 |
||||||
|
include_once("../tpl/admin/footer.php"); |
||||||
|
?> |
@ -0,0 +1,7 @@ |
|||||||
|
<?php |
||||||
|
//清除COOKIE |
||||||
|
setcookie("user", '', time()-3600,"/"); |
||||||
|
setcookie("password", '', time()-3600,"/"); |
||||||
|
|
||||||
|
echo "<script>window.location.href = './login.php'</script>"; |
||||||
|
?> |
@ -0,0 +1,26 @@ |
|||||||
|
<?php |
||||||
|
include_once("../functions/class/class.admin.php"); |
||||||
|
//获取操作类型 |
||||||
|
$type = $_GET['type']; |
||||||
|
|
||||||
|
//获取图片ID |
||||||
|
$id = $_GET['id']; |
||||||
|
$id = (int) $id; |
||||||
|
|
||||||
|
if((!isset($id) || ($id == ''))) { |
||||||
|
echo 'ID错误'; |
||||||
|
exit; |
||||||
|
} |
||||||
|
|
||||||
|
//判断需要操作的类型 |
||||||
|
switch ($type) { |
||||||
|
case 'cdubious': |
||||||
|
//取消图片可疑状态 |
||||||
|
$pic->cdubious($id); |
||||||
|
break; |
||||||
|
|
||||||
|
default: |
||||||
|
# code... |
||||||
|
break; |
||||||
|
} |
||||||
|
?> |
@ -0,0 +1,54 @@ |
|||||||
|
<?php |
||||||
|
$title = "后台管理 - ImgURL"; |
||||||
|
include_once("../functions/class/class.admin.php"); |
||||||
|
// 载入头部 |
||||||
|
include_once("../tpl/admin/header.php"); |
||||||
|
|
||||||
|
// 获取类型 |
||||||
|
$type = $_GET['type']; |
||||||
|
//获取页数 |
||||||
|
$page = $_GET['page']; |
||||||
|
//查询图片 |
||||||
|
$imgs = $pic->querypic($type,$page); |
||||||
|
|
||||||
|
$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 layui-col-space10"> |
||||||
|
<?php foreach ($imgs as $img) { |
||||||
|
$imgurl = $config['domain'].$img['path']; |
||||||
|
$id = $img['id']; |
||||||
|
?> |
||||||
|
<div class="layui-col-lg4 picadmin"> |
||||||
|
<a id = "imgid<?php echo $id; ?>" href="javascript:;" onclick = "adminshow('<?php echo $imgurl ?>',<?php echo $id; ?>)"><img src="<?php echo $imgurl; ?>"></a> |
||||||
|
</div> |
||||||
|
<?php } ?> |
||||||
|
</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"); |
||||||
|
?> |
@ -0,0 +1,108 @@ |
|||||||
|
<?php |
||||||
|
$title = "后台管理 - ImgURL"; |
||||||
|
include_once("../functions/class/class.admin.php"); |
||||||
|
// 载入头部 |
||||||
|
include_once("../tpl/admin/header.php"); |
||||||
|
|
||||||
|
// 获取类型 |
||||||
|
$type = $_GET['type']; |
||||||
|
//获取页数 |
||||||
|
$page = $_GET['page']; |
||||||
|
//查询图片 |
||||||
|
$imgs = $pic->querypic($type,$page); |
||||||
|
|
||||||
|
$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"> |
||||||
|
<!-- 表格 --> |
||||||
|
<table class="layui-table"> |
||||||
|
<colgroup> |
||||||
|
<col width="30"> |
||||||
|
<col width="280"> |
||||||
|
<col width="120"> |
||||||
|
<col width="120"> |
||||||
|
<col width="120"> |
||||||
|
<col> |
||||||
|
</colgroup> |
||||||
|
<thead> |
||||||
|
<tr> |
||||||
|
<th>ID</th> |
||||||
|
<th>图片路径(点击可查看)</th> |
||||||
|
<th>IP</th> |
||||||
|
<th>日期</th> |
||||||
|
<th>是否压缩</th> |
||||||
|
<th>操作</th> |
||||||
|
</tr> |
||||||
|
</thead> |
||||||
|
<tbody> |
||||||
|
<?php foreach ($imgs as $img) { |
||||||
|
$imgurl = $config['domain'].$img['path']; |
||||||
|
$id = $img['id']; |
||||||
|
$size = filesize('../'.$img['path']); //文件大小计算 |
||||||
|
$size = round($size / 1024)."kb"; |
||||||
|
if($img['compress'] == 0) { |
||||||
|
$compress = array( |
||||||
|
"css" => "layui-btn layui-btn-xs layui-btn-danger", |
||||||
|
"content" => "否" |
||||||
|
); |
||||||
|
} |
||||||
|
else{ |
||||||
|
$compress = array( |
||||||
|
"css" => "layui-btn layui-btn-xs layui-btn-normal", |
||||||
|
"content" => "是" |
||||||
|
); |
||||||
|
} |
||||||
|
?> |
||||||
|
<tr id = "imgid<?php echo $id; ?>"> |
||||||
|
<td><?php echo $id; ?></td> |
||||||
|
<td><a id = "imgid<?php echo $id; ?>" href="javascript:;" onclick = "adminshow('<?php echo $imgurl ?>',<?php echo $id; ?>)"><?php echo $img['path']; ?></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 = "<?php echo $compress['css']; ?>"><?php echo $compress['content']; ?></a> |
||||||
|
<a href="javascript:;" class = "layui-btn layui-btn-xs layui-btn-disabled"><?php echo $size; ?></a> |
||||||
|
</td> |
||||||
|
<td> |
||||||
|
<?php if($type == 'dubious'){ ?> |
||||||
|
<a href="javascript:;" class="layui-btn layui-btn-xs layui-btn-normal" onclick = "cdubious(<?php echo $id; ?>)">非可疑</a> |
||||||
|
<?php }else{ ?> |
||||||
|
<a href="javascript:;" class="layui-btn layui-btn-xs layui-btn-normal" onclick = "compress(<?php echo $id; ?>)">压缩</a> |
||||||
|
<?php } ?> |
||||||
|
<a href="javascript:;" class="layui-btn layui-btn-xs layui-btn-danger" onclick = "deleteimg(<?php echo $id; ?>)">删除</a> |
||||||
|
</td> |
||||||
|
</tr> |
||||||
|
<?php } ?> |
||||||
|
</tbody> |
||||||
|
</table> |
||||||
|
<!-- 表格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"); |
||||||
|
?> |
@ -0,0 +1,34 @@ |
|||||||
|
<?php |
||||||
|
echo "<h1>请将以下信息填写到配置文件config.php</h1>"; |
||||||
|
//获取当前端口 |
||||||
|
$port = $_SERVER["SERVER_PORT"]; |
||||||
|
//对端口进行判断 |
||||||
|
switch ( $port ) |
||||||
|
{ |
||||||
|
case 80: |
||||||
|
$protocol = "http://"; |
||||||
|
$port = ''; |
||||||
|
break; |
||||||
|
case 443: |
||||||
|
$protocol = "https://"; |
||||||
|
$port = ''; |
||||||
|
break; |
||||||
|
default: |
||||||
|
$protocol = "http://"; |
||||||
|
$port = ":".$port; |
||||||
|
break; |
||||||
|
} |
||||||
|
//获取项目绝对路径 |
||||||
|
$thedir = __DIR__; |
||||||
|
$thedir = str_replace("\\","/",$thedir).'/'; |
||||||
|
echo "项目绝对路径:".$thedir."<br />"; |
||||||
|
|
||||||
|
//或如URI |
||||||
|
$uri = $_SERVER["REQUEST_URI"]; |
||||||
|
$uri = str_replace("check.php","",$uri); |
||||||
|
//组合为完整的URL |
||||||
|
$domain = $protocol.$_SERVER['SERVER_NAME'].$port.$uri; |
||||||
|
echo "当前域名为:".$domain; |
||||||
|
|
||||||
|
echo "<h1>配置完成后测试网站功能正常,请删除此文件。</h1>"; |
||||||
|
?> |
@ -0,0 +1,38 @@ |
|||||||
|
<?php |
||||||
|
//项目绝对路径 |
||||||
|
define("APP","D:/wwwroot/imgurl/"); |
||||||
|
|
||||||
|
//载入数据库类 |
||||||
|
include_once(APP."functions/class/Medoo.php"); |
||||||
|
|
||||||
|
$config = array( |
||||||
|
"domain" => "http://localhost/imgurl/", //站点地址 |
||||||
|
"user" => "xiaoz", //管理员账号 |
||||||
|
"password" => "xiaoz.me", //管理员密码 |
||||||
|
"limit" => 5, //游客上传数量限制 |
||||||
|
"watermark" => "imgurl.org", //图片文字水印 |
||||||
|
"userdir" => "temp", //游客上传目录,一般不用做修改 |
||||||
|
"admindir" => "upload", //管理员上传目录,一般不用做修改 |
||||||
|
"datadir" => APP."db/imgurl.db3" //数据库路径,一般不用做修改 |
||||||
|
); |
||||||
|
// TinyPNG压缩图片 |
||||||
|
$tinypng = array( |
||||||
|
"option" => false, |
||||||
|
"key" => array( |
||||||
|
"xxx", //TinyPNG API KEY,支持填写多行key |
||||||
|
"xxx-", //如果只有一个key,请删除此行 |
||||||
|
) |
||||||
|
); |
||||||
|
//ModerateContent 图片鉴黄,请参考帮助文档:https://doc.xiaoz.me/docs/imgurl/imgurl-jh |
||||||
|
$ModerateContent = array( |
||||||
|
"option" => false, |
||||||
|
"key" => "xxx" |
||||||
|
); |
||||||
|
|
||||||
|
//初始化Medoo |
||||||
|
use Medoo\Medoo; |
||||||
|
$database = new medoo([ |
||||||
|
'database_type' => 'sqlite', |
||||||
|
'database_file' => $config['datadir'] |
||||||
|
]); |
||||||
|
?> |
@ -0,0 +1,94 @@ |
|||||||
|
<?php |
||||||
|
//载入配置文件 |
||||||
|
include_once("./config.php"); |
||||||
|
//载入TinyPNG |
||||||
|
require_once("functions/tinypng/Tinify/Exception.php"); |
||||||
|
require_once("functions/tinypng/Tinify/ResultMeta.php"); |
||||||
|
require_once("functions/tinypng/Tinify/Result.php"); |
||||||
|
require_once("functions/tinypng/Tinify/Source.php"); |
||||||
|
require_once("functions/tinypng/Tinify/Client.php"); |
||||||
|
require_once("functions/tinypng/Tinify.php"); |
||||||
|
|
||||||
|
//初始化值 |
||||||
|
$dispose['compress'] = 0; |
||||||
|
$dispose['level'] = 0; |
||||||
|
|
||||||
|
//获取ID |
||||||
|
$id = $_GET['id']; |
||||||
|
$id = (int)$id; |
||||||
|
//获取tinypng key |
||||||
|
$tinykey = array_rand($tinypng['key']); //取出数组键值 |
||||||
|
$tinykey = $tinypng['key'][$tinykey]; |
||||||
|
//获取ModerateContent key |
||||||
|
$mckey = $ModerateContent['key']; |
||||||
|
|
||||||
|
//如果ID不存在或为空 |
||||||
|
if((!isset($id)) || ($id == '')) { |
||||||
|
echo 'ID错误!'; |
||||||
|
exit; |
||||||
|
} |
||||||
|
|
||||||
|
//查询对应信息 |
||||||
|
$info = $database->get("imginfo",[ |
||||||
|
"id", |
||||||
|
"path", |
||||||
|
"compress", |
||||||
|
"level" |
||||||
|
],[ |
||||||
|
"id" => $id |
||||||
|
]); |
||||||
|
|
||||||
|
//组合为完整的URL地址 |
||||||
|
$imgurl = $config['domain'].$info['path']; |
||||||
|
//获取压缩状态 |
||||||
|
$compress = $info['compress']; |
||||||
|
//获取图片等级 |
||||||
|
$level = $info['level']; |
||||||
|
//获取文件后缀名 |
||||||
|
$suffix = substr(strrchr($info['path'], '.'), 1); |
||||||
|
if(($suffix == 'png') || ($suffix == 'jpg')) { |
||||||
|
$iscompress = 1; |
||||||
|
} |
||||||
|
|
||||||
|
//对图片进行压缩 |
||||||
|
if(($tinypng['option'] == true) && ($iscompress == 1) && ($compress == 0)) { |
||||||
|
//初始化 |
||||||
|
\Tinify\setKey($tinykey); |
||||||
|
$source = \Tinify\fromUrl($imgurl); |
||||||
|
//覆盖原有图片 |
||||||
|
$source->toFile($info['path']); |
||||||
|
//更新数据库 |
||||||
|
$database->update("imginfo",[ |
||||||
|
"compress" => 1 |
||||||
|
],[ |
||||||
|
"id" => $id |
||||||
|
]); |
||||||
|
$dispose['compress'] = 1; |
||||||
|
} |
||||||
|
//对图片进行鉴黄 |
||||||
|
if(($ModerateContent['option'] == true) && ($level == 0)) { |
||||||
|
$apiurl = "https://www.moderatecontent.com/api/v2?key=".$mckey."&url=".$imgurl; |
||||||
|
$curl = curl_init($apiurl); |
||||||
|
|
||||||
|
curl_setopt($curl, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.117 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); |
||||||
|
|
||||||
|
$html = curl_exec($curl); |
||||||
|
curl_close($curl); |
||||||
|
|
||||||
|
//更新数据库 |
||||||
|
$html = json_decode($html); |
||||||
|
$level = $html->rating_index; |
||||||
|
$database->update("imginfo",["level" => $level],["id" => $id]); |
||||||
|
$dispose['level'] = $level; |
||||||
|
} |
||||||
|
|
||||||
|
//返回json数据 |
||||||
|
$dispose['code'] = 1; |
||||||
|
$dispose = json_encode($dispose); |
||||||
|
echo $dispose; |
||||||
|
?> |
After Width: | Height: | Size: 4.2 KiB |
@ -0,0 +1,35 @@ |
|||||||
|
<?php |
||||||
|
$title = "探索发现 - ImgURL"; |
||||||
|
include_once("./tpl/user/header.php"); |
||||||
|
// 载入类 |
||||||
|
include_once("config.php"); |
||||||
|
|
||||||
|
|
||||||
|
//初始化 |
||||||
|
$domain = $config['domain']; |
||||||
|
$userdir = $config['userdir']; |
||||||
|
$sql = "SELECT `id`,`path` FROM `imginfo` WHERE (`dir` = '$userdir' AND `level` < 3) ORDER BY random() LIMIT 12"; |
||||||
|
$datas = $database->query($sql)->fetchAll(); |
||||||
|
|
||||||
|
?> |
||||||
|
|
||||||
|
<div class="layui-container" style = "margin-bottom:6em;"> |
||||||
|
<div class="layui-row"> |
||||||
|
<div class="msg"><i class="layui-icon"></i> 此页面随机显示12张图片,刷新页面可重新随机。</div> |
||||||
|
<div id = "found-img" class = "layui-col-space20"> |
||||||
|
<?php foreach ($datas as $img) { |
||||||
|
$imgurl = $domain.$img['path']; |
||||||
|
$imgid = $img['id']; |
||||||
|
?> |
||||||
|
<div class="layui-col-lg4"> |
||||||
|
<a href="javascript:;" onclick = "userpreview('<?php echo $imgurl ?>',<?php echo $imgid; ?>)"><img src="<?php echo $imgurl ?>"></a> |
||||||
|
</div> |
||||||
|
<?php } ?> |
||||||
|
</div> |
||||||
|
|
||||||
|
</div> |
||||||
|
</div> |
||||||
|
|
||||||
|
<?php |
||||||
|
include_once("./tpl/user/footer.php"); |
||||||
|
?> |
@ -0,0 +1,27 @@ |
|||||||
|
<?php |
||||||
|
// 控制器 |
||||||
|
// 载入类 |
||||||
|
include_once("class/class.user.php"); |
||||||
|
$type = $_GET['type']; |
||||||
|
switch ($type) { |
||||||
|
case 'login': |
||||||
|
// 用户登录时输入的信息 |
||||||
|
$user = array( |
||||||
|
"user" => $_POST['user'], |
||||||
|
"password" => $_POST['password'] |
||||||
|
); |
||||||
|
// 配置文件里面的用户信息 |
||||||
|
$admin = array( |
||||||
|
"user" => $config['user'], |
||||||
|
"password" => $config['password'] |
||||||
|
); |
||||||
|
$basis->login($user,$admin); |
||||||
|
break; |
||||||
|
case 'check': |
||||||
|
$basis->check($config); |
||||||
|
break; |
||||||
|
default: |
||||||
|
# code... |
||||||
|
break; |
||||||
|
} |
||||||
|
?> |
@ -0,0 +1,159 @@ |
|||||||
|
<?php |
||||||
|
error_reporting(E_ALL^E_NOTICE^E_WARNING^E_DEPRECATED); |
||||||
|
// 载入配置文件 |
||||||
|
include_once("../config.php"); |
||||||
|
|
||||||
|
class Admin{ |
||||||
|
var $config; |
||||||
|
var $database; |
||||||
|
function __construct($config,$database) { |
||||||
|
$this->config = $config; |
||||||
|
$this->database = $database; |
||||||
|
$user1 = $config['user'].md5("imgurl".$config['password']); |
||||||
|
// echo $user1; |
||||||
|
//COOKIES里面的信息 |
||||||
|
$user2 = $_COOKIE['user'].$_COOKIE['password']; |
||||||
|
|
||||||
|
//如果两者信息相符,说明已登录 |
||||||
|
if($user1 != $user2) { |
||||||
|
echo '权限不足,请先登录!'; |
||||||
|
//清理cookie |
||||||
|
setcookie("user", '', time()-3600,"/"); |
||||||
|
setcookie("password", '', time()-3600,"/"); |
||||||
|
header('Location:login.php'); |
||||||
|
exit; |
||||||
|
} |
||||||
|
} |
||||||
|
//查询图片 |
||||||
|
function querypic($type,$page){ |
||||||
|
$config = $this->config; |
||||||
|
$database = $this->database; |
||||||
|
|
||||||
|
//分页计算 |
||||||
|
$start = ($page - 1) * 12; |
||||||
|
$end = $page * 12; |
||||||
|
|
||||||
|
if(($page == '') || (!isset($page))) { |
||||||
|
$page = 1; |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
//判断类型 |
||||||
|
switch ($type) { |
||||||
|
case 'user': |
||||||
|
// echo 'dsd'; |
||||||
|
$datas = $database->select("imginfo", "*", [ |
||||||
|
"dir" => $config['userdir'], |
||||||
|
"ORDER" => ["id" => "DESC"], |
||||||
|
"LIMIT" => [$start,$end] |
||||||
|
]); |
||||||
|
//var_dump( $database->log() ); |
||||||
|
//exit; |
||||||
|
return $datas; |
||||||
|
break; |
||||||
|
case 'admin': |
||||||
|
$datas = $database->select("imginfo", "*", [ |
||||||
|
"dir" => $config['admindir'], |
||||||
|
"ORDER" => ["id" => "DESC"], |
||||||
|
"LIMIT" => [$start,$end] |
||||||
|
]); |
||||||
|
return $datas; |
||||||
|
break; |
||||||
|
case 'dubious': |
||||||
|
$datas = $database->select("imginfo", "*", [ |
||||||
|
"level" => 3, |
||||||
|
"ORDER" => ["id" => "DESC"], |
||||||
|
"LIMIT" => [$start,$end] |
||||||
|
]); |
||||||
|
return $datas; |
||||||
|
break; |
||||||
|
default: |
||||||
|
echo 'dsddsd'; |
||||||
|
break; |
||||||
|
} |
||||||
|
} |
||||||
|
//删除一张图片 |
||||||
|
function delete($id){ |
||||||
|
$config = $this->config; |
||||||
|
$database = $this->database; |
||||||
|
//先查询数据库获取图片路径 |
||||||
|
$path = $database->get("imginfo","path",[ |
||||||
|
"id" => $id |
||||||
|
]); |
||||||
|
|
||||||
|
|
||||||
|
//完整的图片路径 |
||||||
|
$imgpath = APP.$path; |
||||||
|
//如果图片删除成功,将再次删除数据库 |
||||||
|
|
||||||
|
if(unlink($imgpath)) { |
||||||
|
$del = $database->delete("imginfo", [ |
||||||
|
"AND" => [ |
||||||
|
"id" => $id |
||||||
|
] |
||||||
|
]); |
||||||
|
echo 'ok'; |
||||||
|
} |
||||||
|
else{ |
||||||
|
echo '删除失败!'; |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
|
//统计数据 |
||||||
|
function data() { |
||||||
|
//获取当前月份 |
||||||
|
$themonth = date('Y-m',time()); |
||||||
|
//获取当天时间 |
||||||
|
$theday = date('Y-m-d',time()); |
||||||
|
|
||||||
|
//统计本月上传图片数量 |
||||||
|
$month = $this->database->count("imginfo",[ |
||||||
|
"date[~]" => $themonth |
||||||
|
]); |
||||||
|
|
||||||
|
$day = $this->database->count("imginfo",[ |
||||||
|
"date" => $theday |
||||||
|
]); |
||||||
|
|
||||||
|
//统计可疑图片 |
||||||
|
$level = $this->database->count("imginfo",[ |
||||||
|
"level" => 3 |
||||||
|
]); |
||||||
|
|
||||||
|
//返回数据 |
||||||
|
$redata = array( |
||||||
|
"month" => $month, |
||||||
|
"day" => $day, |
||||||
|
"level" => $level |
||||||
|
); |
||||||
|
return $redata; |
||||||
|
} |
||||||
|
//取消图片可疑状态 |
||||||
|
function cdubious($id){ |
||||||
|
$database = $this->database; |
||||||
|
$database->update("imginfo",[ |
||||||
|
"level" => 1 |
||||||
|
],[ |
||||||
|
"id" => $id |
||||||
|
]); |
||||||
|
echo 'ok'; |
||||||
|
} |
||||||
|
//对某张图片进行压缩,未开发完成 |
||||||
|
function compress($id,$tinypng){ |
||||||
|
$database = $this->database; |
||||||
|
$config = $this->config; |
||||||
|
if($tinypng['option'] != true){ |
||||||
|
$compress['code'] = 0; |
||||||
|
$compress['msg'] = "未开启图片压缩功能!"; |
||||||
|
} |
||||||
|
else{ |
||||||
|
$getdata = $database->get("imginfo","*",[ |
||||||
|
"id" => $id |
||||||
|
]); |
||||||
|
|
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
$pic = new Admin($config,$database); |
||||||
|
?> |
@ -0,0 +1,88 @@ |
|||||||
|
<?php |
||||||
|
error_reporting(E_ALL^E_NOTICE^E_WARNING^E_DEPRECATED); |
||||||
|
/* |
||||||
|
图像处理类 |
||||||
|
*/ |
||||||
|
include_once("../../config.php"); |
||||||
|
//载入TinyPNG |
||||||
|
require_once(APP."functions/tinypng/Tinify/Exception.php"); |
||||||
|
require_once(APP."functions/tinypng/Tinify/ResultMeta.php"); |
||||||
|
require_once(APP."functions/tinypng/Tinify/Result.php"); |
||||||
|
require_once(APP."functions/tinypng/Tinify/Source.php"); |
||||||
|
require_once(APP."functions/tinypng/Tinify/Client.php"); |
||||||
|
require_once(APP."functions/tinypng/Tinify.php"); |
||||||
|
|
||||||
|
//初始化值 |
||||||
|
$dispose['compress'] = 0; |
||||||
|
$dispose['level'] = 0; |
||||||
|
|
||||||
|
//获取ID |
||||||
|
$id = $_GET['id']; |
||||||
|
$id = (int)$id; |
||||||
|
//获取tinypng key |
||||||
|
$tinykey = array_rand($tinypng['key']); //取出数组键值 |
||||||
|
$tinykey = $tinypng['key'][$tinykey]; |
||||||
|
$iscompress = 0; |
||||||
|
|
||||||
|
//如果ID不存在或为空 |
||||||
|
if((!isset($id)) || ($id == '')) { |
||||||
|
echo 'ID错误!'; |
||||||
|
exit; |
||||||
|
} |
||||||
|
|
||||||
|
//如果没有启用压缩 |
||||||
|
if($tinypng['option'] != true){ |
||||||
|
echo '未启用压缩功能!'; |
||||||
|
exit; |
||||||
|
} |
||||||
|
|
||||||
|
//查询对应信息 |
||||||
|
$info = $database->get("imginfo",[ |
||||||
|
"id", |
||||||
|
"path", |
||||||
|
"compress", |
||||||
|
"level" |
||||||
|
],[ |
||||||
|
"id" => $id |
||||||
|
]); |
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//组合为完整的URL地址 |
||||||
|
$imgurl = $config['domain'].$info['path']; |
||||||
|
//获取压缩状态 |
||||||
|
$compress = $info['compress']; |
||||||
|
//获取图片等级 |
||||||
|
$level = $info['level']; |
||||||
|
//获取文件后缀名 |
||||||
|
$suffix = substr(strrchr($info['path'], '.'), 1); |
||||||
|
if(($suffix == 'png') || ($suffix == 'jpg')) { |
||||||
|
$iscompress = 1; |
||||||
|
} |
||||||
|
if($iscompress == 0){ |
||||||
|
echo '该后缀不支持压缩!'; |
||||||
|
exit; |
||||||
|
} |
||||||
|
if($compress == 1){ |
||||||
|
echo '该图片已经压缩!'; |
||||||
|
exit; |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
//对图片进行压缩 |
||||||
|
if(($tinypng['option'] == true) && ($iscompress == 1) && ($compress == 0)) { |
||||||
|
//初始化 |
||||||
|
\Tinify\setKey($tinykey); |
||||||
|
$source = \Tinify\fromUrl($imgurl); |
||||||
|
//覆盖原有图片 |
||||||
|
$source->toFile($info['path']); |
||||||
|
//更新数据库 |
||||||
|
$database->update("imginfo",[ |
||||||
|
"compress" => 1 |
||||||
|
],[ |
||||||
|
"id" => $id |
||||||
|
]); |
||||||
|
$dispose['compress'] = 1; |
||||||
|
echo '压缩成功!'; |
||||||
|
} |
||||||
|
?> |
@ -0,0 +1,112 @@ |
|||||||
|
<?php |
||||||
|
error_reporting(E_ALL^E_NOTICE^E_WARNING^E_DEPRECATED); |
||||||
|
// 载入配置文件 |
||||||
|
include_once("../config.php"); |
||||||
|
|
||||||
|
class User{ |
||||||
|
var $config; |
||||||
|
var $database; |
||||||
|
|
||||||
|
//构造函数 |
||||||
|
public function __construct($config,$database){ |
||||||
|
$this->config = $config; |
||||||
|
$this->database = $database; |
||||||
|
} |
||||||
|
|
||||||
|
// 用户登录,两个参数,一个是用户输入,一个是配置文件里面的用户信息 |
||||||
|
function login($user,$admin){ |
||||||
|
|
||||||
|
// 用户输入的信息进行md5加密和对比 |
||||||
|
$pw1 = md5($user['user'].$user['password']); |
||||||
|
$pw2 = md5($admin['user'].$admin['password']); |
||||||
|
|
||||||
|
|
||||||
|
// 判断用户名密码是否正确 |
||||||
|
if($pw1 != $pw2){ |
||||||
|
echo '用户名或密码不正确!'; |
||||||
|
setcookie("user", '', time()-3600,"/"); |
||||||
|
setcookie("password", '', time()-3600,"/"); |
||||||
|
exit; |
||||||
|
} |
||||||
|
else{ |
||||||
|
$password = md5("imgurl".$admin['password']); |
||||||
|
//生成cookie |
||||||
|
setcookie("user", $user['user'], time()+3600 * 24 * 30,"/"); |
||||||
|
setcookie("password", $password, time()+3600 * 24 * 30,"/"); |
||||||
|
echo "<script>window.location.href = './index.php'</script>"; |
||||||
|
exit; |
||||||
|
} |
||||||
|
} |
||||||
|
//判断用户状态 |
||||||
|
function check($userinfo){ |
||||||
|
//配置文件里面的用户信息 |
||||||
|
$user1 = $userinfo['user'].md5("imgurl".$userinfo['password']); |
||||||
|
// echo $user1; |
||||||
|
//COOKIES里面的信息 |
||||||
|
$user2 = $_COOKIE['user'].$_COOKIE['password']; |
||||||
|
|
||||||
|
//如果两者信息相符,说明已登录 |
||||||
|
if($user1 == $user2) { |
||||||
|
return'islogin'; |
||||||
|
exit; |
||||||
|
} |
||||||
|
else{ |
||||||
|
return 'nologin'; |
||||||
|
setcookie("user", '', time()-3600,"/"); |
||||||
|
setcookie("password", '', time()-3600,"/"); |
||||||
|
exit; |
||||||
|
} |
||||||
|
} |
||||||
|
//检查某张图片是否已经上传 |
||||||
|
function isupload($path){ |
||||||
|
$num = $this->database->count("imginfo",["path" => $path]); |
||||||
|
|
||||||
|
//如果图片已经上传过,直接返回图片信息 |
||||||
|
if($num >=1) { |
||||||
|
$info = $this->database->get("imginfo","*",["path" => $path]); |
||||||
|
$imgurl = $this->config['domain'].$path; |
||||||
|
//返回json数据 |
||||||
|
$redata = array( |
||||||
|
"code" => 1, |
||||||
|
"id" => $info['id'], |
||||||
|
"url" => $imgurl, |
||||||
|
"width" => 0, |
||||||
|
"height" => 0 |
||||||
|
); |
||||||
|
echo $redata = json_encode($redata); |
||||||
|
exit; |
||||||
|
} |
||||||
|
} |
||||||
|
//限制访客上传数量 |
||||||
|
function limitnum(){ |
||||||
|
//获取访客IP |
||||||
|
$ip = $_SERVER['REMOTE_ADDR']; |
||||||
|
//获取当前时间 |
||||||
|
$date = date('Y-m-d',time()); |
||||||
|
//获取配置文件限额 |
||||||
|
$limit = $this->config['limit']; |
||||||
|
//获取用户上传目录 |
||||||
|
$dir = $this->config['userdir']; |
||||||
|
//查询数据库统计数量 |
||||||
|
$database = $this->database; |
||||||
|
$num = $database->count("imginfo",[ |
||||||
|
"date" => $date, |
||||||
|
"ip" => $ip, |
||||||
|
"dir" => $dir |
||||||
|
]); |
||||||
|
|
||||||
|
if($num >= $limit) { |
||||||
|
$redata = array( |
||||||
|
"code" => 0, |
||||||
|
"msg" => "上传达到限制!" |
||||||
|
); |
||||||
|
echo $redata = json_encode($redata); |
||||||
|
exit; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
//自动初始化完成一些基础操作 |
||||||
|
$basis = new User($config,$database); |
||||||
|
?> |
@ -0,0 +1,85 @@ |
|||||||
|
<?php |
||||||
|
// +------------------------------------------------------------------------+ |
||||||
|
// | class.upload.zh_CN.php | |
||||||
|
// +------------------------------------------------------------------------+ |
||||||
|
// | Copyright (c) caoshiwei 2008. All rights reserved. | |
||||||
|
// | Version 0.25 | |
||||||
|
// | Last modified 09/29/2008 | |
||||||
|
// | Email caoshiwei@gmail.com | |
||||||
|
// | Web http://www.hfut.edu.cn | |
||||||
|
// +------------------------------------------------------------------------+ |
||||||
|
// | This program is free software; you can redistribute it and/or modify | |
||||||
|
// | it under the terms of the GNU General Public License version 2 as | |
||||||
|
// | published by the Free Software Foundation. | |
||||||
|
// | | |
||||||
|
// | This program is distributed in the hope that it will be useful, | |
||||||
|
// | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
||||||
|
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
||||||
|
// | GNU General Public License for more details. | |
||||||
|
// | | |
||||||
|
// | You should have received a copy of the GNU General Public License | |
||||||
|
// | along with this program; if not, write to the | |
||||||
|
// | Free Software Foundation, Inc., 59 Temple Place, Suite 330, | |
||||||
|
// | Boston, MA 02111-1307 USA | |
||||||
|
// | | |
||||||
|
// | Please give credit on sites that use class.upload and submit changes | |
||||||
|
// | of the script so other people can use them as well. | |
||||||
|
// | This script is free to use, don't abuse. | |
||||||
|
// +------------------------------------------------------------------------+ |
||||||
|
|
||||||
|
/** |
||||||
|
* Class upload Chinese translation |
||||||
|
* |
||||||
|
* @version 0.25 |
||||||
|
* @author Shiwei Cao (caoshiwei@gmail.com) |
||||||
|
* @license http://opensource.org/licenses/gpl-license.php GNU Public License |
||||||
|
* @copyright Shiwei Cao |
||||||
|
* @package cmf |
||||||
|
* @subpackage external |
||||||
|
*/ |
||||||
|
|
||||||
|
$translation = array(); |
||||||
|
$translation['file_error'] = '文件错误,请重试。'; |
||||||
|
$translation['local_file_missing'] = '本地文件不存在。'; |
||||||
|
$translation['local_file_not_readable'] = '本地文件不可读。'; |
||||||
|
$translation['uploaded_too_big_ini'] = '文件上件出错 (上传的文件大小超过了php.ini中upload_max_filesize设置的大小)。'; |
||||||
|
$translation['uploaded_too_big_html'] = '文件上件出错 (上传的文件大小超过了HTML 表单设置的大小)。'; |
||||||
|
$translation['uploaded_partial'] = '文件上件出错 (上传的文件部分丢失)。'; |
||||||
|
$translation['uploaded_missing'] = '文件上件出错 (上传文件丢失)。'; |
||||||
|
$translation['uploaded_unknown'] = '文件上件出错 (未知错误).'; |
||||||
|
$translation['try_again'] = '文件上件出错。 请重试。'; |
||||||
|
$translation['file_too_big'] = '文件太大。'; |
||||||
|
$translation['no_mime'] = '未知文件类型。'; |
||||||
|
$translation['incorrect_file'] = '不正确的文件格式。'; |
||||||
|
$translation['image_too_wide'] = '图片宽度太大。'; |
||||||
|
$translation['image_too_narrow'] = '图片宽度太小。'; |
||||||
|
$translation['image_too_high'] = '图片高度太大。'; |
||||||
|
$translation['image_too_short'] = '图片高度太小。'; |
||||||
|
$translation['ratio_too_high'] = '图片宽/高比率太高(图片宽度太大)。'; |
||||||
|
$translation['ratio_too_low'] = '图片宽/高比率太低(图片高度太大).'; |
||||||
|
$translation['too_many_pixels'] = '图片位数太高。'; |
||||||
|
$translation['not_enough_pixels'] = '图片位数不够'; |
||||||
|
$translation['file_not_uploaded'] = '文件未上传,不能进行处理。'; |
||||||
|
$translation['already_exists'] = '%s 已经存在,请更换文件名。'; |
||||||
|
$translation['temp_file_missing'] = '处理的(临时)源文件不正确,不能进行处理。'; |
||||||
|
$translation['source_missing'] = '已上传的文件丢失,不能进行处理。'; |
||||||
|
$translation['destination_dir'] = '目标文件目录不能被创建,不能进行处理。'; |
||||||
|
$translation['destination_dir_missing'] = '目标文件目录不存在,不能进行处理。'; |
||||||
|
$translation['destination_path_not_dir'] = '目录路径不是一个有效的目录,不能进行处理。'; |
||||||
|
$translation['destination_dir_write'] = '不能让目标文件目录设置为可写的,不能进行处理。'; |
||||||
|
$translation['destination_path_write'] = '目录路径是不可以写的,不能进行处理。'; |
||||||
|
$translation['temp_file'] = '不能创建临时文件,不能进行处理。'; |
||||||
|
$translation['source_not_readable'] = '源文件不可以读,不能进行处理。'; |
||||||
|
$translation['no_create_support'] = '%s 不支持创建'; |
||||||
|
$translation['create_error'] = '从源文件创建 %s 图片过程中出错。'; |
||||||
|
$translation['source_invalid'] = '无法读取原始图片,确认是不是正确的图片文件?'; |
||||||
|
$translation['gd_missing'] = 'GD 好像不可以使用。'; |
||||||
|
$translation['watermark_no_create_support'] = '%s 创建不支持, 不能读取水印文件。'; |
||||||
|
$translation['watermark_create_error'] = '%s 不支持读, 不能创建水印。'; |
||||||
|
$translation['watermark_invalid'] = '未知文件格式, 无法读取水印文件。'; |
||||||
|
$translation['file_create'] = '%s 不支持创建。'; |
||||||
|
$translation['no_conversion_type'] = '未定义转换类型'; |
||||||
|
$translation['copy_failed'] = '在服务器上复制文件时出错。 copy() 操作失败.'; |
||||||
|
$translation['reading_failed'] = '读取过程中出错。'; |
||||||
|
|
||||||
|
?> |
@ -0,0 +1,87 @@ |
|||||||
|
<?php |
||||||
|
// +------------------------------------------------------------------------+ |
||||||
|
// | class.upload.zh_TW.php | |
||||||
|
// +------------------------------------------------------------------------+ |
||||||
|
// | Copyright (c) Yang Chih-Wen 2009. All rights reserved. | |
||||||
|
// | Version 0.28 | |
||||||
|
// | Last modified 15/08/2009 | |
||||||
|
// | Email chihwen.yang@gmail.com | |
||||||
|
// | Web http://www.doubleservice.com/ | |
||||||
|
// +------------------------------------------------------------------------+ |
||||||
|
// | This program is free software; you can redistribute it and/or modify | |
||||||
|
// | it under the terms of the GNU General Public License version 2 as | |
||||||
|
// | published by the Free Software Foundation. | |
||||||
|
// | | |
||||||
|
// | This program is distributed in the hope that it will be useful, | |
||||||
|
// | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
||||||
|
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
||||||
|
// | GNU General Public License for more details. | |
||||||
|
// | | |
||||||
|
// | You should have received a copy of the GNU General Public License | |
||||||
|
// | along with this program; if not, write to the | |
||||||
|
// | Free Software Foundation, Inc., 59 Temple Place, Suite 330, | |
||||||
|
// | Boston, MA 02111-1307 USA | |
||||||
|
// | | |
||||||
|
// | Please give credit on sites that use class.upload and submit changes | |
||||||
|
// | of the script so other people can use them as well. | |
||||||
|
// | This script is free to use, don't abuse. | |
||||||
|
// +------------------------------------------------------------------------+ |
||||||
|
|
||||||
|
/** |
||||||
|
* Class upload Traditional Chinese translation |
||||||
|
* |
||||||
|
* @version 0.28 |
||||||
|
* @author Yang Chih-Wen (chihwen.yang@gmail.com) |
||||||
|
* @license http://opensource.org/licenses/gpl-license.php GNU Public License |
||||||
|
* @copyright Yang Chih-Wen |
||||||
|
* @package cmf |
||||||
|
* @subpackage external |
||||||
|
*/ |
||||||
|
|
||||||
|
$translation = array(); |
||||||
|
$translation['file_error'] = '檔案錯誤,請重試。'; |
||||||
|
$translation['local_file_missing'] = '本地端的檔案不存在。'; |
||||||
|
$translation['local_file_not_readable'] = '本地端的檔案不可讀取。'; |
||||||
|
$translation['uploaded_too_big_ini'] = '檔案上傳出錯 (上傳的檔案超過了 php.ini 中 upload_max_filesize 指定的大小)。'; |
||||||
|
$translation['uploaded_too_big_html'] = '檔案上傳出錯 (上傳的檔案超過了 HTML 表單中 MAX_FILE_SIZE 指定的大小)。'; |
||||||
|
$translation['uploaded_partial'] = '檔案上傳出錯 (只有部份的檔案被上傳)。'; |
||||||
|
$translation['uploaded_missing'] = '檔案上傳出錯 (沒有檔案被上傳)。'; |
||||||
|
$translation['uploaded_no_tmp_dir'] = '檔案上傳出錯 (找不到暫存目錄)。'; |
||||||
|
$translation['uploaded_cant_write'] = '檔案上傳出錯 (檔案寫入失敗)。'; |
||||||
|
$translation['uploaded_err_extension'] = '檔案上傳出錯 (檔案上傳被 extension 中斷)。'; |
||||||
|
$translation['uploaded_unknown'] = '檔案上傳出錯 (未知的錯誤)。'; |
||||||
|
$translation['try_again'] = '檔案上傳出錯,請重試。'; |
||||||
|
$translation['file_too_big'] = '檔案太大了。'; |
||||||
|
$translation['no_mime'] = '未知的 MIME Type 檔案類型。'; |
||||||
|
$translation['incorrect_file'] = '不正確的 MIME Type 檔案類型。'; |
||||||
|
$translation['image_too_wide'] = '圖片寬度太大。'; |
||||||
|
$translation['image_too_narrow'] = '圖片寬度太小。'; |
||||||
|
$translation['image_too_high'] = '圖片高度太大。'; |
||||||
|
$translation['image_too_short'] = '圖片高度太小。'; |
||||||
|
$translation['ratio_too_high'] = '圖片寬高比率太大 (圖片寬度太大)。'; |
||||||
|
$translation['ratio_too_low'] = '圖片寬高比率太小 (圖片高度太大)。'; |
||||||
|
$translation['too_many_pixels'] = '圖片像素太多。'; |
||||||
|
$translation['not_enough_pixels'] = '圖片像素太少。'; |
||||||
|
$translation['file_not_uploaded'] = '檔案未上傳,無法繼續進行處理。'; |
||||||
|
$translation['already_exists'] = '%s 已經存在,請更改檔名。'; |
||||||
|
$translation['temp_file_missing'] = '暫存的原始檔案不正確,無法繼續進行處理。'; |
||||||
|
$translation['source_missing'] = '已上傳的原始檔案不正確,無法繼續進行處理。'; |
||||||
|
$translation['destination_dir'] = '無法創建目標目錄,無法繼續進行處理。'; |
||||||
|
$translation['destination_dir_missing'] = '目標目錄不存在,無法繼續進行處理。'; |
||||||
|
$translation['destination_path_not_dir'] = '目標路徑不是一個有效的目錄,無法繼續進行處理。'; |
||||||
|
$translation['destination_dir_write'] = '目標目錄不能設定為可寫入,無法繼續進行處理。'; |
||||||
|
$translation['destination_path_write'] = '目錄路徑不可寫入,無法繼續進行處理。'; |
||||||
|
$translation['temp_file'] = '不能創建暫存檔案,無法繼續進行處理。'; |
||||||
|
$translation['source_not_readable'] = '原始檔案不可讀取,無法繼續進行處理。'; |
||||||
|
$translation['no_create_support'] = '不支援 %s 創建功能。'; |
||||||
|
$translation['create_error'] = '從原始檔案創建 %s 圖片過程中出錯。'; |
||||||
|
$translation['source_invalid'] = '無法讀取原始圖片,請確認是否為正確的圖片檔?'; |
||||||
|
$translation['gd_missing'] = '無法使用 GD 函式庫。'; |
||||||
|
$translation['watermark_no_create_support'] = '不支援 %s 創建功能,無法讀取浮水印。'; |
||||||
|
$translation['watermark_create_error'] = '不支援 %s 讀取功能,無法創建浮水印。'; |
||||||
|
$translation['watermark_invalid'] = '未知的圖片格式,無法讀取浮水印。'; |
||||||
|
$translation['file_create'] = '不支援 %s 創建功能。'; |
||||||
|
$translation['no_conversion_type'] = '未定義的轉換類型。'; |
||||||
|
$translation['copy_failed'] = '在伺服端複製檔案時出錯,copy() 操作失敗。'; |
||||||
|
$translation['reading_failed'] = '讀檔過程中出錯。'; |
||||||
|
?> |
@ -0,0 +1,96 @@ |
|||||||
|
<?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; |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,160 @@ |
|||||||
|
<?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; |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,36 @@ |
|||||||
|
<?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 {} |
@ -0,0 +1,36 @@ |
|||||||
|
<?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(); |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,23 @@ |
|||||||
|
<?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; |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,69 @@ |
|||||||
|
<?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; |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,101 @@ |
|||||||
|
<?php |
||||||
|
//载入配置文件 |
||||||
|
include_once("./class/class.user.php"); |
||||||
|
//检查用户是否登录 |
||||||
|
$status = $basis->check($config); |
||||||
|
|
||||||
|
//检查用户是否登陆来判断上传目录 |
||||||
|
if($status == 'islogin') { |
||||||
|
//设置上传路径 |
||||||
|
$updir = $config['admindir']; |
||||||
|
} |
||||||
|
else{ |
||||||
|
$updir = $config['userdir']; |
||||||
|
//限制用户上传数量 |
||||||
|
$basis->limitnum(); |
||||||
|
} |
||||||
|
|
||||||
|
//获取上传者信息 |
||||||
|
$ip = $_SERVER['REMOTE_ADDR']; |
||||||
|
$ua = $_SERVER['HTTP_USER_AGENT']; |
||||||
|
$date = date('Y-m-d',time()); |
||||||
|
//载入上传类 |
||||||
|
include('./class/class.upload.php'); |
||||||
|
|
||||||
|
//上传方法 |
||||||
|
$handle = new upload($_FILES['file']); |
||||||
|
if ($handle->uploaded) { |
||||||
|
$handle->file_new_name_body = 'image_resized'; |
||||||
|
//允许上传大小2m |
||||||
|
$handle->file_max_size = '2097152'; |
||||||
|
//允许的MIME类型,仅运行上传图片 |
||||||
|
$handle->allowed = array('image/*'); |
||||||
|
|
||||||
|
// 当前月份 |
||||||
|
$current_time = date('ym',time()); |
||||||
|
//上传路径:目录 + 时间 |
||||||
|
$handle->process('../'.$updir.'/'.$current_time."/"); |
||||||
|
if ($handle->processed) { |
||||||
|
//图片添加水印 |
||||||
|
// if(($handle->image_dst_x >= 400) && ($handle->image_dst_y >= 400) && ($config['watermark'] != '')){ |
||||||
|
// $handle->image_text = 'dsdsdds'; |
||||||
|
// $handle->image_text_color = '#979797'; |
||||||
|
// $handle->image_text_opacity = 50; |
||||||
|
// $handle->image_text_font = './Arial Monospaced.ttf'; |
||||||
|
// $handle->image_text_size = 16; |
||||||
|
// $handle->image_text_x = 5; |
||||||
|
// $handle->image_text_y = 5; |
||||||
|
|
||||||
|
// } |
||||||
|
//获取站点域名 |
||||||
|
$domain = $config['domain']; |
||||||
|
//生成文件hash |
||||||
|
$fhash = hash_file("md5",$handle->file_dst_pathname,FALSE); |
||||||
|
$fhash = substr($fhash,8,16); |
||||||
|
//新的文件名(../temp/1804/\d64c8036c0605175.jpg) |
||||||
|
$new_img = $handle->file_dst_path.$fhash.'.'.$handle->file_dst_name_ext; |
||||||
|
//图片URL地址 |
||||||
|
$imgurl = $domain.$updir.'/'.$current_time.'/'.$fhash.'.'.$handle->file_dst_name_ext; |
||||||
|
//图片路径(temp/1804/d64c8036c0605175.jpg) |
||||||
|
$imgdir = $updir.'/'.$current_time.'/'.$fhash.'.'.$handle->file_dst_name_ext; |
||||||
|
|
||||||
|
//判断文件是否已经存在 |
||||||
|
if(!is_file($new_img)) { |
||||||
|
//对文件更名 |
||||||
|
rename($handle->file_dst_pathname,$new_img); |
||||||
|
} |
||||||
|
else{ |
||||||
|
//删除原始文件 |
||||||
|
unlink($handle->file_dst_pathname); |
||||||
|
} |
||||||
|
|
||||||
|
//检查某张图片是否已经上传过,如果已经上传了,直接返回数据并终止操作 |
||||||
|
$basis->isupload($imgdir); |
||||||
|
|
||||||
|
//没有上传过的图片,继续写入数据库 |
||||||
|
$last_user_id = $database->insert("imginfo", [ |
||||||
|
"path" => $imgdir, |
||||||
|
"ip" => $ip, |
||||||
|
"ua" => $ua, |
||||||
|
"date" => $date, |
||||||
|
"dir" => $updir, |
||||||
|
"compress" => 0, |
||||||
|
"level" => 0 |
||||||
|
]); |
||||||
|
//返回最后的ID |
||||||
|
$account_id = $database->id(); |
||||||
|
//上传成功,返回json数据 |
||||||
|
$redata = array( |
||||||
|
"code" => 1, |
||||||
|
"id" => $account_id, |
||||||
|
"url" => $imgurl, |
||||||
|
"width" => $handle->image_dst_x, |
||||||
|
"height" => $handle->image_dst_y |
||||||
|
); |
||||||
|
echo $redata = json_encode($redata); |
||||||
|
$handle->clean(); |
||||||
|
} else { |
||||||
|
echo 'error : ' . $handle->error; |
||||||
|
} |
||||||
|
} |
||||||
|
?> |
@ -0,0 +1,60 @@ |
|||||||
|
<?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="layui-upload-drag" id="upimg"> |
||||||
|
<i class="layui-icon"></i> |
||||||
|
<p>点击上传,或将图片拖拽到此处</p> |
||||||
|
</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"); |
||||||
|
?> |
@ -0,0 +1,6 @@ |
|||||||
|
User-Agent: * |
||||||
|
Disallow: /admin/ |
||||||
|
Disallow: /db/ |
||||||
|
Disallow: /functions/ |
||||||
|
Disallow: /static/ |
||||||
|
Disallow: /tpl/ |
After Width: | Height: | Size: 9.5 KiB |
@ -0,0 +1,186 @@ |
|||||||
|
//载入layui组建
|
||||||
|
layui.use(['layer', 'form','element','upload','flow'], function(){ |
||||||
|
var form = layui.form; |
||||||
|
var layer = layui.layer; |
||||||
|
var element = layui.element; |
||||||
|
var upload = layui.upload; |
||||||
|
var flow = layui.flow; |
||||||
|
//当你执行这样一个方法时,即对页面中的全部带有lay-src的img元素开启了懒加载(当然你也可以指定相关img)
|
||||||
|
// flow.lazyimg({
|
||||||
|
// elem:'#found-img img'
|
||||||
|
// });
|
||||||
|
|
||||||
|
//拖拽上传
|
||||||
|
upload.render({ |
||||||
|
elem: '#upimg' |
||||||
|
,url: 'functions/upload.php' |
||||||
|
,before: function(obj){ //obj参数包含的信息,跟 choose回调完全一致,可参见上文。
|
||||||
|
layer.load(); //上传loading
|
||||||
|
} |
||||||
|
,done: function(res){ |
||||||
|
//如果上传失败
|
||||||
|
if(res.code == 0){ |
||||||
|
layer.open({ |
||||||
|
title: '温馨提示' |
||||||
|
,content: res.msg |
||||||
|
}); |
||||||
|
layer.closeAll('loading'); |
||||||
|
} |
||||||
|
else if(res.code == 1){ |
||||||
|
layer.closeAll('loading'); |
||||||
|
$("#showpic a").attr('href',res.url); |
||||||
|
$("#showpic img").attr('src',res.url); |
||||||
|
$("#url").val(res.url); |
||||||
|
$("#html").val("<img src = '" + res.url + "' />"); |
||||||
|
$("#markdown").val("![](" + res.url + ")"); |
||||||
|
$("#bbcode").val("[img]" + res.url + "[/img]"); |
||||||
|
$("#upok").show(); |
||||||
|
//请求接口处理图片
|
||||||
|
$.get("./dispose.php?id="+res.id,function(data,status){ |
||||||
|
var obj = eval('(' + data + ')'); |
||||||
|
if(obj.level == 3){ |
||||||
|
layer.open({ |
||||||
|
title: '温馨提示' |
||||||
|
,content: '请勿上传违规图片!' |
||||||
|
}); |
||||||
|
} |
||||||
|
}); |
||||||
|
} |
||||||
|
} |
||||||
|
}); |
||||||
|
}); |
||||||
|
|
||||||
|
//复制链接
|
||||||
|
function copy(info){ |
||||||
|
var copy = new clipBoard(document.getElementById('piclink'), { |
||||||
|
beforeCopy: function() { |
||||||
|
info = $("#" + info).val(); |
||||||
|
}, |
||||||
|
copy: function() { |
||||||
|
return info; |
||||||
|
}, |
||||||
|
afterCopy: function() { |
||||||
|
|
||||||
|
} |
||||||
|
}); |
||||||
|
layui.use('layer', function(){ |
||||||
|
var layer = layui.layer; |
||||||
|
|
||||||
|
layer.msg('复制成功!', {time: 2000}) |
||||||
|
}); |
||||||
|
} |
||||||
|
|
||||||
|
//用户登录方法
|
||||||
|
function login(){ |
||||||
|
// 获取用户提交的信息
|
||||||
|
var user = $("#user").val(); |
||||||
|
var password = $("#password").val(); |
||||||
|
|
||||||
|
$.post("../functions/Controller.php?type=login",{user:user,password:password},function(data,status){ |
||||||
|
layer.msg(data,{time:2000}); |
||||||
|
}); |
||||||
|
} |
||||||
|
|
||||||
|
//用户前台预览图片
|
||||||
|
function userpreview(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 |
||||||
|
}); |
||||||
|
}); |
||||||
|
} |
||||||
|
|
||||||
|
//后台管理员查看图片
|
||||||
|
function adminshow(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('该功能还在开发中!', {time: 2000}) |
||||||
|
} |
||||||
|
//删除按钮
|
||||||
|
,btn2: function(index, layero){ |
||||||
|
layer.confirm('确认删除?', {icon: 3, title:'温馨提示!'}, function(index){ |
||||||
|
$.get("./delete.php?id="+id,function(data,status){ |
||||||
|
if(data == 'ok') { |
||||||
|
$("#imgid"+id).remove(); |
||||||
|
} |
||||||
|
else{ |
||||||
|
alert(data); |
||||||
|
} |
||||||
|
}); |
||||||
|
|
||||||
|
layer.close(index); |
||||||
|
}); |
||||||
|
} |
||||||
|
}); |
||||||
|
}); |
||||||
|
} |
||||||
|
|
||||||
|
//删除某张图片
|
||||||
|
function deleteimg(id){ |
||||||
|
layer.confirm('确认删除?', {icon: 3, title:'温馨提示!'}, function(index){ |
||||||
|
$.get("./delete.php?id="+id,function(data,status){ |
||||||
|
if(data == 'ok') { |
||||||
|
$("#imgid"+id).remove(); |
||||||
|
} |
||||||
|
else{ |
||||||
|
alert(data); |
||||||
|
} |
||||||
|
}); |
||||||
|
|
||||||
|
layer.close(index); |
||||||
|
}); |
||||||
|
} |
||||||
|
|
||||||
|
//取消图片可疑状态
|
||||||
|
function cdubious(id){ |
||||||
|
layer.confirm('确认取消图片可疑状态?', {icon: 3, title:'温馨提示!'}, function(index){ |
||||||
|
$.get("./operation.php?type=cdubious&id="+id,function(data,status){ |
||||||
|
if(data == 'ok') { |
||||||
|
$("#imgid"+id).remove(); |
||||||
|
} |
||||||
|
else{ |
||||||
|
alert(data); |
||||||
|
} |
||||||
|
}); |
||||||
|
|
||||||
|
layer.close(index); |
||||||
|
}); |
||||||
|
} |
||||||
|
|
||||||
|
//图片压缩功能
|
||||||
|
function compress(id){ |
||||||
|
//layer.msg('该功能还在开发中!', {time: 2000})
|
||||||
|
$.get("../functions/class/class.pic.php?id=" + id,function(data,status){ |
||||||
|
layer.open({ |
||||||
|
title: '温馨提示:', |
||||||
|
time:2000 |
||||||
|
,content: data |
||||||
|
}); |
||||||
|
}); |
||||||
|
} |
||||||
|
|
||||||
|
//IP查询
|
||||||
|
function ipquery(ip){ |
||||||
|
$.get("https://ip.awk.sh/api.php?data=addr&ip=" + ip,function(data,status){ |
||||||
|
if(status == 'success') { |
||||||
|
layer.open({ |
||||||
|
title: 'IP查询结果:' |
||||||
|
,content: data |
||||||
|
,time:3000 |
||||||
|
}); |
||||||
|
} |
||||||
|
}); |
||||||
|
} |
@ -0,0 +1,2 @@ |
|||||||
|
/** layui-v2.2.6 MIT License By https://www.layui.com */ |
||||||
|
html #layuicss-skincodecss{display:none;position:absolute;width:1989px}.layui-code-h3,.layui-code-view{position:relative;font-size:12px}.layui-code-view{display:block;margin:10px 0;padding:0;border:1px solid #e2e2e2;border-left-width:6px;background-color:#F2F2F2;color:#333;font-family:Courier New}.layui-code-h3{padding:0 10px;height:32px;line-height:32px;border-bottom:1px solid #e2e2e2}.layui-code-h3 a{position:absolute;right:10px;top:0;color:#999}.layui-code-view .layui-code-ol{position:relative;overflow:auto}.layui-code-view .layui-code-ol li{position:relative;margin-left:45px;line-height:20px;padding:0 5px;border-left:1px solid #e2e2e2;list-style-type:decimal-leading-zero;*list-style-type:decimal;background-color:#fff}.layui-code-view pre{margin:0}.layui-code-notepad{border:1px solid #0C0C0C;border-left-color:#3F3F3F;background-color:#0C0C0C;color:#C2BE9E}.layui-code-notepad .layui-code-h3{border-bottom:none}.layui-code-notepad .layui-code-ol li{background-color:#3F3F3F;border-left:none} |
After Width: | Height: | Size: 5.8 KiB |
After Width: | Height: | Size: 11 KiB |
After Width: | Height: | Size: 5.7 KiB |
After Width: | Height: | Size: 701 B |
After Width: | Height: | Size: 1.7 KiB |
After Width: | Height: | Size: 269 KiB |
After Width: | Height: | Size: 2.6 KiB |
After Width: | Height: | Size: 5.4 KiB |
After Width: | Height: | Size: 2.7 KiB |
After Width: | Height: | Size: 4.0 KiB |
After Width: | Height: | Size: 3.3 KiB |
After Width: | Height: | Size: 7.3 KiB |
After Width: | Height: | Size: 2.3 KiB |
After Width: | Height: | Size: 1.8 KiB |
After Width: | Height: | Size: 6.6 KiB |
After Width: | Height: | Size: 4.3 KiB |
After Width: | Height: | Size: 2.9 KiB |
After Width: | Height: | Size: 3.0 KiB |
After Width: | Height: | Size: 3.1 KiB |
After Width: | Height: | Size: 5.0 KiB |
After Width: | Height: | Size: 5.1 KiB |
After Width: | Height: | Size: 9.6 KiB |
After Width: | Height: | Size: 3.7 KiB |
After Width: | Height: | Size: 7.9 KiB |
After Width: | Height: | Size: 3.1 KiB |
After Width: | Height: | Size: 3.2 KiB |
After Width: | Height: | Size: 4.3 KiB |
After Width: | Height: | Size: 2.7 KiB |
After Width: | Height: | Size: 4.7 KiB |
After Width: | Height: | Size: 3.9 KiB |
After Width: | Height: | Size: 2.5 KiB |
After Width: | Height: | Size: 2.0 KiB |
After Width: | Height: | Size: 3.4 KiB |
After Width: | Height: | Size: 2.4 KiB |
After Width: | Height: | Size: 3.6 KiB |
After Width: | Height: | Size: 1.8 KiB |
After Width: | Height: | Size: 2.3 KiB |
After Width: | Height: | Size: 1.5 KiB |
After Width: | Height: | Size: 3.5 KiB |
After Width: | Height: | Size: 6.3 KiB |
After Width: | Height: | Size: 5.6 KiB |
After Width: | Height: | Size: 3.1 KiB |
After Width: | Height: | Size: 3.6 KiB |
After Width: | Height: | Size: 5.2 KiB |
After Width: | Height: | Size: 2.6 KiB |
After Width: | Height: | Size: 4.0 KiB |
After Width: | Height: | Size: 3.3 KiB |
After Width: | Height: | Size: 2.9 KiB |
After Width: | Height: | Size: 2.3 KiB |
After Width: | Height: | Size: 2.6 KiB |
After Width: | Height: | Size: 2.3 KiB |
After Width: | Height: | Size: 4.5 KiB |
After Width: | Height: | Size: 5.7 KiB |