Merhaba,
DirectAdmin paylaşımsız veya API kullanım izni var ise bu mümkün.
Eskiden bir müşterimde kullanıyordum, hala değişmediyse kullanabilirsiniz.
<?php
// Ayarlar
$directadmin_host = "https://sunucunuz.com:2222";
$username = "kullaniciadi"; // DirectAdmin kullanıcısı
$password = "sifre";
$domain = "alanadi.com";
// API'den veriyi çek
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "$directadmin_host/CMD_API_POP?action=list&domain=$domain");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_USERPWD, "$username:$password");
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
$result = curl_exec($ch);
curl_close($ch);
parse_str($result, $data);
// Filtrele
$mail_data = [];
foreach ($data as $key => $value) {
if (strpos($key, '@') !== false) {
$mail_data[$key] = $value;
}
}
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Mail Kota Takip Paneli</title>
<style>
body { font-family: Arial; background: #f8f8f8; padding: 20px; }
table { width: 100%; border-collapse: collapse; background: white; box-shadow: 0 0 10px rgba(0,0,0,0.1); }
th, td { padding: 10px; text-align: left; border-bottom: 1px solid #ddd; }
th { background-color: #4CAF50; color: white; }
.bar { height: 16px; border-radius: 5px; }
.green { background-color: #4CAF50; }
.yellow { background-color: #ff9800; }
.red { background-color: #f44336; }
</style>
</head>
<body>
<h2>�� <?= htmlspecialchars($domain) ?> Mail Hesapları Kota Takip Paneli</h2>
<table>
<tr>
<th>E-posta Adresi</th>
<th>Kullanım / Kota (MB)</th>
<th>Doluluk</th>
</tr>
<?php foreach ($mail_data as $mail => $info):
$info_parts = explode("|", $info);
$used = round($info_parts[0] / 1024, 2); // KB to MB
$quota = round($info_parts[1] / 1024, 2);
$percent = ($quota > 0) ? round(($used / $quota) * 100, 2) : 0;
// Renk belirleme
$color = 'green';
if ($percent >= 90) $color = 'red';
elseif ($percent >= 70) $color = 'yellow';
?>
<tr>
<td><?= htmlspecialchars($mail) ?></td>
<td><?= $used ?> / <?= $quota ?> MB</td>
<td>
<div class="bar <?= $color ?>" style="width: <?= min($percent, 100) ?>%;"></div>
<?= $percent ?>%
</td>
</tr>
<?php endforeach; ?>
</table>
<p style="margin-top: 20px; font-size: 0.9em; color: #666;">Son güncelleme: <?= date("d.m.Y H:i:s") ?></p>
</body>
</html>