📁 Folder Navigator
Position:
Root
/
faith
/
vpnp1
/
network
/
clients
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:
purge_chat.php22
<?php // purge_chats.php - Standalone Chat File Controller Purger $xmlFile = '../../admin/access/vidkeys/masterusers.xml'; $chatsFolder = 'chats/chat_history.txt'; if (file_exists($xmlFile) && is_dir($chatsFolder)) { $xml = simplexml_load_file($xmlFile); if ($xml) { // 1. Map all active VIDs currently alive in your master list $activeVids = []; foreach ($xml->user as $user) { if (isset($user->virtual_id)) { $activeVids[] = (string)$user->virtual_id; } } // 2. Scan your chats/ directory folder for old files $allFiles = scandir($chatsFolder); foreach ($allFiles as $file) { // Skip navigation dots and your system master administrator file if ($file === '.' || $file === '..' || $file === 'admin_panel_chat.txt') { continue; } // 3. Extract the VID string from filenames like "chat_1777053907.txt" if (strpos($file, 'chat_') === 0) { // Strip out "chat_" from the front and ".txt" from the back to isolate the VID number string $fileVid = str_replace(['chat_', '.txt'], '', $file); // 4. If that extracted VID string is NOT found in your active array list, purge it! if (!in_array($fileVid, $activeVids)) { $fullPath = $chatsFolder . $file; if (is_file($fullPath)) { @unlink($fullPath); // Permanently vaporizes the orphaned chat file from the server } } } } } } ?>
💾 Save Changes