[1] | 1 | <?php |
---|
| 2 | /** |
---|
[42] | 3 | * login.php |
---|
[1] | 4 | * Code by Strangecode :: www.strangecode.com :: This document contains copyrighted information |
---|
| 5 | */ |
---|
| 6 | |
---|
[28] | 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. |
---|
[20] | 9 | if (getFormData('boomerang', false) && isset($_SERVER['HTTP_REFERER'])) { |
---|
[129] | 10 | $app->setBoomerangURL($_SERVER['HTTP_REFERER'], 'login'); |
---|
[1] | 11 | } |
---|
[129] | 12 | $app->sslOn(); |
---|
[1] | 13 | |
---|
| 14 | $frm['username'] = getFormdata('username'); |
---|
| 15 | $frm['password'] = getFormdata('password'); |
---|
| 16 | |
---|
| 17 | if (getFormdata('username', false)) { |
---|
[103] | 18 | // Form has been submitted, check if the user login information is correct. |
---|
[1] | 19 | |
---|
| 20 | if ($auth->login($frm['username'], $frm['password'])) { |
---|
[129] | 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__); |
---|
[1] | 24 | } else { |
---|
[129] | 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__); |
---|
[1] | 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 | ?> |
---|