File manager - Edit - /home/infoilmg/appsdow.com/code/get_code.php
Back
<?php session_start(); error_reporting(E_ALL); ini_set('display_errors', 1); $filename = "code.json"; $session_file = "sessions.json"; $allowed_domain = "appsdow.com"; $session_timeout = 30; // Number of seconds before the session is considered expired // Ensure `code.json` exists if (!file_exists($filename)) { die("❌ Code has not been generated yet. Please run `generate_code.php` first."); } // Read JSON data $json_data = file_get_contents($filename); $data = json_decode($json_data, true); // Validate stored data if (!isset($data["code"]) || !is_array($data["code"])) { die("❌ Error reading the stored code."); } // Validate `article_id` if (!isset($_GET['article_id']) || !is_numeric($_GET['article_id'])) { die("❌ Invalid article ID."); } $article_id = intval($_GET['article_id']); $total_articles = count($data["code"]); // Ensure `article_id` is within valid range if ($article_id < 0 || $article_id >= $total_articles) { die("❌ Invalid article ID. Must be between 0 and " . ($total_articles - 1)); } // Ensure the page is only loaded inside an iframe on `temailpro.com` if (!isset($_SERVER['HTTP_REFERER']) || parse_url($_SERVER['HTTP_REFERER'], PHP_URL_HOST) !== $allowed_domain) { die("❌ Access denied. "); } // Load active session data $sessions = file_exists($session_file) ? json_decode(file_get_contents($session_file), true) : []; // Remove expired sessions $current_time = time(); foreach ($sessions as $sid => $timestamp) { if (($current_time - $timestamp) > $session_timeout) { unset($sessions[$sid]); // Remove expired session from file } } // Generate session ID $session_id = session_id(); // Prevent multiple active sessions if (!empty($sessions) && isset($sessions[$session_id]) && ($current_time - $sessions[$session_id]) < $session_timeout) { die("❌ To get a token, close any other window"); } // Register the current session $sessions[$session_id] = $current_time; file_put_contents($session_file, json_encode($sessions, JSON_PRETTY_PRINT)); // Retrieve code for the specified article $char = $data["code"][$article_id]; ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Random Code</title> <style> body { background-color: black; color: #ff8040; display: flex; flex-direction: column; justify-content: center; align-items: center; height: 100vh; font-family: Arial, sans-serif; } #countdown-container { line-height: 1; font-family: Arial, sans-serif; display: flex; flex-direction: column; align-items: center; } #please-wait { font-weight: bold; color: white; font-size: 1.2rem; margin-bottom: 10px; transition: opacity 1s ease-in-out; } #countdown { margin-top: -10px; font-size: 1.5rem; font-weight: bold; } #code { color: white; margin-top: -10px; font-size: 1.3rem; font-weight: bold; display: none; } </style> </head> <body> <div id="countdown-container"> <div id="please-wait">Please Wait:</div> <div id="countdown">30</div> </div> <div id="code">Strings:<span style="color:#ff8040;font-size: 1.7rem;"> <?php echo htmlspecialchars($char); ?></span></div> <script> let countdownElement = document.getElementById("countdown"); let pleaseWaitElement = document.getElementById("please-wait"); let codeElement = document.getElementById("code"); let timeLeft = 30; let countdownInterval = setInterval(() => { timeLeft--; countdownElement.textContent = timeLeft; if (timeLeft <= 0) { clearInterval(countdownInterval); // Fade out effect pleaseWaitElement.style.opacity = "0"; countdownElement.style.opacity = "0"; setTimeout(() => { document.getElementById("countdown-container").style.display = "none"; codeElement.style.display = "block"; }, 1000); } }, 1000); </script> </body> </html>
| ver. 1.4 |
Github
|
.
| PHP 8.0.30 | Generation time: 2.3 |
proxy
|
phpinfo
|
Settings