[2] | 1 | <?php |
---|
[354] | 2 | // +-----------------------------------------------------------------------+ |
---|
[2297] | 3 | // | Piwigo - a PHP based picture gallery | |
---|
| 4 | // +-----------------------------------------------------------------------+ |
---|
[3046] | 5 | // | Copyright(C) 2008-2009 Piwigo Team http://piwigo.org | |
---|
[2297] | 6 | // | Copyright(C) 2003-2008 PhpWebGallery Team http://phpwebgallery.net | |
---|
| 7 | // | Copyright(C) 2002-2003 Pierrick LE GALL http://le-gall.net/pierrick | |
---|
| 8 | // +-----------------------------------------------------------------------+ |
---|
| 9 | // | This program is free software; you can redistribute it and/or modify | |
---|
| 10 | // | it under the terms of the GNU General Public License as published by | |
---|
| 11 | // | the Free Software Foundation | |
---|
| 12 | // | | |
---|
| 13 | // | This program is distributed in the hope that it will be useful, but | |
---|
| 14 | // | WITHOUT ANY WARRANTY; without even the implied warranty of | |
---|
| 15 | // | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
---|
| 16 | // | General Public License for more details. | |
---|
| 17 | // | | |
---|
| 18 | // | You should have received a copy of the GNU General Public License | |
---|
| 19 | // | along with this program; if not, write to the Free Software | |
---|
| 20 | // | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, | |
---|
| 21 | // | USA. | |
---|
| 22 | // +-----------------------------------------------------------------------+ |
---|
[2] | 23 | |
---|
[402] | 24 | //--------------------------------------------------------------------- include |
---|
[364] | 25 | define('PHPWG_ROOT_PATH','./'); |
---|
| 26 | include_once( PHPWG_ROOT_PATH.'include/common.inc.php' ); |
---|
[345] | 27 | |
---|
[1851] | 28 | // +-----------------------------------------------------------------------+ |
---|
| 29 | // | Check Access and exit when user status is not ok | |
---|
| 30 | // +-----------------------------------------------------------------------+ |
---|
[2325] | 31 | check_status(ACCESS_FREE); |
---|
[1851] | 32 | |
---|
[2] | 33 | //-------------------------------------------------------------- identification |
---|
[45] | 34 | $errors = array(); |
---|
[1052] | 35 | |
---|
| 36 | $redirect_to = ''; |
---|
| 37 | if ( !empty($_GET['redirect']) ) |
---|
| 38 | { |
---|
[1061] | 39 | $redirect_to = urldecode($_GET['redirect']); |
---|
[2029] | 40 | if ( is_a_guest() ) |
---|
[1052] | 41 | { |
---|
[2014] | 42 | array_push($errors, l10n('access_forbiden')); |
---|
[1052] | 43 | } |
---|
| 44 | } |
---|
| 45 | |
---|
[541] | 46 | if (isset($_POST['login'])) |
---|
[2] | 47 | { |
---|
[1056] | 48 | $redirect_to = isset($_POST['redirect']) ? $_POST['redirect'] : ''; |
---|
[1744] | 49 | $remember_me = isset($_POST['remember_me']) and $_POST['remember_me']==1; |
---|
| 50 | if ( try_log_user($_POST['username'], $_POST['password'], $remember_me) ) |
---|
[2] | 51 | { |
---|
[1082] | 52 | redirect(empty($redirect_to) ? make_index_url() : $redirect_to); |
---|
[2] | 53 | } |
---|
| 54 | else |
---|
| 55 | { |
---|
[2014] | 56 | array_push( $errors, l10n('invalid_pwd') ); |
---|
[2] | 57 | } |
---|
| 58 | } |
---|
[1568] | 59 | |
---|
[2] | 60 | //----------------------------------------------------- template initialization |
---|
[345] | 61 | // |
---|
| 62 | // Start output of page |
---|
| 63 | // |
---|
[2014] | 64 | $title = l10n('identification'); |
---|
[850] | 65 | $page['body_id'] = 'theIdentificationPage'; |
---|
[369] | 66 | include(PHPWG_ROOT_PATH.'include/page_header.php'); |
---|
[345] | 67 | |
---|
[365] | 68 | $template->set_filenames( array('identification'=>'identification.tpl') ); |
---|
| 69 | |
---|
[2223] | 70 | $template->assign( |
---|
[402] | 71 | array( |
---|
[2223] | 72 | 'U_LOST_PASSWORD' => get_root_url().'password.php', |
---|
[1052] | 73 | 'U_REDIRECT' => $redirect_to, |
---|
[1061] | 74 | |
---|
[2223] | 75 | 'F_LOGIN_ACTION' => get_root_url().'identification.php', |
---|
| 76 | 'authorize_remembering' => $conf['authorize_remembering'], |
---|
[402] | 77 | )); |
---|
[555] | 78 | |
---|
[1652] | 79 | if ($conf['allow_user_registration']) |
---|
| 80 | { |
---|
[2223] | 81 | $template->assign('U_REGISTER', get_root_url().'register.php' ); |
---|
[1652] | 82 | } |
---|
| 83 | |
---|
[2] | 84 | //-------------------------------------------------------------- errors display |
---|
[87] | 85 | if ( sizeof( $errors ) != 0 ) |
---|
[2] | 86 | { |
---|
[2223] | 87 | $template->assign('errors', $errors); |
---|
[2] | 88 | } |
---|
[2223] | 89 | |
---|
[2] | 90 | //----------------------------------------------------------- html code display |
---|
[2223] | 91 | $template->pparse('identification'); |
---|
[369] | 92 | include(PHPWG_ROOT_PATH.'include/page_tail.php'); |
---|
[362] | 93 | ?> |
---|