46 lines
1.3 KiB
PHP
Executable File
46 lines
1.3 KiB
PHP
Executable File
<?php
|
|
require_once("/opt/wevads/config/credentials.php");
|
|
header('Content-Type: application/json');
|
|
|
|
try {
|
|
$pdo = get_pdo("wevads");
|
|
} catch (PDOException $e) {
|
|
echo json_encode(['status' => 'error', 'message' => 'Database error: ' . $e->getMessage()]);
|
|
exit;
|
|
}
|
|
|
|
$action = $_GET['action'] ?? 'stats';
|
|
|
|
switch($action) {
|
|
case 'stats':
|
|
try {
|
|
$stmt = $pdo->query("SELECT COUNT(*) as total FROM admin.domains");
|
|
$result = $stmt->fetch(PDO::FETCH_ASSOC);
|
|
|
|
echo json_encode([
|
|
'status' => 'success',
|
|
'data' => [
|
|
'total_domains' => $result['total'] ?? 0,
|
|
'active_domains' => 0,
|
|
'servers_count' => 0
|
|
],
|
|
'timestamp' => date('Y-m-d H:i:s')
|
|
]);
|
|
} catch (Exception $e) {
|
|
echo json_encode([
|
|
'status' => 'success',
|
|
'data' => ['total_domains' => 0, 'note' => 'Table query error'],
|
|
'error' => $e->getMessage()
|
|
]);
|
|
}
|
|
break;
|
|
|
|
default:
|
|
echo json_encode([
|
|
'status' => 'error',
|
|
'message' => 'Action non supportée',
|
|
'available_actions' => ['stats']
|
|
]);
|
|
}
|
|
?>
|