/
index.php
80 lines (79 loc) · 1.96 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
<?php
error_reporting(E_ALL);
session_start();
?>
<!doctype html>
<html lang="en">
<head>
<link rel="stylesheet" type="text/css" href="view/css/style.css">
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<meta name="theme-color" content="#037995">
<title>Librería Tecnológico</title>
</head>
<body>
<?php
require_once 'controller/index.php'; // Load the controller
$index = new IndexController(); // Instantiate Index Controller
if(isset($_GET['action'])){
switch($_GET['action']){
case 'books':
$index->showBooks();
break;
case 'autors':
$index->showAutors();
break;
case 'login':
$index->showLoginScreen();
break;
case 'check':
$index->checkLogin();
break;
case 'delete':
break;
case 'edit':
if($_SESSION['user_type'] == 1){
$index->showEditScreen();
}
break;
case 'logout':
$index->logout();
break;
case 'manage';
if($_SESSION['user_type'] == 1)
$index->showManagement();
break;
case 'register':
$index->showRegister('show');
break;
case 'checkr':
$index->register();
break;
case 'search':
$index->search('autor');
break;
case 'searchb':
$index->search('book');
break;
case 'submit':
$index->submitComment();
break;
case 'showbook':
$index->showBook();
break;
case 'profile':
$index->showProfile();
break;
case 'update':
$index->updateManager();
break;
}
}
else {
if(isset($_GET['autor']))
$index->showAutor();
else
$index->showStart(); // Show the default webpage
}
?>
</body>
</html>