-
Notifications
You must be signed in to change notification settings - Fork 0
/
addAdditionalData.php
executable file
·47 lines (36 loc) · 1.18 KB
/
addAdditionalData.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
<?php require('core/init.php'); ?>
<?php
if (!isset($_SESSION['user_name'])) {
redirect('index.php', 'Niste prijavljeni na sistem', 'error');
} else {
//Get Template & Assing Vars
$template = new Template('templates/addAdditionalData.php');
//Create Validator object
$validate = new Validator;
// Create Company Object
$addAdditionalData = new NewCompany;
if (isset($_POST['addAdditionalData'])) {
// Sanitize POST data
$_POST = filter_input_array(INPUT_POST, FILTER_SANITIZE_STRING);
//Get Vars
$data = [
'company_id' => $_SESSION['company_id'],
'linkName' => trim($_POST['linkName']),
'link' => trim($_POST['link']),
'linkType' => trim($_POST['linkType'])
];
//Required array
$field_array = array('linkName', 'link', 'linkType');
if ($validate->isRequired($field_array)) {
if ($addAdditionalData->addAdditionalData($data)) {
redirect('addAdditionalData.php', 'Uspešno ste dodali dodatne informacije', 'success');
} else {
redirect('addAdditionalData.php', 'Desilo se ne objašnjivo', 'error');
}
} else {
redirect('addAdditionalData.php', 'Molim vas popunite sva obavezna polja', 'error');
}
}
// Display template
echo $template;
}