[1] | 1 | <?php |
---|
| 2 | /** |
---|
[362] | 3 | * The Strangecode Codebase - a general application development framework for PHP |
---|
| 4 | * For details visit the project site: <http://trac.strangecode.com/codebase/> |
---|
[376] | 5 | * Copyright 2001-2010 Strangecode, LLC |
---|
[362] | 6 | * |
---|
| 7 | * This file is part of The Strangecode Codebase. |
---|
| 8 | * |
---|
| 9 | * The Strangecode Codebase is free software: you can redistribute it and/or |
---|
| 10 | * modify it under the terms of the GNU General Public License as published by the |
---|
| 11 | * Free Software Foundation, either version 3 of the License, or (at your option) |
---|
| 12 | * any later version. |
---|
| 13 | * |
---|
| 14 | * The Strangecode Codebase is distributed in the hope that it will be useful, but |
---|
| 15 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
---|
| 16 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more |
---|
| 17 | * details. |
---|
| 18 | * |
---|
| 19 | * You should have received a copy of the GNU General Public License along with |
---|
| 20 | * The Strangecode Codebase. If not, see <http://www.gnu.org/licenses/>. |
---|
| 21 | */ |
---|
| 22 | |
---|
| 23 | /** |
---|
[42] | 24 | * login.php |
---|
[1] | 25 | */ |
---|
| 26 | |
---|
[28] | 27 | // We may want to use the add/edit interface from another script, so this |
---|
| 28 | // allows us to remember which page we came from so we can go back there. |
---|
[20] | 29 | if (getFormData('boomerang', false) && isset($_SERVER['HTTP_REFERER'])) { |
---|
[136] | 30 | $app->setBoomerangURL($_SERVER['HTTP_REFERER'], 'login'); |
---|
[1] | 31 | } |
---|
[136] | 32 | $app->sslOn(); |
---|
[1] | 33 | |
---|
| 34 | $frm['username'] = getFormdata('username'); |
---|
| 35 | $frm['password'] = getFormdata('password'); |
---|
| 36 | |
---|
| 37 | if (getFormdata('username', false)) { |
---|
[103] | 38 | // Form has been submitted, check if the user login information is correct. |
---|
[1] | 39 | |
---|
| 40 | if ($auth->login($frm['username'], $frm['password'])) { |
---|
[136] | 41 | $app->raiseMsg(_("You are now logged in."), MSG_SUCCESS, __FILE__, __LINE__); |
---|
| 42 | $app->dieBoomerangURL('login'); |
---|
[202] | 43 | $app->logMsg(sprintf('User %s successfully logged-in.', $frm['username']), LOG_INFO, __FILE__, __LINE__); |
---|
[1] | 44 | } else { |
---|
[136] | 45 | $app->raiseMsg(_("Login failed, please try again."), MSG_NOTICE, __FILE__, __LINE__); |
---|
[371] | 46 | $app->logMsg(sprintf('User %s failed login (encrypted password: %s)', $frm['username'], $auth->encryptPassword($frm['password'])), LOG_NOTICE, __FILE__, __LINE__); |
---|
[1] | 47 | } |
---|
| 48 | } |
---|
| 49 | |
---|
| 50 | // Titles and navigation header. |
---|
[202] | 51 | $nav->add(_("Login")); |
---|
[1] | 52 | |
---|
| 53 | // Templates. |
---|
| 54 | include 'header.ihtml'; |
---|
| 55 | include 'codebase/services/templates/login_form.ihtml'; |
---|
| 56 | include 'footer.ihtml'; |
---|
| 57 | |
---|
| 58 | ?> |
---|