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