-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdeletenb.php
122 lines (109 loc) · 2.94 KB
/
deletenb.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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
<?php
require 'header.php';
?>
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8">
<title>Notebook System by Tim Ziegenbalg</title>
<!-- UIkit CSS -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/uikit/3.1.7/css/uikit.min.css" />
<!-- UIkit JS -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/uikit/3.1.7/js/uikit.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/uikit/3.1.7/js/uikit-icons.min.js"></script>
</head>
<style media="screen">
/* MODAL STARTS HERE */
.bg-modal-edit {
background-color: rgba(0, 0, 0, 0.8);
width: 100%;
height: 100%;
position: absolute;
top: 0;
display: flex;
justify-content: center;
align-items: center;
}
.modal-contents {
height: 300px;
width: 500px;
background-color: white;
text-align: center;
padding: 20px;
position: relative;
border-radius: 4px;
}
input {
margin: 15px auto;
display: block;
width: 50%;
padding: 8px;
border: 1px solid gray;
}
.close-edit {
position: absolute;
top: 0;
right: 10px;
font-size: 42px;
color: #333;
transform: rotate(45deg);
cursor: pointer;
&:hover {
color: #666;
}
}
.close-add {
position: absolute;
top: 0;
right: 10px;
font-size: 42px;
color: #333;
transform: rotate(45deg);
cursor: pointer;
&:hover {
color: #666;
}
}
</style>
<body>
<div class="bg-modal-edit">
<div class="modal-contents">
<!-- Image
<img src="https://s.gravatar.com/avatar/cfe128a2b747c12a7bc719be85d20a40?s=80" alt="" class="uk-margin-bottom uk-border-circle">
-->
<h1 class="uk-text-bold uk-h1">Delete Notebook</h1>
<form method="POST">
<div class="uk-margin-bottom">
<select name="selectnotebook"class="uk-select uk-text-center uk-border-rounded">
<?php
$notebooks_sql = "SELECT * FROM Notebooks";
$notebooks = mysqli_query($con, $notebooks_sql);
while ($row = mysqli_fetch_assoc($notebooks)) {
echo "<option value='". $row['Name'] ."'>". $row['Name'] ."</option>";
}
?>
</select>
</div>
<input type="submit" name="submit" class="uk-button-primary uk-button uk-border-rounded" value="Löschen">
</form>
</div>
</div>
</body>
<?php
$notebookname = $_POST['selectnotebook'];
$sql_delete = "DELETE FROM `Notebooks` WHERE `Name` = '$notebookname'";
if(isset($_POST['submit'])) {
$sql_datadelete = mysqli_query($con, $sql_delete);
if($sql_datadelete){
// If everything runs fine with your sql query you will see a message and then the window
//closes
echo "<script>self.close();</script>";
}
else {
echo '<script language="javascript">';
echo 'alert("Es ist ein Problem Aufgetreten bitte Kontaktieren deinen Administrator!")';
echo '</script>';
}
}
?>
</html>