-
Notifications
You must be signed in to change notification settings - Fork 0
/
calendarAction.php
63 lines (63 loc) · 2.17 KB
/
calendarAction.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
<?php
session_start();
$_SESSION['isFirstLoad'] = 'FALSE';
if($_SERVER['REQUEST_METHOD'] === 'GET'){
$action = $_GET['action'];
if($action == 'prevM'){
$_SESSION['month'] --;
if($_SESSION['month'] == -1){
$_SESSION['month'] = 11;
$_SESSION['year'] -- ;
}else if($_SESSION['month'] == 12){
$_SESSION['month'] = 0;
$_SESSION['year'] ++;
}
if($_GET['onPage'] == null){
header('location: ./home.php#calendar');
}else{
header('location: ./manageCalendar.php');
}
}else if($action == 'nextM'){
$_SESSION['month'] ++;
if($_SESSION['month'] == -1){
$_SESSION['month'] = 11;
$_SESSION['year'] -- ;
}else if($_SESSION['month'] == 12){
$_SESSION['month'] = 0;
$_SESSION['year'] ++;
}
if($_GET['onPage'] == null){
header('location: ./home.php#calendar');
}else{
header('location: ./manageCalendar.php');
}
}else if($action == 'prevY'){
$_SESSION['year'] --;
if($_SESSION['year'] == -1){
$_SESSION['year'] = 0;
}
if($_GET['onPage'] == null){
header('location: ./home.php#calendar');
}else{
header('location: ./manageCalendar.php');
}
}else if($action == 'nextY'){
$_SESSION['year'] ++;
// nextY result $_SESSION[year] is controlled home beacause of $nowY
if($_GET['onPage'] == null){
header('location: ./home.php#calendar');
}else{
header('location: ./manageCalendar.php');
}
}else if($action == 'reset'){
$_SESSION['isFirstLoad'] = null;
if($_GET['onPage'] == null){
header('location: ./home.php#calendar');
}else{
header('location: ./manageCalendar.php');
}
}
}else{
header('location: sign.php');
}
?>