![]() Server : Apache/2 System : Linux server-15-235-50-60 5.15.0-164-generic #174-Ubuntu SMP Fri Nov 14 20:25:16 UTC 2025 x86_64 User : gositeme ( 1004) PHP Version : 8.2.29 Disable Function : exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname Directory : /home/gositeme/domains/soundstudiopro.com/public_html/admin_includes/ |
<?php
// System Tab
// This file handles system management and monitoring
// Get system logs (mock data for now)
$system_logs = [
['time' => '2025-07-24 21:15:47', 'level' => 'INFO', 'message' => 'System startup completed', 'user' => 'system'],
['time' => '2025-07-24 21:10:23', 'level' => 'WARNING', 'message' => 'High memory usage detected', 'user' => 'system'],
['time' => '2025-07-24 21:05:12', 'level' => 'ERROR', 'message' => 'Database connection timeout', 'user' => 'system'],
['time' => '2025-07-24 21:00:45', 'level' => 'INFO', 'message' => 'Backup completed successfully', 'user' => 'admin'],
['time' => '2025-07-24 20:55:30', 'level' => 'INFO', 'message' => 'Cache cleared', 'user' => 'admin']
];
// Get system statistics
$system_stats = [
'database_size' => '2.5 GB',
'storage_used' => '75%',
'memory_usage' => '45%',
'cpu_usage' => '12%',
'uptime' => '15 days, 8 hours'
];
?>
<!-- System Management -->
<div class="section-header">
<h2><i class="fas fa-server"></i> System Management</h2>
<p>Monitor system health and manage configurations.</p>
</div>
<div class="system-grid" style="display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 2rem; margin-bottom: 3rem;">
<div class="system-card" style="background: rgba(255, 255, 255, 0.05); border-radius: 16px; padding: 2rem;">
<h3 style="margin-top: 0; color: white; font-size: 1.8rem;">System Health</h3>
<div class="health-indicators">
<div class="health-item" style="display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; padding: 1rem; background: rgba(255, 255, 255, 0.05); border-radius: 8px;">
<span class="health-label" style="color: #a0aec0;">Database</span>
<span class="health-status healthy" style="color: #48bb78; font-weight: 600;">Healthy</span>
</div>
<div class="health-item" style="display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; padding: 1rem; background: rgba(255, 255, 255, 0.05); border-radius: 8px;">
<span class="health-label" style="color: #a0aec0;">Storage</span>
<span class="health-status warning" style="color: #f59e0b; font-weight: 600;"><?= $system_stats['storage_used'] ?> Used</span>
</div>
<div class="health-item" style="display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; padding: 1rem; background: rgba(255, 255, 255, 0.05); border-radius: 8px;">
<span class="health-label" style="color: #a0aec0;">Memory</span>
<span class="health-status healthy" style="color: #48bb78; font-weight: 600;"><?= $system_stats['memory_usage'] ?></span>
</div>
<div class="health-item" style="display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; padding: 1rem; background: rgba(255, 255, 255, 0.05); border-radius: 8px;">
<span class="health-label" style="color: #a0aec0;">CPU</span>
<span class="health-status healthy" style="color: #48bb78; font-weight: 600;"><?= $system_stats['cpu_usage'] ?></span>
</div>
<div class="health-item" style="display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; padding: 1rem; background: rgba(255, 255, 255, 0.05); border-radius: 8px;">
<span class="health-label" style="color: #a0aec0;">Uptime</span>
<span class="health-status healthy" style="color: #48bb78; font-weight: 600;"><?= $system_stats['uptime'] ?></span>
</div>
</div>
</div>
<div class="system-card" style="background: rgba(255, 255, 255, 0.05); border-radius: 16px; padding: 2rem;">
<h3 style="margin-top: 0; color: white; font-size: 1.8rem;">System Logs</h3>
<div class="logs-container" style="max-height: 400px; overflow-y: auto;">
<?php foreach ($system_logs as $log): ?>
<div class="log-entry" style="display: grid; grid-template-columns: auto auto 1fr auto; gap: 1rem; align-items: center; padding: 0.8rem; margin-bottom: 0.5rem; background: rgba(255, 255, 255, 0.03); border-radius: 8px; border-left: 4px solid <?= $log['level'] === 'ERROR' ? '#f56565' : ($log['level'] === 'WARNING' ? '#f59e0b' : '#48bb78') ?>;">
<div class="log-time" style="color: #a0aec0; font-size: 1.2rem;"><?= $log['time'] ?></div>
<div class="log-level log-<?= strtolower($log['level']) ?>" style="color: <?= $log['level'] === 'ERROR' ? '#f56565' : ($log['level'] === 'WARNING' ? '#f59e0b' : '#48bb78') ?>; font-weight: 600;"><?= $log['level'] ?></div>
<div class="log-message" style="color: white;"><?= $log['message'] ?></div>
<div class="log-user" style="color: #a0aec0; font-size: 1.2rem;"><?= $log['user'] ?></div>
</div>
<?php endforeach; ?>
</div>
</div>
<div class="system-card" style="background: rgba(255, 255, 255, 0.05); border-radius: 16px; padding: 2rem;">
<h3 style="margin-top: 0; color: white; font-size: 1.8rem;">Quick Actions</h3>
<div class="quick-actions" style="display: flex; flex-direction: column; gap: 1rem;">
<button class="btn btn-primary" onclick="clearLogs()" style="width: 100%;">
<i class="fas fa-broom"></i> Clear Logs
</button>
<button class="btn btn-secondary" onclick="backupDatabase()" style="width: 100%;">
<i class="fas fa-download"></i> Backup Database
</button>
<button class="btn btn-warning" onclick="optimizeDatabase()" style="width: 100%;">
<i class="fas fa-tools"></i> Optimize Database
</button>
<button class="btn btn-danger" onclick="clearCache()" style="width: 100%;">
<i class="fas fa-trash"></i> Clear Cache
</button>
<button class="btn btn-success" onclick="restartServices()" style="width: 100%;">
<i class="fas fa-redo"></i> Restart Services
</button>
</div>
</div>
</div>
<!-- System Statistics -->
<div class="section-header">
<h3><i class="fas fa-chart-bar"></i> System Statistics</h3>
</div>
<div class="stats-grid" style="margin-bottom: 3rem;">
<div class="stat-card">
<div class="stat-number"><?= $system_stats['database_size'] ?></div>
<div class="stat-label">Database Size</div>
</div>
<div class="stat-card">
<div class="stat-number"><?= $system_stats['storage_used'] ?></div>
<div class="stat-label">Storage Used</div>
</div>
<div class="stat-card">
<div class="stat-number"><?= $system_stats['memory_usage'] ?></div>
<div class="stat-label">Memory Usage</div>
</div>
<div class="stat-card">
<div class="stat-number"><?= $system_stats['cpu_usage'] ?></div>
<div class="stat-label">CPU Usage</div>
</div>
</div>
<script>
// System management functions
function clearLogs() {
if (confirm('Are you sure you want to clear all system logs?')) {
fetch('admin_api.php?action=clear_logs')
.then(response => response.json())
.then(data => {
if (data.success) {
alert('Logs cleared successfully!');
location.reload();
} else {
alert('Error clearing logs: ' + data.error);
}
})
.catch(error => {
alert('Error clearing logs: ' + error);
});
}
}
function backupDatabase() {
if (confirm('Start database backup? This may take a few minutes.')) {
fetch('admin_api.php?action=backup_database')
.then(response => response.json())
.then(data => {
if (data.success) {
alert('Database backup started! Check logs for completion.');
} else {
alert('Error starting backup: ' + data.error);
}
})
.catch(error => {
alert('Error starting backup: ' + error);
});
}
}
function optimizeDatabase() {
if (confirm('Optimize database tables? This may take a few minutes.')) {
fetch('admin_api.php?action=optimize_database')
.then(response => response.json())
.then(data => {
if (data.success) {
alert('Database optimization completed!');
location.reload();
} else {
alert('Error optimizing database: ' + data.error);
}
})
.catch(error => {
alert('Error optimizing database: ' + error);
});
}
}
function clearCache() {
if (confirm('Clear all system cache?')) {
fetch('admin_api.php?action=clear_cache')
.then(response => response.json())
.then(data => {
if (data.success) {
alert('Cache cleared successfully!');
location.reload();
} else {
alert('Error clearing cache: ' + data.error);
}
})
.catch(error => {
alert('Error clearing cache: ' + error);
});
}
}
function restartServices() {
if (confirm('Restart system services? This will cause a brief interruption.')) {
fetch('admin_api.php?action=restart_services')
.then(response => response.json())
.then(data => {
if (data.success) {
alert('Services restart initiated!');
setTimeout(() => location.reload(), 5000);
} else {
alert('Error restarting services: ' + data.error);
}
})
.catch(error => {
alert('Error restarting services: ' + error);
});
}
}
</script>