forked from ashutoshdhundhara/tu_haa
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
92 lines (83 loc) · 2.49 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
<?php
/**
* Default script.
*/
/**
* Get all required libraries.
*/
require_once 'libraries/common.inc.php';
require_once 'libraries/recaptcha/recaptchalib.php';
// Start a secure session.
HAA_secureSession();
// Redirect user to correct page.
HAA_pageCheck();
$response = HAA_Response::getInstance();
$header = $response->getHeader();
$header->addFile('minified/login.js', 'js');
$header->addFile('minified/login.css', 'css');
$header->setTitle('Home');
$html_output = '';
$login_error = '';
$recaptcha = '';
// If to show captcha error message.
if (isset($_GET['captcha_error']) && $_GET['captcha_error'] == true) {
$login_error = '<tr>'
. '<td colspan="2" class="red">'
. 'Entered captcha is invalid.'
. '</td>'
. '</tr>';
}
// If to show login error message.
if (isset($_GET['login_error']) && $_GET['login_error'] == true) {
$login_error = '<tr>'
. '<td colspan="2" class="red">'
. 'Invalid Login ID or Password.'
. '</td>'
. '</tr>';
}
// If to show Captcha.
if (isset($_SESSION['show_captcha'])) {
$recaptcha = '<tr>'
. '<td colspan="2">'
. recaptcha_get_html(captchaPublicKey)
. '</td>'
. '</tr>';
}
// Check if login is enabled or not.
if (HAA_isloginEnabled() != 'ENABLED') {
$login_error = '<tr>'
. '<td colspan="2" class="red">'
. HAA_getLoginStatusMessage()
. '</td>'
. '</tr>';
}
// Build login form. --START--
$html_output .= '<form id="login_form" class="login_form gray_grad box"'
. ' action="login.php" method="POST">'
. '<table>'
. '<caption>LOGIN</caption>'
. '<tbody>'
. $login_error
. '<tr><td><label for="input_username">Login ID:</label></td>'
. '<td>'
. '<input type="text" name="haa_username" id="input_username"'
. ' title="Please provide your Group ID/Login ID">'
. '</td></tr>'
. '<tr><td><label for="input_password">Password:</label></td>'
. '<td>'
. '<input type="password" name="haa_password" id="input_password"'
. ' title="Please provide your password">'
. '</td></tr>'
. $recaptcha
. '<tr><td colspan="2">'
. '<input class="submitBtn" type="submit" name="submit" value="Login">'
. '</td></tr>'
. '<tr><td colspan="2"><a href="register.php">Register</a></td></tr>'
. '<tr><td colspan="2"><a href="group.php">Create Group</a></td></tr>'
. '</tbody>'
. '</table>'
. '</form>';
// Build login form. --END--
$response->addHTML($html_output);
$response->response();
?>