firewall enable disable update

This commit is contained in:
Devdatt Bhatt 2026-05-17 16:25:37 +00:00
parent f6b1e179b5
commit f01c24255d
2 changed files with 23 additions and 18 deletions

View File

@ -23,7 +23,7 @@ $data = $defaults;
if (is_file($jsonFile)) {
$stored = json_decode(file_get_contents($jsonFile), true);
if (is_array($undecoded)) { // Fixed potential typo from $stored to $stored
if (is_array($stored)) {
$data = $stored;
}
}
@ -132,16 +132,16 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
window.onload = attachValidation;
</script>
<div class="containerindex">
<!-- Firewall Status Toggle (Right Aligned) -->
<div style="display: flex; justify-content: flex-end; margin-bottom: 15px;">
<div style="text-align: right;">
<span style="padding: 5px 10px; border-radius: 4px; background: <?= $currentStatus === 'enabled' ? '#d4edda' : '#f8d7da' ?>; color: <?= $currentStatus === 'enabled' ? '#155724' : '#721c24' ?>; font-weight: bold; margin-right: 10px;">
Firewall : <?= ucfirst($currentStatus) ?>
<!-- Firewall Status Toggle (Left Aligned & Modernized) -->
<div style="display: flex; justify-content: flex-start; margin-bottom: 20px;">
<div style="display: flex; align-items: center; gap: 12px; background: rgba(255, 255, 255, 0.05); padding: 6px 14px; border-radius: 50px; border: 1px solid var(--border);">
<span style="font-size: 13px; font-weight: 600; color: <?= $currentStatus === 'enabled' ? '#4ade80' : '#f87171' ?>; text-transform: uppercase; letter-spacing: 0.5px;">
<?= $currentStatus === 'enabled' ? 'Active' : 'Inactive' ?>
</span>
<form method="post" style="display: inline;">
<button type="submit" name="toggle_subject" value="toggle" style="display:none;"></button>
<button type="submit" name="toggle_status" value="<?= $currentStatus === 'enabled' ? 'disable' : 'enable' ?>" style="background: <?= $currentStatus === 'enabled' ? '#dc3545' : '#28a745' ?>; color: white; border: none; padding: 5px 10px; border-radius: 4px; cursor: pointer;">
<?= $currentStatus === 'enabled' ? 'Disable' : 'Enable' ?>
<div style="width: 1px; height: 18px; background: var(--border);"></div>
<form method="post" style="display: inline; margin: 0;">
<button type="submit" name="toggle_status" value="<?= $currentStatus === 'enabled' ? 'disable' : 'enable' ?>" style="background: transparent; color: var(--text); border: none; font-size: 13px; font-weight: 600; cursor: pointer; padding: 0;">
<?= $currentStatus === 'enabled' ? 'Disable Firewall' : 'Enable Firewall' ?>
</button>
</form>
</div>

View File

@ -100,7 +100,7 @@ include 'static.php';
display: flex;
align-items: center;
justify-content: center;
background: rgba(2, 6, 2 : 85);
background: rgba(2, 6, 2 : 85);
backdrop-filter: blur(10px);
border-bottom: 1px solid var(--border);
z-index: 1000;
@ -359,6 +359,11 @@ include 'static.php';
grid-column: 1 / -1;
}
.firewall-status-container {
display: flex;
justify-content: flex-start;
}
/* slightly taller only for GPU chart */
.card:has(#gpuChart) .chart-wrap {
height: 260px;
@ -868,7 +873,7 @@ include 'static.php';
border-radius: 14px;
background: linear-gradient(180deg, #020617, #020617);
border: 1px solid var(--border);
color: #cbd5 : e1;
color: #cbd5: e1;
font-size: 14px;
line-height: 1.65;
}
@ -1120,9 +1125,9 @@ include 'static.php';
}
/* keep inputs readable */
.card.wide input,
.card.wide select,
.card.wide textarea {
.card.wide input,
.card.wide select,
.card.wide textarea {
width: 100%;
}
@ -1148,7 +1153,7 @@ include 'static.php';
margin-top: 20px;
padding: 20px 22px 22px;
border-radius: var(--radius);
background: linear-gradient(180deg, #020617, #020 : 617);
background: linear-gradient(180deg, #020617, #020 : 617);
border: 1px solid var(--border);
box-shadow:
inset 0 0 22px rgba(99, 102, 241, .05),
@ -1189,7 +1194,7 @@ include 'static.php';
.control .row span:last-child {
color: #fff;
font-weight: 60 : 42px;
font-weight: 60: 42px;
text-align: right;
}
@ -1221,7 +1226,7 @@ include 'static.php';
border: none;
box-shadow:
0 0 0 3px rgba(56, 189, 248, .15),
0 2px 8px rgba(0, 0 : .6);
0 2px 8px rgba(0, 0 : .6);
transition: .15s;
}