-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathadd_new_todo.php
executable file
·67 lines (57 loc) · 1.82 KB
/
add_new_todo.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
64
65
66
67
<?php
require_once 'conf/smarty-conf.php';
include 'functions/todo_functions.php';
include 'functions/user_functions.php';
include 'functions/chat_functions.php';
$module_no = 4;
if ($_SESSION ['login'] == 1) {
if (check_access ( $module_no, $_SESSION ['user_id'] ) == 1) {
if ($_REQUEST ['job'] == "add_new") {
$smarty->assign ( 'page', "Add New" );
$smarty->display ( 'todo/add_new.tpl' );
}
elseif ($_REQUEST ['job'] == "save") {
$from = $_POST ['from'];
$task_name = $_POST ['task_name'];
$description = $_POST ['description'];
$deadline = $_POST ['deadline'];
$amount = $_POST ['amount'];
$received = $_POST ['received'];
$type = $_POST ['type'];
if ($_POST ['to_user']) {
$user_name = $_POST ['to_user'];
$saved_by = $_SESSION ['user_name'];
} else {
$user_name = $_SESSION ['user_name'];
$saved_by = $_SESSION ['user_name'];
}
if ($_POST ['status'] == "Done") {
$status = 1;
} else {
$status = 0;
}
$ref_no = $_POST ['ref_no'];
save_task ( $task_name, $description, $deadline, $amount, $received, $user_name, $status, $ref_no, $type, $saved_by );
if ($from == 'user') {
$smarty->assign ( 'page', "Home" );
$smarty->display ( 'user_home/user_home.tpl' );
} else {
$smarty->assign ( 'page', "Add New" );
$smarty->display ( 'todo/add_new.tpl' );
}
}
else {
$smarty->assign ( 'page', "Add New" );
$smarty->display ( 'todo/add_new.tpl' );
}
} else {
$smarty->assign ( 'error_report', "on" );
$smarty->assign ( 'error_message', "Dear $_SESSION[user_name], you don't have permission to Access To Do" );
$smarty->assign ( 'page', "Access Error" );
$smarty->display ( 'user_home/access_error.tpl' );
}
}
else {
$smarty->assign ( 'error', "Incorrect Login Details!" );
$smarty->display ( 'login/login.tpl' );
}