-
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathsets.php
63 lines (51 loc) · 1.55 KB
/
sets.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
<?php
include_once 'includes/db_connect.php';
if(!$mysqli){
die("Connection failed: " . mysqli_connect_error());
}
$Lang = $_POST['newLang'];
$Cat = $_POST['newCat'];
$DelLang = $_POST['lang'];
$DelCat = $_POST['cat'];
if(isset($_POST['newLangButton'])){
$sqlInsert = "INSERT INTO language (language) VALUES ('$Lang')";
if(mysqli_query($mysqli, $sqlInsert)){
mysqli_close($mysqli);
header("Location: register.php");
}
else{
echo "Error: " . $sqlInsert . "<br>" . mysqli_error($mysqli);
}
}
if(isset($_POST['newCatButton'])){
$sqlInsert = "INSERT INTO category (category) VALUES ('$Cat')";
if(mysqli_query($mysqli, $sqlInsert)){
mysqli_close($mysqli);
header("Location: register.php");
}
else{
echo "Error: " . $sqlInsert . "<br>" . mysqli_error($mysqli);
}
}
if(isset($_POST['delLangButton'])){
$sqlInsert = "DELETE FROM language WHERE language='$DelLang'";
if(mysqli_query($mysqli, $sqlInsert)){
mysqli_close($mysqli);
header("Location: register.php");
}
else{
echo "Error: " . $sqlInsert . "<br>" . mysqli_error($mysqli);
}
}
if(isset($_POST['delCatButton'])){
$sqlInsert = "DELETE FROM category WHERE category='$DelCat'";
if(mysqli_query($mysqli, $sqlInsert)){
mysqli_close($mysqli);
header("Location: register.php");
}
else{
echo "Error: " . $sqlInsert . "<br>" . mysqli_error($mysqli);
}
}
header("Location: register.php");
?>