举报链接 - 帮助我们维护网络环境
<!DOCTYPE html>
<html>
<head>
<style>
#report-button {
position: fixed;
bottom: 20px;
right: 20px;
background-color: #f44336;
color: white;
padding: 10px 20px;
border-radius: 5px;
font-size: 16px;
cursor: pointer;
z-index: 9999;
}
<pre><code> #report-form {
display: none;
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0.5);
z-index: 9998;
}
#report-form .modal-content {
background-color: #fefefe;
margin: 10% auto;
padding: 20px;
border: 1px solid #888;
width: 80%;
}
#report-form .close {
color: #aaa;
float: right;
font-size: 28px;
font-weight: bold;
cursor: pointer;
}
#report-form .close:hover,
#report-form .close:focus {
color: black;
text-decoration: none;
cursor: pointer;
}
</style>
</code></pre>
</head>
<body>
<button id="report-button">举报</button>
<pre><code><div id="report-form">
<div class="modal-content">
<span class="close">×</span>
<form action="index.php" method="POST">
<label for="link">链接:</label>
<input type="text" id="link" name="link" required>
<input type="submit" value="提交">
</form>
</div>
</div>
</code></pre>
<script>
document.getElementById("report-button").addEventListener("click", function() {
document.getElementById("report-form").style.display = "block";
});
document.getElementsByClassName("close")[0].addEventListener("click", function() {
document.getElementById("report-form").style.display = "none";
});
</script>
<pre><code><?php
</code></pre>
<p>if ($_SERVER["REQUEST_METHOD"] == "POST") {
$link = $_POST["link"];</p>
<pre><code>// 检查链接是否为空
if (!empty($link)) {
// 打开文件
$file = fopen("jubao.txt", "a");
// 写入链接
fwrite($file, $link . "\n");
// 关闭文件
fclose($file);
// 重定向到当前页面,以清除POST数据
header("Location: index.php");
exit;
} else {
// 显示错误信息
echo "链接不能为空";
}
</code></pre>
<p>}
?></p>
</body>
</html>
原文地址: https://www.cveoy.top/t/topic/HPo 著作权归作者所有。请勿转载和采集!