-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
72 lines (63 loc) · 2.82 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
<?php
$page_title = "Welcome to TutorMe";
require_once("html/html_header.html");
require_once(CLASSES_PATH . "InfoManager.php");
if (isLoggedIn()) {
redirectIn();
}
if (isset($_POST["activate"])) {
if (isset($_POST["user_id"])) {
$user_id = $_POST["user_id"];
if (userExistsById($user_id) === true) {
updateCode($user_id);
if (accountActivation($user_id) === true) {
$_SESSION["flash_msg"] = ACTIVATION_EMAIL_SUCCESS;
} else {
$_SESSION["flash_msg"] = ACTIVATION_EMAIL_FAIL;
}
}
}
}
?>
<div class="my-nav"></div>
<div id="content">
<div id="main-content">
<div class="centered">
<?php displayFlashMsg(); ?>
<?php
if (isset($_POST["email"], $_POST["password"])) {
$login = getUserId($_POST["email"], $_POST["password"]);
if (isNum($login)) {
$_SESSION["user_id"] = $login;
redirect("home", WELCOME_BACK);
} else {
echo $login;
}
}
?>
<br/> <?php # for return_url purposes ?>
<form method="post" action="<?= $_SERVER['REQUEST_URI'] ?>" class="form-signin">
<h3 class="form-signin-heading">Log in</h3>
<label for="input-email" class="sr-only">Email address</label>
<input name="email" value="<?= getRememberMeEmail() ?>" id="input-email" type="email" class="form-control" placeholder="Email address" required="required" autofocus="autofocus"/>
<label for="input-password" class="sr-only">Password</label>
<input name="password" id="input-password" type="password" class="form-control" placeholder="Password" required="required"/>
<label>
<a id="forgot-password" href="#">Forgot Password?</a></label>
<br>
<div class="checkbox">
<label for="remember-me">
<input id="remember-me" name="remember_me" value="remember_me" type="checkbox" <?= checkRemembered() ?> /> Remember Me
</label>
</div>
<input id="login-submit" type="submit" value="Sign in" class="btn btn-lg btn-primary btn-block"/>
<input id="login-submit-disabled" type="submit" value="Sign in" class="btn btn-lg btn-default btn-block" disabled="disabled"/>
</form>
<br/>
<br/>
</div>
</div>
</div>
<div class="my-footer"></div>
<?php require_once("html/ng_scripts.html"); ?>
<?php require_once("html/html_footer.html"); ?>