Mini Kabibi Habibi

Current Path : C:/xampp/htdocs/
Upload File :
Current File : C:/xampp/htdocs/index.php

<?php
// ===============================
//  SDO BATANGAS CITY PORTAL
//  Auto-directory + External Systems
// ===============================

// Directory to scan (current directory)
$dir = __DIR__;

// Excluded folders and files
$exclude = [
    '.', '..', 'index.php', 'index_tools',
    'dashboard', 'favicon.ico', 'img', 
    'webalizer', 'xampp', 'bitnami.css', 'applications.html', 
    'info.php', 'Website', 'todolist', 'InventorySystem', 'todolist', 'esuporta', 'cid'
];

// Detect if user is inside local network
$user_ip = $_SERVER['REMOTE_ADDR'];
$is_local = preg_match('/^192\.168\.|^10\.|^172\.(1[6-9]|2\d|3[0-1])\./', $user_ip);

// Manually added external systems (with local & public IPs)
$external_systems = [
    [
        'name' => "PPA's Monitoring System",
        'local' => 'http://192.168.10.112/bms',
        'public' => 'http://223.25.21.213/bms',
    ],
    [
        'name' => 'Automated Ranking System',
        'local' => 'http://192.168.10.112/ranking',
        'public' => 'http://223.25.21.213/ranking',
    ],
    [
        'name' => 'File Tracking System',
        'local' => 'http://192.168.10.112/fts',
        'public' => 'http://223.25.21.213/fts',
    ],
    [
        'name' => 'News Portal',
        'local' => 'http://192.168.10.112/newspub',
        'public' => 'http://223.25.21.213/newspub',
    ],
    [
            'name' => 'Provident',
            'local' => 'http://192.168.10.112/provident',
            'public' => 'http://223.25.21.213/provident',
        ],

        [
            'name' => 'SDO File Repository',
            'local' => 'http://192.168.10.246/FileRepository/',
        ],
];

// Scan local directories (auto)
$items = array_diff(scandir($dir), $exclude);
?>
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>SDO Batangas City Portal</title>
  <link rel="icon" type="image/png" href="index_tools/deped_logo.png">
  <link rel="stylesheet" href="index_tools/index.css">
  <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet">
  <link href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.css" rel="stylesheet">
</head>
<body>
<!-- Header -->
  <div class="header">
    <img src="index_tools/deped_logo.png" alt="DepEd Logo">
    <div class="header-title">
      <h2>SDO Batangas City Unified Systems Portal</h2>
      <p>Welcome to SDO Batangas City Unified Systems Portal</p>
    </div>
    <div class="search-bar">
      <i class="bi bi-search"></i>
      <input type="text" id="searchInput" class="form-control" placeholder="Search systems...">
    </div>
  </div>

  <div class="container my-5">
    <div class="row g-4" id="systemList">
       
  <!-- Main Content -->
  <div class="container my-5">
    <div class="row g-4" id="systemList">

      <div class="col-lg-3 col-md-4 col-sm-6 system-item">
        <div class="system-card text-center h-100" onclick="location.href='cid/system'">
          <div class="system-icon">
            <i class="bi bi-folder-fill"></i>
          </div>
          <div class="system-name text-uppercase">CID System</div>
        </div>
      </div>

      <div class="col-lg-3 col-md-4 col-sm-6 system-item">
        <div class="system-card text-center h-100" onclick="location.href='esuporta/system'">
          <div class="system-icon">
            <i class="bi bi-folder-fill"></i>
          </div>
          <div class="system-name text-uppercase">ESUPORTA</div>
        </div>
      </div> 


      <!-- Manually Added External Systems -->
      <?php foreach ($external_systems as $ext): 
        $link = $is_local ? $ext['local'] : $ext['public'];
      ?>
      <div class="col-lg-3 col-md-4 col-sm-6 system-item">
        <div class="system-card text-center h-100" onclick="window.open('<?= $link ?>', '_blank')">
          <div class="system-icon">
            <i class="bi bi-folder-fill"></i>
          </div>
          <div class="system-name text-uppercase"><?= htmlspecialchars($ext['name']) ?></div>
        </div>
      </div>
      <?php endforeach; ?>

      <!-- Auto-Scanned Local Folders -->
      <?php foreach ($items as $item): 
        $path = $dir . DIRECTORY_SEPARATOR . $item;

        // Skip zip files
        if (pathinfo($item, PATHINFO_EXTENSION) === 'zip') {
          continue;
        }

        $isDir = is_dir($path);
        $icon = $isDir ? "bi bi-folder-fill" : "bi bi-file-earmark-fill";
        $link = $isDir ? $item . "/index.php" : $item;
      ?>
      <div class="col-lg-3 col-md-4 col-sm-6 system-item">
        <div class="system-card text-center h-100" onclick="location.href='<?= $link ?>'">
          <div class="system-icon">
            <i class="<?= $icon ?>"></i>
          </div>
          <div class="system-name text-uppercase"><?= htmlspecialchars($item) ?></div>
        </div>
      </div>
      <?php endforeach; ?>
    </div>
  </div>

  <script>
    // Search Functionality
    document.getElementById('searchInput').addEventListener('keyup', function() {
      let filter = this.value.toLowerCase();
      document.querySelectorAll('.system-item').forEach(function(item) {
        let name = item.querySelector('.system-name').textContent.toLowerCase();
        item.style.display = name.includes(filter) ? '' : 'none';
      });
    });
  </script>

  <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js"></script>
</body>
</html>