pull/18/head
parent
2c4dc0c959
commit
8e6dd829f0
|
@ -1,4 +0,0 @@
|
|||
RewriteEngine on RewriteCond % !^$
|
||||
RewriteRule i/(.*).(php)$ – [F]
|
||||
RewriteRule public/(.*).(php)$ – [F]
|
||||
RewriteRule config/(.*).(php)$ – [F]
|
|
@ -93,7 +93,7 @@ if (!is_online()) {
|
|||
</button>
|
||||
</form>
|
||||
</div>
|
||||
';
|
||||
';
|
||||
}
|
||||
?>
|
||||
<div class="col-md-4">
|
||||
|
@ -112,50 +112,11 @@ if (!is_online()) {
|
|||
<input type="text" name="token" class="form-control" placeholder="请输入Token" />
|
||||
</div>
|
||||
</div>
|
||||
<!-- API上传的图片链接
|
||||
<div class="form-group">
|
||||
<label>
|
||||
API上传的图片链接
|
||||
</label>
|
||||
<div class="form-group">
|
||||
<input type="text" class="form-control" readonly>
|
||||
</div>
|
||||
<br />
|
||||
-->
|
||||
<button type="submit" class="btn btn-mini btn-primary">
|
||||
API上传
|
||||
</button>
|
||||
</form>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<table class="table table-hover table-bordered table-condensed table-responsive">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>当前可用Token列表:</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php
|
||||
$key = count($tokenList);
|
||||
for ($x = 0; $x < $key; $x++) {
|
||||
echo '<tr><td>' . $tokenList[$x] . '</td></tr>';
|
||||
} ?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<!-- API上传测试
|
||||
<div class="col-md-4">
|
||||
<form action="index.php" method="post" enctype="multipart/form-data">
|
||||
<input type="file" class="form-control" accept="image/*" name="image" >
|
||||
<input type="text" name = "token" placeholder="请输入Token"/>
|
||||
<button type="submit" class="btn btn-mini btn-primary">API上传测试</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
-->
|
||||
|
||||
|
||||
</div>
|
||||
<script>
|
||||
var oBtn = document.getElementById('del');
|
||||
|
|
|
@ -1,37 +1,40 @@
|
|||
<?php
|
||||
|
||||
require_once __DIR__.'/tokenList.php';
|
||||
require_once $_SERVER['DOCUMENT_ROOT'] .'/config/config.php';
|
||||
require_once __DIR__ . '/tokenList.php';
|
||||
require_once $_SERVER['DOCUMENT_ROOT'] . '/config/config.php';
|
||||
|
||||
// Token 生成
|
||||
function privateToken($length=32){
|
||||
$output='';
|
||||
for ($a = 0; $a<$length; $a++) {
|
||||
function privateToken($length = 32)
|
||||
{
|
||||
$output = '';
|
||||
for ($a = 0; $a < $length; $a++) {
|
||||
$output .= chr(mt_rand(65, 122)); //生成php随机数
|
||||
}
|
||||
return md5($output);
|
||||
}
|
||||
}
|
||||
return md5($output);
|
||||
}
|
||||
|
||||
// 检查Token
|
||||
function checkToken($token){
|
||||
// 检查Token
|
||||
function checkToken($token)
|
||||
{
|
||||
global $tokenList;
|
||||
$token = preg_replace( '/[\W]/', '', $token); // 过滤非字母数字,删除空格
|
||||
$token = preg_replace('/[\W]/', '', $token); // 过滤非字母数字,删除空格
|
||||
|
||||
if (in_array($token,$tokenList)) {
|
||||
if (in_array($token, $tokenList)) {
|
||||
return True;
|
||||
} else {
|
||||
exit('此Token不存在:'. $token);
|
||||
exit('此Token不存在:' . $token);
|
||||
}
|
||||
}
|
||||
|
||||
// 通过Token查找用户ID
|
||||
function getID($token){
|
||||
function getID($token)
|
||||
{
|
||||
global $tokenList;
|
||||
$token = preg_replace( '/[\W]/', '', $token); // 过滤非字母数字,删除空格
|
||||
$key = array_search($token,$tokenList);
|
||||
$token = preg_replace('/[\W]/', '', $token); // 过滤非字母数字,删除空格
|
||||
$key = array_search($token, $tokenList);
|
||||
if ($key) {
|
||||
return $key;
|
||||
}else{
|
||||
return('没有这个用户ID');
|
||||
} else {
|
||||
return ('没有这个用户ID');
|
||||
}
|
||||
};
|
|
@ -54,7 +54,7 @@ $config = array(
|
|||
// 每次最多上传图片数
|
||||
'maxUploadFiles' => 30,
|
||||
// 是否开启登录上传 开启:true 关闭:false
|
||||
'mustLogin' => false,
|
||||
'mustLogin' => true,
|
||||
// 是否开启tinyfilemanager文件管理 开启:true 关闭:false
|
||||
'tinyfilemanager' => true,
|
||||
// 登录上传和后台管理密码,管理用户名为:admin
|
||||
|
@ -129,7 +129,7 @@ $config = array(
|
|||
</a>
|
||||
-->
|
||||
',
|
||||
// 开启环境检测 开启:true 关闭:false
|
||||
// 扩展与基本设置检测 开启:true 关闭:false
|
||||
'checkEnv' => true,
|
||||
// 当前版本
|
||||
'version' => '2.1.0',
|
||||
|
|
|
@ -88,7 +88,7 @@
|
|||
<span class="label"><i class="icon icon-qrcode"></i> 二维码</a></span>
|
||||
<a href="/tinyfilemanager.php?p=<?php echo date('Y/m/d'); ?>" target="_blank"><span class="label"><i class="icon icon-desktop"></i> 管理</a></span>
|
||||
<a href="/api/api-web.php" target="_blank"><span class="label"><i class="icon icon-key"></i> API</a></span>
|
||||
<?php require_once 'function.php';
|
||||
<?php
|
||||
if (is_online()) {
|
||||
echo '<a href="/libs/logout.php" ><span class="label"><i class="icon icon-signout"></i> 退出</a></span>';
|
||||
} else {
|
||||
|
@ -102,4 +102,5 @@
|
|||
<a href="https://www.545141.com/902.html" target="_blank">Icret</a> Ver:<a href="https://github.com/icret/easyImages2.0" target="_blank"><?php echo $config['version']; ?> <i class="icon icon-github"></i></a>
|
||||
</footer>
|
||||
</body>
|
||||
|
||||
</html>
|
|
@ -22,12 +22,13 @@ function checkLogin()
|
|||
echo '
|
||||
<script> new $.zui.Messager("登录成功", {type: "success" // 定义颜色主题
|
||||
}).show();</script>';
|
||||
//header("refresh:1;"); // 1s后刷新当前页面
|
||||
header("refresh:1;"); // 1s后刷新当前页面
|
||||
} else { // 密码错误
|
||||
echo '
|
||||
<script> new $.zui.Messager("密码错误", {type: "danger" // 定义颜色主题
|
||||
}).show();</script>';
|
||||
exit(include __DIR__ . '/login.php');
|
||||
//exit(include __DIR__ . '/login.php');
|
||||
exit(header("refresh:1;"));
|
||||
}
|
||||
} elseif (isset($_COOKIE['admin'])) { // cookie正确
|
||||
if ($_COOKIE['admin'] == $md5Pwd) {
|
||||
|
@ -35,14 +36,14 @@ function checkLogin()
|
|||
echo '
|
||||
<script> new $.zui.Messager("密码已更改,请重新登录", {type: "special" // 定义颜色主题
|
||||
}).show();</script>';
|
||||
header('loction:login.php');
|
||||
//header('loction:login.php');
|
||||
exit(include __DIR__ . '/login.php');
|
||||
}
|
||||
} else { // 无登录无cookie
|
||||
echo '
|
||||
<script> new $.zui.Messager("请登录后再上传!", {type: "danger" // 定义颜色主题
|
||||
}).show();</script>';
|
||||
header('loction:login.php');
|
||||
//header('loction:login.php');
|
||||
exit(include __DIR__ . '/login.php');
|
||||
}
|
||||
}
|
||||
|
@ -411,4 +412,4 @@ function checkEnv($mode)
|
|||
';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -11,8 +11,6 @@ if (isset($_POST['password'])) {
|
|||
}
|
||||
|
||||
?>
|
||||
|
||||
<script src="../public/static/md5.min.js"></script>
|
||||
<center>
|
||||
<div class="center" style="margin: 40px;">
|
||||
<form class="form-inline" action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post" onsubmit="return md5_post()">
|
||||
|
@ -26,6 +24,7 @@ if (isset($_POST['password'])) {
|
|||
</form>
|
||||
</div>
|
||||
</center>
|
||||
<script src="../public/static/md5.min.js"></script>
|
||||
<script>
|
||||
function md5_post() {
|
||||
var password = document.getElementById('password');
|
||||
|
|
Loading…
Reference in New Issue