<?php
http_response_code(404);
?>
<!DOCTYPE HTML>
<html lang="zh-cn">
<head>
    <title>404-Not Found</title>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no" />
    <link rel="shortcut icon" href="https://api.xieweiling.top/favicon.ico" type="image/x-icon"/>
    <?php
    // 获取当前请求的路径
    $requestPath = parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH);
    // 计算相对路径
    $relativePath = str_repeat('../', substr_count($requestPath, '/'));
    ?>
    <link rel="stylesheet" href="<?php echo $relativePath; ?>assets/error_page/css/main.css" />


    <style>
        html, body{
            width: -90%;
            height: -70%;
            overflow-y: scroll;
        }
        ::-webkit-scrollbar {display: none;}
    </style>
    
    <script type="text/javascript">
        var isMobile = /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);

        // 创建 script 元素
        var scriptElement = document.createElement('script');
        scriptElement.type = 'text/javascript';

        // 根据客户端类型设置不同的脚本路径
        if (isMobile) {
            scriptElement.src = '<?php echo $relativePath; ?>assets/error_page/js/mp.js';
        } else {
            scriptElement.src = '<?php echo $relativePath; ?>assets/error_page/js/pc.js';
        }

        // 将 script 元素添加到 head 中
        document.head.appendChild(scriptElement);
    </script>

</head>

<body class="is-preload">

    <!-- Header -->
    <header id="header">
        <h1>404</h1>
        <h2>Not Found - 页面不存在</h2>
    </header>

    <!-- Signup Form -->
    <form id="signup-form" method="post" action="#">
        <button type="button" onclick='location.href=("https://beiko.top/")'>前往图库</button>
        <button type="button" onclick="javascript:history.back(-1);">返回上一页</button>
    </form>


    <!-- Footer -->
    <footer id="footer">
        <ul class="copyright">
            Copyright ©
            <script>
                document.write('2022 - ' + (new Date()).getFullYear())
            </script> By <a href="https://xieweiling.top">Beiko</a>
        </ul>
    </footer>

</body>
</html>
