-
Notifications
You must be signed in to change notification settings - Fork 0
/
cadastrar.php
37 lines (27 loc) · 1009 Bytes
/
cadastrar.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
<?php
ob_start();
define("TITLE", "Cadastrar");
define("ROUTE", "cadastrar.php");
require_once('includes/databaseFunctions.php');
if($WEB) { require_once("includes/form_cadastrar.php"); }
if(isset($_POST['title'])) {
$title = filter_input(INPUT_POST, 'title', FILTER_SANITIZE_STRING);
$title = trim(preg_replace('/\s+/', " ", $title));
$description = filter_input(INPUT_POST, 'description', FILTER_SANITIZE_STRING);
if($title == null) {
echo 'Digite um título válido!';
if($WEB)
header('Location: cadastrar.php');
exit;
}
$ID = INSERT(array(
'title' => $title,
'description' => $description,
'due_date' => $_POST['date'] . ' ' . $_POST['time'],
'status' => $_POST['status']
));
echo "Cadastro realizado com sucesso";
if($WEB)
header("Location: index.php");
}
?>