-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
93 lines (67 loc) · 2.11 KB
/
index.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
84
85
86
87
88
89
90
91
92
93
<?php
session_start();
ob_start();
require "config/connection.php";
if(!isset($_GET['page'])) {
$page = "index";
} else {
switch ($_GET['page']) {
case 'cars':
$page = "cars";
break;
case 'carDetails':
$page = "carDetails";
break;
case 'services':
$page = "services";
break;
case 'about':
$page = "about";
break;
case 'contact':
$page = "contact";
break;
case 'blog':
$page = "blog";
break;
case 'login':
$page = "login";
break;
case 'register':
$page = "register";
break;
case 'logout':
$page = "logout";
break;
case 'profile':
if(isset($_SESSION['user']) && $_SESSION['user']['idRole'] == 2) {
$page = "profile";
} else if (isset($_SESSION['user']) && $_SESSION['user']['idRole'] == 1) {
$page = "adminPanel";
} else {
header("Location: index.php?page=login");
}
break;
case "author":
$page = "author";
break;
case 'admin':
if(isset($_SESSION['user']) && $_SESSION['user']['idRole'] == 1) {
$page = "adminPanel";
} else {
header("Location: index.php?page=login");
}
break;
default:
$page = "index";
break;
}
}
$metaPodaci = handleMetaData($page);
require "views/fixed/head.php";
// require "views/fixed/nav.php";
require "views/fixed/header.php";
// var_dump($_SESSION['user']);
require "views/{$page}.php";
require "views/fixed/footer.php";
?>