-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindexx.php
More file actions
72 lines (54 loc) · 1.56 KB
/
Copy pathindexx.php
File metadata and controls
72 lines (54 loc) · 1.56 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
63
64
65
66
67
68
69
70
71
72
<?php
session_start();
//session_write_close();
require_once 'core/core.php';
$db = db::connect();
if (isset($_SESSION['admin_id'])) {
$records = $db->prepare('SELECT id_admin, email, password FROM admins WHERE id_admin = :id');
$records->bindParam(':id', $_SESSION['admin_id']);
$records->execute();
$results = $records->fetch(PDO::FETCH_ASSOC);
$admin = null;
if (count($results) > 0) {
$admin = $results;
}
}
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Welcome to you WebApp</title>
<link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
<!--<link rel="stylesheet" href="assets/css/style.css">-->
</head>
<body>
<?php require 'partials/header.php' ?>
<?php if(!empty($admin)): ?>
<br> Welcome. <?= $admin['email']; ?>
<br>You are Successfully Logged In
<?php
$c = isset($_GET['c']) ? $_GET['c'] : 'administrator';
//$c = 'administratorController';
$m = isset($_GET['m']) ? $_GET['m'] : 'index';
$c .= 'Controller';
//var_dump($m, $c);
if (file_exists('controllers/' . $c . '.php')) {
require_once 'controllers/' . $c . '.php';
if (method_exists($c, $m)) {
$c = new $c;
call_user_func([$c, $m]);
} else {
die("Error : El metodo o funcion [{$m}()] no existe");
}
} else {
die("Error : El controlador [{$c}] no existe.");
}
?>
<?php else: ?>
<h1>Please Login or SignUp</h1>
<a href="login.php">Login</a> or
<a href="signup.php">SignUp</a>
<?php endif; ?>
</body>
</html>