-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfunction.php
63 lines (54 loc) · 1.44 KB
/
function.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
$servername = "localhost";
$username = "root";
$password = "147258369";
$dbname = "shop";
include 'products_sql.php';
include 'users_sql.php';
include 'basket_sql.php';
include 'category_sql.php';
if (isset($_POST['btnDellCat'])) {
$id = $_POST['id'];
deleteCategory($id);
} else if (isset($_POST['btnAddCat'])) {
$name = $_POST['name'];
putCategory ($name);
} else if (isset($_POST['btnSaveCat'])) {
$id = $_POST['id'];
$name = $_POST['name'];
updateCategory($id, $name);
}
if (isset($_POST['btnDellUser'])) {
$id = $_POST['id'];
deleteUser($id);
} else if (isset($_POST['btnAddUser'])) {
$login = $_POST['login'];
$pass = $_POST['pass'];
putUser($login, $pass);
} else if (isset($_POST['btnSaveUser'])) {
$id = $_POST['id'];
$login = $_POST['login'];
$pass = $_POST['pass'];
updateUserData($id, $login, $pass);
}
if (isset($_POST['btnDellPdkt'])) {
$id = $_POST['id'];
deleteProduct($id);
} else if (isset($_POST['btnAddPdkt'])) {
$name = $_POST['name'];
$description = $_POST['description'];
$price = $_POST['price'];
$img = $_POST['img'];
$category = $_POST['category'];
putProduct($name, $description, $price, $img, $category);
} else if (isset($_POST['btnSavePdkt'])) {
$id = $_POST['id'];
$name = $_POST['name'];
$description = $_POST['description'];
$price = $_POST['price'];
$img = $_POST['img'];
updateProduct($id, $name, $description, $price, $img);
}
header('Location: http://localhost:8100/admin.php');
exit();
?>