📁 Folder Navigator
Position:
Root
/
apphome
/
network
/
fans
Create
Folders
📁 chats
Rename
Copy
Delete
📁 studio
Rename
Copy
Delete
📁 uploads
Rename
Copy
Delete
Files
📄 admindir.php
📄 chat_history.txt
📄 dir.php
📄 displaychat.php
📄 index.php
📄 mychats.php
📄 purge_chat.php22
📄 users.xml
📝 File Editor
Editing:
mychats.php
<?php session_start(); // 1. Assign a permanent Unique ID to this visitor session if (!isset($_SESSION['user_id'])) { $_SESSION['user_id'] = "User-" . rand(1000, 9999); } $userId = $_SESSION['user_id']; $chatFile = "chat_history.txt"; $xmlFile = ".../../admin/access/vidkeys/masterusers.xml"; // 2. STALKER/GATEKEEPER VALIDATION LOOP function isUserInMasterXML($idToFind, $xmlPath) { if (!file_exists($xmlPath)) { return false; } $xml = simplexml_load_file($xmlPath); if (!$xml) { return false; } // Loops through <users> -> <user> and checks for the existence of your <vid> foreach ($xml->user as $user) { if (isset($user->vid) && (string)$user->vid === $idToFind) { return true; // Match confirmed, user block still exists! } } return false; // The user has been deleted by your external program } // 3. HANDLE DATA ENTRY SUBMISSIONS if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['message'])) { // Check master XML registration status BEFORE allowing writing privileges if (!isUserInMasterXML($userId, $xmlFile)) { // Enforce cleanup rule: Purge entire room history instantly if (file_exists($chatFile)) { } // Wipe local browser environment token tracking cookies session_destroy(); // Force drop user back out to clear visual page status header("Location: mychats.php?error=unauthorized"); exit; } // If active and registered, write message down to text log database securely $msg = trim(strip_tags($_POST['message'])); if (!empty($msg)) { $timestamp = date("H:i"); $formattedMsg = "[" . $timestamp . "] " . $userId . ": " . $msg . "\n"; file_put_contents($chatFile, $formattedMsg, FILE_APPEND | LOCK_EX); } header("Location: mychats.php"); exit; } // 4. READ CURRENT MESSAGES TO POPULATE VIEWPORT $chatHistory = ""; if (file_exists($chatFile)) { $chatHistory = htmlspecialchars(file_get_contents($chatFile)); } ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Secure Personal Chat</title> <style> body { font-family: Arial, sans-serif; background: #0f172a; color: #fff; padding: 20px; display: flex; justify-content: center; } .chat-container { width: 100%; max-width: 500px; background: #1e293b; padding: 20px; border-radius: 12px; box-shadow: 0 4px 15px rgba(0,0,0,0.3); border: 1px solid #334155; } .header { display: flex; justify-content: space-between; align-items: center; borderbottom: 1px solid #334155; padding-bottom: 10px; margin-bottom: 15px; } .user-tag { background: #2563eb; padding: 4px 12px; border-radius: 20px; font-size: 0.85rem; font-weight: bold; } textarea { width: 100%; height: 250px; background: #0f172a; color: #10b981; fontfamily: monospace; border: 1px solid #334155; border-radius: 6px; padding: 10px; resize: none; box-sizing: border-box; font-size: 0.95rem; } form { display: flex; gap: 10px; margin-top: 15px; } input[type="text"] { flex: 1; padding: 12px; background: #0f172a; border: 1px solid #334155; border-radius: 6px; color: #fff; font-size: 1rem; } button { background: #10b981; color: #fff; border: none; padding: 0 20px; borderradius: 6px; font-weight: bold; cursor: pointer; } </style> </head> <body> <div class="chat-container"> <div class="header"> <h3>💬 Secure Chat Console</h3> <span class="user-tag"><?php echo htmlspecialchars($userId); ?></span> </div> <textarea id="chatLog" readonly><?php echo $chatHistory; ?></textarea> <form action="mychats.php" method="POST"> <input type="text" name="message" placeholder="Type a message..." required autocomplete="off" autofocus> <button type="submit">Send</button> </form> </div> <script> const chatLog = document.getElementById('chatLog'); if (chatLog) { chatLog.scrollTop = chatLog.scrollHeight; } </script> </body> </html>
💾 Save Changes