112 lines
2.2 KiB
PHP
112 lines
2.2 KiB
PHP
<?php
|
|
|
|
$statusMsg = "";
|
|
|
|
/* =========================
|
|
Neue Domain hinzufügen
|
|
========================= */
|
|
if (isset($_POST["add_domain"])) {
|
|
|
|
$subdomain = trim($_POST["subdomain"]);
|
|
|
|
if ($subdomain != "") {
|
|
DatabaseInsert("Domains", "SUBDOMAIN", $subdomain);
|
|
$statusMsg = "Domain wurde hinzugefügt.";
|
|
}
|
|
}
|
|
|
|
|
|
/* =========================
|
|
Domain löschen
|
|
========================= */
|
|
if (isset($_POST["delete_domain"])) {
|
|
|
|
$id = intval($_POST["id"]);
|
|
|
|
DatabaseDelete("Domains", "ID = ?", $id);
|
|
|
|
$statusMsg = "Domain wurde gelöscht.";
|
|
}
|
|
|
|
|
|
/* =========================
|
|
Domain bearbeiten
|
|
========================= */
|
|
if (isset($_POST["save_domain"])) {
|
|
|
|
$id = intval($_POST["id"]);
|
|
$subdomain = trim($_POST["subdomain"]);
|
|
|
|
DatabaseUpdate("Domains", "SUBDOMAIN = ?", "ID = ?", $subdomain, $id);
|
|
|
|
$statusMsg = "Domain wurde gespeichert.";
|
|
}
|
|
|
|
|
|
/* =========================
|
|
Domains laden
|
|
========================= */
|
|
|
|
$domains = DatabaseShow("Domains", "*");
|
|
|
|
?>
|
|
|
|
|
|
<h2>
|
|
Domain Verwaltung
|
|
</h2>
|
|
|
|
<?php if ($statusMsg): ?>
|
|
<div class="status-msg">
|
|
<?= htmlspecialchars($statusMsg) ?>
|
|
</div>
|
|
<?php endif; ?>
|
|
|
|
|
|
<div class="admin-grid">
|
|
|
|
<?php foreach ($domains as $domain): ?>
|
|
|
|
<form method="post" class="admin-card">
|
|
|
|
<input type="hidden" name="id" value="<?= $domain["ID"] ?>">
|
|
|
|
<label>Subdomain</label>
|
|
|
|
<input type="text" name="subdomain" value="<?= htmlspecialchars($domain["SUBDOMAIN"]) ?>">
|
|
|
|
<div style="margin-top:10px; display:flex; gap:10px;">
|
|
|
|
<button type="submit" name="save_domain" class="btn-save">
|
|
Speichern
|
|
</button>
|
|
|
|
<button type="submit" name="delete_domain" class="btn-delete">
|
|
Löschen
|
|
</button>
|
|
|
|
</div>
|
|
|
|
</form>
|
|
|
|
<?php endforeach; ?>
|
|
|
|
|
|
<!-- Neue Domain -->
|
|
|
|
<form method="post" class="admin-card new-item">
|
|
|
|
<h3>Neu</h3>
|
|
|
|
<label>Subdomain</label>
|
|
|
|
<input type="text" name="subdomain" placeholder="z.B. kleinerpenis.mrhossa.de">
|
|
|
|
<button type="submit" name="add_domain" class="btn-add">
|
|
Domain hinzufügen
|
|
</button>
|
|
|
|
</form>
|
|
|
|
|
|
</div>
|