更新 index.php

加入密码保护,去除多余代码。
This commit is contained in:
sunson 2024-12-02 11:49:54 +08:00
parent c83a456cac
commit 46e8135c49

View File

@ -1,6 +1,18 @@
<?php <?php
// 如存放在当前目录下直接/即可,如果选择其他目录前后都要/包含,如:/o/ $base_dir='/o/';//以/即结束即可
$base_dir='/o/'; $user="chate.store";// 用户名
$pwd="123456";// 密码,请记得频繁更换
$authorization = false;
if ($_SERVER['PHP_AUTH_USER'] == $user && $_SERVER['PHP_AUTH_PW'] == $pwd){
$authorization = true;
}
if(!$authorization){
// 没登录成功,弹出要求输入用户名和密码窗口
header("WWW-Authenticate:Basic realm='Private'");
header('HTTP/1.0 401 Unauthorized');
exit;
}
// 处理文件上传 // 处理文件上传
if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_FILES['file'])) { if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_FILES['file'])) {
@ -178,14 +190,12 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_FILES['file'])) {
<div id="fileList" class="file-list mt-3"></div> <div id="fileList" class="file-list mt-3"></div>
<div id="statusOutput" class="status-output"></div> <div id="statusOutput" class="status-output"></div>
<div class="link-output"> <div class="link-output">
<button class="btn btn-info" id="directLinkBtn">直连代码</button> <button class="btn btn-info" id="directLinkBtn">直连</button>
<button class="btn btn-info" id="htmlCodeBtn">网页代码</button> <button class="btn btn-info" id="htmlCodeBtn">网页</button>
<button class="btn btn-info" id="forumCodeBtn">论坛代码</button> <button class="btn btn-info" id="forumCodeBtn">论坛</button>
<button class="btn btn-info" id="markDownCodeBtn">Markdown代码</button> <button class="btn btn-info" id="markDownCodeBtn">Markdown</button>
<textarea id="linkText" readonly></textarea>
<div class="copy-all-btn-container">
<button class="btn btn-success" id="copyAllBtn">复制所有链接</button> <button class="btn btn-success" id="copyAllBtn">复制所有链接</button>
</div> <textarea id="linkText" readonly></textarea>
</div> </div>
<h6 id="formatHint" class="card-title text-center">支持格式: JPEG, PNG, GIF, WEBP, AVIF, BMP, SVG 最大上传:<?php echo ini_get('upload_max_filesize');?></h6> <h6 id="formatHint" class="card-title text-center">支持格式: JPEG, PNG, GIF, WEBP, AVIF, BMP, SVG 最大上传:<?php echo ini_get('upload_max_filesize');?></h6>
</div> </div>