This repository has been archived by the owner on Jun 20, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdelete.php
57 lines (54 loc) · 1.92 KB
/
delete.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
<h1>Löschen</h1>
<?php
if (isset($_GET['mailbox'])){
$id="mailbox=".$_GET['mailbox'];
$seite="mailboxes";
} elseif (isset($_GET['aliases'])){
$id = "aliases=".$_GET['aliases'];
$seite = "aliases";
} elseif (isset($_GET['domain'])){
$id = "domain=".$_GET['domain'];
$seite = "domains";
}
if ($_SERVER['REQUEST_METHOD'] === 'POST'){
if (isset($_GET['mailbox'])){
$id=$_GET['mailbox'];
$sql = "DELETE FROM accounts WHERE id=$id";
$seite="mailboxes";
} elseif (isset($_GET['aliases'])){
$id = $_GET['aliases'];
$sql = "DELETE FROM aliases WHERE id=$id";
$seite = "aliases";
} elseif (isset($_GET['domain'])){
$id = $_GET['domain'];
$sql = "DELETE FROM domains WHERE id=$id";
$seite = "domains";
}
if ($conn->query($sql) === TRUE) {
echo "<p class=green-text>Der Löschvorgang war erfolgreich.</p>";
echo "<meta http-equiv='refresh' content='3; URL=/?seite=$seite'>";
exit;
} else {
echo "Error: " . $sql . "<br>" . $conn->error;
exit;
}
}
?>
<div class="valign-wrapper">
<i class="medium material-icons red-text">warning</i>
<p style="font-size: 1.2em;">Bist du sicher, dass du dieses Element löschen willst?</p>
</div>
<div class="row">
<form method="post" action="?seite=del&<?php echo $id?>" class="col s12">
<div class ="row">
<div class = "col s6">
<button class="btn waves-effect waves-light" type="submit" name="action">Ja
<i class="material-icons right">delete</i>
</button>
</div>
<div class = "col s6">
<a class="waves-effect waves-light btn" href="?seite=<?php echo $seite?>"><i class="material-icons right">cancel</i>Nein</a>
</div>
</div>
</form>
</div>