1 | <?php |
---|
2 | // +-----------------------------------------------------------------------+ |
---|
3 | // | PhpWebGallery - a PHP based picture gallery | |
---|
4 | // | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net | |
---|
5 | // | Copyright (C) 2003-2007 PhpWebGallery Team - http://phpwebgallery.net | |
---|
6 | // +-----------------------------------------------------------------------+ |
---|
7 | // | file : $Id: identification.php 2015 2007-05-15 20:26:56Z rub $ |
---|
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 | // +-----------------------------------------------------------------------+ |
---|
26 | |
---|
27 | //--------------------------------------------------------------------- include |
---|
28 | define('PHPWG_ROOT_PATH','./'); |
---|
29 | include_once( PHPWG_ROOT_PATH.'include/common.inc.php' ); |
---|
30 | |
---|
31 | // +-----------------------------------------------------------------------+ |
---|
32 | // | Check Access and exit when user status is not ok | |
---|
33 | // +-----------------------------------------------------------------------+ |
---|
34 | check_status(ACCESS_NONE); |
---|
35 | |
---|
36 | //-------------------------------------------------------------- identification |
---|
37 | $errors = array(); |
---|
38 | |
---|
39 | $redirect_to = ''; |
---|
40 | if ( !empty($_GET['redirect']) ) |
---|
41 | { |
---|
42 | $redirect_to = urldecode($_GET['redirect']); |
---|
43 | if ( $user['is_the_guest'] ) |
---|
44 | { |
---|
45 | array_push($errors, l10n('access_forbiden')); |
---|
46 | } |
---|
47 | } |
---|
48 | |
---|
49 | if (isset($_POST['login'])) |
---|
50 | { |
---|
51 | $redirect_to = isset($_POST['redirect']) ? $_POST['redirect'] : ''; |
---|
52 | $remember_me = isset($_POST['remember_me']) and $_POST['remember_me']==1; |
---|
53 | if ( try_log_user($_POST['username'], $_POST['password'], $remember_me) ) |
---|
54 | { |
---|
55 | redirect(empty($redirect_to) ? make_index_url() : $redirect_to); |
---|
56 | } |
---|
57 | else |
---|
58 | { |
---|
59 | array_push( $errors, l10n('invalid_pwd') ); |
---|
60 | } |
---|
61 | } |
---|
62 | |
---|
63 | //----------------------------------------------------- template initialization |
---|
64 | // |
---|
65 | // Start output of page |
---|
66 | // |
---|
67 | $title = l10n('identification'); |
---|
68 | $page['body_id'] = 'theIdentificationPage'; |
---|
69 | include(PHPWG_ROOT_PATH.'include/page_header.php'); |
---|
70 | |
---|
71 | $template->set_filenames( array('identification'=>'identification.tpl') ); |
---|
72 | |
---|
73 | $template->assign_vars( |
---|
74 | array( |
---|
75 | 'U_REGISTER' => PHPWG_ROOT_PATH.'register.php', |
---|
76 | 'U_LOST_PASSWORD' => PHPWG_ROOT_PATH.'password.php', |
---|
77 | 'U_HOME' => make_index_url(), |
---|
78 | 'U_REDIRECT' => $redirect_to, |
---|
79 | |
---|
80 | 'F_LOGIN_ACTION' => PHPWG_ROOT_PATH.'identification.php' |
---|
81 | )); |
---|
82 | |
---|
83 | if ($conf['authorize_remembering']) |
---|
84 | { |
---|
85 | $template->assign_block_vars('remember_me',array()); |
---|
86 | } |
---|
87 | if ($conf['allow_user_registration']) |
---|
88 | { |
---|
89 | $template->assign_block_vars('register',array()); |
---|
90 | } |
---|
91 | |
---|
92 | //-------------------------------------------------------------- errors display |
---|
93 | if ( sizeof( $errors ) != 0 ) |
---|
94 | { |
---|
95 | $template->assign_block_vars('errors',array()); |
---|
96 | for ( $i = 0; $i < sizeof( $errors ); $i++ ) |
---|
97 | { |
---|
98 | $template->assign_block_vars('errors.error',array('ERROR'=>$errors[$i])); |
---|
99 | } |
---|
100 | } |
---|
101 | //-------------------------------------------------------------- visit as guest |
---|
102 | $template->assign_block_vars('free_access',array()); |
---|
103 | //----------------------------------------------------------- html code display |
---|
104 | $template->parse('identification'); |
---|
105 | include(PHPWG_ROOT_PATH.'include/page_tail.php'); |
---|
106 | ?> |
---|