1 | <?php |
---|
2 | /** |
---|
3 | * login.php |
---|
4 | * Code by Strangecode :: www.strangecode.com :: This document contains copyrighted information |
---|
5 | */ |
---|
6 | |
---|
7 | // We may want to use the add/edit interface from another script, so this |
---|
8 | // allows us to remember which page we came from so we can go back there. |
---|
9 | if (getFormData('boomerang', false) && isset($_SERVER['HTTP_REFERER'])) { |
---|
10 | App::setBoomerangURL($_SERVER['HTTP_REFERER'], 'login'); |
---|
11 | } |
---|
12 | App::sslOn(); |
---|
13 | |
---|
14 | $frm['username'] = getFormdata('username'); |
---|
15 | $frm['password'] = getFormdata('password'); |
---|
16 | |
---|
17 | if (getFormdata('username', false)) { |
---|
18 | // Form has been submitted, check if the user login information is correct. |
---|
19 | |
---|
20 | if ($auth->login($frm['username'], $frm['password'])) { |
---|
21 | App::raiseMsg(_("You are now logged in."), MSG_SUCCESS, __FILE__, __LINE__); |
---|
22 | App::dieBoomerangURL('login'); |
---|
23 | App::logMsg(sprintf('%s %s successfully logged-in.', $auth->getVal('auth_name'), $frm['username']), LOG_INFO, __FILE__, __LINE__); |
---|
24 | } else { |
---|
25 | App::raiseMsg(_("Login failed, please try again."), MSG_NOTICE, __FILE__, __LINE__); |
---|
26 | App::logMsg(sprintf('%s %s failed login using (MD5ed) password: %s', ucfirst($auth->getVal('auth_name')), $frm['username'], md5($frm['password'])), LOG_NOTICE, __FILE__, __LINE__); |
---|
27 | } |
---|
28 | } |
---|
29 | |
---|
30 | // Titles and navigation header. |
---|
31 | $nav->addPage(_("Login")); |
---|
32 | |
---|
33 | // Templates. |
---|
34 | include 'header.ihtml'; |
---|
35 | include 'codebase/services/templates/login_form.ihtml'; |
---|
36 | include 'footer.ihtml'; |
---|
37 | |
---|
38 | ?> |
---|