%PDF- %PDF-
Direktori : /usr/local/apache/htdocs/ |
Current File : //usr/local/apache/htdocs/data.php |
<?php $directory = "/"; $freeSpace = disk_free_space($directory); $totalSpace = disk_total_space($directory); if ($freeSpace === false || $totalSpace === false) { echo "Error retrieving disk space information."; exit; } $freeGB = $freeSpace / 1024 / 1024 / 1024; $totalGB = $totalSpace / 1024 / 1024 / 1024; $usedGB = $totalGB - $freeGB; $freeGB = round($freeGB, 2); $totalGB = round($totalGB, 2); $usedGB = round($usedGB, 2); $cpanelAccounts = 0; $passwdFile = "/etc/passwd"; if (file_exists($passwdFile) && is_readable($passwdFile)) { $users = file($passwdFile, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES); foreach ($users as $user) { $fields = explode(":", $user); $username = $fields[0]; $uid = (int) $fields[2]; $homeDir = $fields[5]; if ($uid >= 1000 && strpos($homeDir, "/home/") === 0) { $cpanelAccounts++; } } } // Read backup time in hours $backupFile = "/var/www/html/b"; $backupHours = "N/A"; if (file_exists($backupFile) && is_readable($backupFile)) { $backupHours = trim(file_get_contents($backupFile)); } echo "$totalGB,$freeGB,$usedGB,$cpanelAccounts,$backupHours"; ?>