-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathitem_add.php
More file actions
35 lines (32 loc) · 981 Bytes
/
Copy pathitem_add.php
File metadata and controls
35 lines (32 loc) · 981 Bytes
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
<?php
session_start();
include 'utilities.php';
header('Content-Type: application/json');
if ($_POST["title"] != "" && $_POST["category"] != "") {
$title = filter($_POST["title"]);
$description = filter($_POST["description"]);
$category = filter($_POST["category"]);
if ($title != "" && $category != "") {
//Aggiungo i dati in database
include 'db_class.php';
$my_db = new sql_class;
$my_db->addItem($title, $description, $category);
echo json_encode([
"status" => "success",
"message" => "Task aggiunto con successo."
]);
exit;
} else {
echo json_encode([
"status" => "danger",
"message" => "Inserimento non eseguito: non puoi usare caratteri speciali."
]);
exit;
}
} else {
echo json_encode([
"status" => "danger",
"message" => "Inserimento non eseguito: servono titolo e categoria."
]);
exit;
}