This repository has been archived by the owner on Aug 25, 2020. It is now read-only.
/
login.php
65 lines (58 loc) · 1.55 KB
/
login.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
<?php
require_once 'functions.php';
$skip_login = true;
require_once 'functions.omat.php';
if ($login->isUserLoggedIn() == true) {
$check = $db->record("SELECT * FROM users WHERE user_id = $user_id");
if ($check->mooc) {
header("Location: ".URL."mooc");
exit();
}
if (defined("ADMIN")) {
header("Location: ".URL."cms/index");
exit();
}
if (count($permissions) == 1) {
foreach ($permissions as $row) {
$project = $row['dataset'];
}
header("Location: " . URL . "omat/$project/dashboard");
exit();
} elseif (count($permissions) > 1) {
header("Location: " . URL . "omat/projects");
exit();
} else {
header("Location: " . URL . "omat/create");
exit();
}
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<?php echo $header ?>
<title>Login | <?php echo SITENAME ?></title>
<script type="text/javascript">
$(function(){
$("#login_input_username").focus();
});
</script>
</head>
<body>
<?php require_once 'include.header.php'; ?>
<h1>Login</h1>
<?php
// ... ask if we are logged in here:
if ($login->isUserLoggedIn() == true) {
// the user is logged in. you can do whatever you want here.
// for demonstration purposes, we simply show the "you are logged in" view.
include("login/views/logged_in.php");
} else {
// the user is not logged in. you can do whatever you want here.
// for demonstration purposes, we simply show the "you are not logged in" view.
include("login/views/not_logged_in.php");
}
?>
<?php require_once 'include.footer.php'; ?>
</body>
</html>