<!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;
    }
&lt;/style&gt;
</code></pre>
</head>
<body>
    <button id="report-button">举报</button>
<pre><code>&lt;div id=&quot;report-form&quot;&gt;
    &lt;div class=&quot;modal-content&quot;&gt;
        &lt;span class=&quot;close&quot;&gt;×&lt;/span&gt;

        &lt;form action=&quot;index.php&quot; method=&quot;POST&quot;&gt;
            &lt;label for=&quot;link&quot;&gt;链接:&lt;/label&gt;
            &lt;input type=&quot;text&quot; id=&quot;link&quot; name=&quot;link&quot; required&gt;

            &lt;input type=&quot;submit&quot; value=&quot;提交&quot;&gt;
        &lt;/form&gt;
    &lt;/div&gt;
&lt;/div&gt;
</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>&lt;?php
</code></pre>
<p>if ($_SERVER[&quot;REQUEST_METHOD&quot;] == &quot;POST&quot;) {
$link = $_POST[&quot;link&quot;];</p>
<pre><code>// 检查链接是否为空
if (!empty($link)) {
    // 打开文件
    $file = fopen(&quot;jubao.txt&quot;, &quot;a&quot;);
    
    // 写入链接
    fwrite($file, $link . &quot;\n&quot;);
    
    // 关闭文件
    fclose($file);
    
    // 重定向到当前页面,以清除POST数据
    header(&quot;Location: index.php&quot;);
    exit;
} else {
    // 显示错误信息
    echo &quot;链接不能为空&quot;;
}
</code></pre>
<p>}
?&gt;</p>
</body>
</html>
举报链接 - 帮助我们维护网络环境

原文地址: https://www.cveoy.top/t/topic/HPo 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录