-
Notifications
You must be signed in to change notification settings - Fork 5
/
correct.php
83 lines (66 loc) · 1.6 KB
/
correct.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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
<?php
include "functions_GRML.php";
include "TimeTrack.class.php";
session_start();
$timetrack = new TimeTrack();
$mobiledevice = detectMobileDevices();
$curdate = $_REQUEST['date'];
if(!isset($curdate)) {
die('Wrong parameter!');
}
$loggedin=false;
$loggedin = $timetrack->login($_POST['u'], $_POST['p'], $_GET['h']);
$hash = $timetrack->hash;
if(!$loggedin) {
unset($hash);
unset($_SESSION['userhash']);
}
if (!$loggedin) {
if ($hash!="") {
unset($_SESSION['userhash']);
header("Location: download.php?h=".$hash);
exit;
} else {
unset($_SESSION['userhash']);
header("Location: index.php?e=1");
exit;
}
}
$forward = false;
$formsend = $_POST['submit'];
$newstart = $_POST['newstart'];
$newend = $_POST['newend'];
$oldstart = $_POST['oldstart'];
$oldend = $_POST['oldend'];
if(isset($formsend, $newstart, $newend, $oldstart, $oldend)) {
$success = true;
if($oldstart != $newstart) {
$success = $timetrack->updateFile($oldstart, $newstart);
}
if($oldend != $newend) {
$success = $timetrack->updateFile($oldend, $newend);
}
if(!$success) {
die("Update not successful");
} else {
$forward = true;
}
}
if(isset($_POST['daysize']) && isset($_POST['date']))
{
$timetrack->changeDailyWorkingTimeForADay($_POST['date'], $_POST['daysize']);
$oldstart = strtotime($_POST['date']);
$forward = true;
}
if($forward === true)
{
$month = date("Ym", $oldstart);
header('Location: show.php?m=' . $month);
}
$timetrack->setMonth(date("Ym",strtotime($curdate)));
$data = $timetrack->parseData();
$day = $data['days'][$curdate];
if(!isset($day)) {
die('Day not found!');
}
include "views/correct.phtml";