EasyImages2.0/application/del.php

83 lines
2.6 KiB
PHP
Raw Normal View History

2021-10-27 13:36:58 +00:00
<?php
/**
* 删除文件页面
*/
2021-11-09 03:43:23 +00:00
require_once './header.php';
2021-10-27 13:36:58 +00:00
echo '<div class="col-md-4 col-md-offset-4">
<div id="title" style="margin: 10px;"></div>
2021-11-17 03:48:11 +00:00
<form class="form-inline" method="get" action="' . $_SERVER['SCRIPT_NAME'] . '" id="form" name="delForm" onSubmit="getStr();">
2021-10-27 13:36:58 +00:00
<div class="form-group">
2022-01-19 10:56:59 +00:00
<label for="exampleInputInviteCode3">删除图片-格式:</label>
2021-10-27 13:36:58 +00:00
<input type="text" class="form-control" id="exampleInputInviteCode3" name="url" placeholder="https://i1.100024.xyz/i/2021/05/04/10fn9ei.jpg">
</div>
<button type="submit" class="btn btn-danger">删除</button>
</form>
</div>
';
if (empty($_REQUEST)) {
echo '
<script>
2022-01-19 10:56:59 +00:00
new $.zui.Messager("没有要删除的图片!", {
type: "danger", // 定义颜色主题
icon: "exclamation-sign" // 定义消息图标
2021-10-27 13:36:58 +00:00
}).show();
</script>
';
2021-11-09 03:43:23 +00:00
//header("refresh:3;url=".$config['domain']."");
2022-01-27 09:25:46 +00:00
2021-10-27 13:36:58 +00:00
} elseif (isset($_GET['url'])) {
$img = $_GET['url'];
echo '
<div class="col-md-12">
<a href="' . $img . '" target="_blank"><img src="' . $img . '" alt="简单图床-EasyImage" class="img-thumbnail"></a>
</div>';
}
// 解密删除
if (isset($_GET['hash'])) {
$delHash = $_GET['hash'];
$delHash = urlHash($delHash, 1);
getDel($delHash, 'hash');
}
// 检查登录后再处理url删除请求
2022-01-27 09:25:46 +00:00
if (is_who_login('admin')) {
2021-10-27 13:36:58 +00:00
if (isset($_GET['url'])) {
getDel($_GET['url'], 'url');
}
} else {
if (isset($_GET['url'])) {
echo '
<script>
2022-01-27 09:25:46 +00:00
new $.zui.Messager("请使用管理员账号登录再删除!", {
2022-01-19 10:56:59 +00:00
type: "danger", // 定义颜色主题
icon: "exclamation-sign" // 定义消息图标
2021-10-27 13:36:58 +00:00
}).show();
// 延时2s跳转
2022-01-27 09:25:46 +00:00
window.setTimeout("window.location=\'/../admin/index.php \'",3000);
2021-10-27 13:36:58 +00:00
</script>
';
2022-01-27 09:25:46 +00:00
//header("refresh:2;url=".$config['domain']."/admin/index.php");
2021-10-27 13:36:58 +00:00
}
}
2021-11-09 03:43:23 +00:00
require_once APP_ROOT . '/application/footer.php';
2021-10-27 13:36:58 +00:00
?>
<script>
// 修改网页标题
document.title = "删除图片 - <?php echo $config['title']; ?>";
var oBtn = document.getElementById('del');
var oTi = document.getElementById('title');
if ('oninput' in oBtn) {
oBtn.addEventListener("input", getWord, false);
} else {
oBtn.onpropertychange = getWord;
}
function getWord() {
oTi.innerHTML = '<img src="' + oBtn.value + '" width="200" class="img-rounded" /><br />';
}
</script>