-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpost-handler.php
More file actions
62 lines (51 loc) · 1.33 KB
/
post-handler.php
File metadata and controls
62 lines (51 loc) · 1.33 KB
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
<?php
/**
* Created by PhpStorm.
* User: mzalm
* Date: 2018/04/19
* Time: 20:11
*/
require_once "dbinterface.php";
if ($_POST == NULL || $_POST[ 'method' ] == NULL) {
header('Location: index.php');
}
else {
session_start();
$db = dbInterface::getInstance();
switch ($_POST['method']) {
case "page-new-entry":
if ($_POST[ 'table' ] != NULL) {
setCookieSession($_POST[ 'table' ]);
}
goToPage("new-entry.php");
break;
case "page-history":
if ($_POST[ 'table' ] != NULL) {
setCookieSession($_POST[ 'table' ]);
}
goToPage("log-history.php");
break;
case "submit-log":
$db->makeLog( $_SESSION[ 'table' ], $_POST['log-entry']);
goToPage("log-history.php");
break;
case "make-project":
$db->makeProject($_POST[ 'project-name' ]);
goToPage("index.php");
break;
case "kill-project":
$db->killProject($_POST[ 'table' ]);
goToPage("index.php");
break;
default:
break;
}
}
function setCookieSession($table) {
if ($table != NULL) {
$_SESSION[ 'table' ] = $table;
}
}
function goToPage($page) {
header("Location: " . $page);
}