You've already forked EasyImages2.0
mirror of
https://github.com/icret/EasyImages2.0.git
synced 2025-12-13 11:43:58 +08:00
增加Token有效期
This commit is contained in:
@@ -58,8 +58,8 @@ function check_api($token)
|
||||
exit(json_encode($reJson, JSON_UNESCAPED_UNICODE));
|
||||
}
|
||||
|
||||
if (!in_array($token, $tokenList)) {
|
||||
// Token错误 Token错误
|
||||
if (!in_array($tokenList[$token], $tokenList)) {
|
||||
// Token 是否存在
|
||||
$reJson = array(
|
||||
"result" => 'failed',
|
||||
'code' => 202,
|
||||
@@ -67,4 +67,14 @@ function check_api($token)
|
||||
);
|
||||
exit(json_encode($reJson, JSON_UNESCAPED_UNICODE));
|
||||
}
|
||||
|
||||
if ($tokenList[$token]['expired'] < time()) {
|
||||
// Token 是否过期
|
||||
$reJson = array(
|
||||
"result" => 'failed',
|
||||
'code' => 203,
|
||||
'message' => 'Token Expired',
|
||||
);
|
||||
exit(json_encode($reJson, JSON_UNESCAPED_UNICODE));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ if ($handle->uploaded) {
|
||||
// 允许上传的mime类型
|
||||
$handle->allowed = array('image/*');
|
||||
// 文件命名
|
||||
$handle->file_new_name_body = imgName($handle->file_src_name_body) . '_' . getID($token);
|
||||
$handle->file_new_name_body = imgName($handle->file_src_name_body) . '_' . $tokenList[$token]['id'];
|
||||
// 最大上传限制
|
||||
$handle->file_max_sizes = $config['maxSize'];
|
||||
// 最大宽度
|
||||
|
||||
Reference in New Issue
Block a user