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