1 | <?php |
---|
2 | // +-----------------------------------------------------------------------+ |
---|
3 | // | identification.php | |
---|
4 | // +-----------------------------------------------------------------------+ |
---|
5 | // | application : PhpWebGallery <http://phpwebgallery.net> | |
---|
6 | // | branch : BSF (Best So Far) | |
---|
7 | // +-----------------------------------------------------------------------+ |
---|
8 | // | file : $RCSfile$ |
---|
9 | // | last update : $Date: 2004-03-20 00:52:37 +0000 (Sat, 20 Mar 2004) $ |
---|
10 | // | last modifier : $Author: gweltas $ |
---|
11 | // | revision : $Revision: 393 $ |
---|
12 | // +-----------------------------------------------------------------------+ |
---|
13 | // | This program is free software; you can redistribute it and/or modify | |
---|
14 | // | it under the terms of the GNU General Public License as published by | |
---|
15 | // | the Free Software Foundation | |
---|
16 | // | | |
---|
17 | // | This program is distributed in the hope that it will be useful, but | |
---|
18 | // | WITHOUT ANY WARRANTY; without even the implied warranty of | |
---|
19 | // | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
---|
20 | // | General Public License for more details. | |
---|
21 | // | | |
---|
22 | // | You should have received a copy of the GNU General Public License | |
---|
23 | // | along with this program; if not, write to the Free Software | |
---|
24 | // | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, | |
---|
25 | // | USA. | |
---|
26 | // +-----------------------------------------------------------------------+ |
---|
27 | |
---|
28 | //----------------------------------------------------------- include |
---|
29 | define('PHPWG_ROOT_PATH','./'); |
---|
30 | include_once( PHPWG_ROOT_PATH.'include/common.inc.php' ); |
---|
31 | |
---|
32 | //-------------------------------------------------------------- identification |
---|
33 | $errors = array(); |
---|
34 | if ( isset( $_POST['login'] ) ) |
---|
35 | { |
---|
36 | // retrieving the encrypted password of the login submitted |
---|
37 | $query = 'SELECT password'; |
---|
38 | $query.= ' FROM '.USERS_TABLE; |
---|
39 | $query.= " WHERE username = '".$_POST['username']."';"; |
---|
40 | $row = mysql_fetch_array( mysql_query( $query ) ); |
---|
41 | if( $row['password'] == md5( $_POST['password'] ) ) |
---|
42 | { |
---|
43 | $session_id = session_create( $_POST['username'] ); |
---|
44 | $url = 'category.php?id='.$session_id; |
---|
45 | header( 'Request-URI: '.$url ); |
---|
46 | header( 'Content-Location: '.$url ); |
---|
47 | header( 'Location: '.$url ); |
---|
48 | exit(); |
---|
49 | } |
---|
50 | else |
---|
51 | { |
---|
52 | array_push( $errors, $lang['invalid_pwd'] ); |
---|
53 | } |
---|
54 | } |
---|
55 | //----------------------------------------------------- template initialization |
---|
56 | // |
---|
57 | // Start output of page |
---|
58 | // |
---|
59 | $title = $lang['ident_page_title']; |
---|
60 | include(PHPWG_ROOT_PATH.'include/page_header.php'); |
---|
61 | |
---|
62 | $template->set_filenames( array('identification'=>'identification.tpl') ); |
---|
63 | |
---|
64 | $template->assign_vars(array( |
---|
65 | 'MAIL_ADMIN' => $conf['mail_webmaster'], |
---|
66 | |
---|
67 | 'L_TITLE' => $lang['ident_title'], |
---|
68 | 'L_USERNAME' => $lang['login'], |
---|
69 | 'L_PASSWORD' => $lang['password'], |
---|
70 | 'L_LOGIN' => $lang['submit'], |
---|
71 | 'L_GUEST' => $lang['ident_guest_visit'], |
---|
72 | 'L_REGISTER' => $lang['ident_register'], |
---|
73 | 'L_FORGET' => $lang['ident_forgotten_password'], |
---|
74 | |
---|
75 | 'T_STYLE' => $user['template'], |
---|
76 | |
---|
77 | 'F_LOGIN_ACTION' => add_session_id('identification.php') |
---|
78 | )); |
---|
79 | |
---|
80 | //-------------------------------------------------------------- errors display |
---|
81 | if ( sizeof( $errors ) != 0 ) |
---|
82 | { |
---|
83 | $template->assign_block_vars('errors',array()); |
---|
84 | for ( $i = 0; $i < sizeof( $errors ); $i++ ) |
---|
85 | { |
---|
86 | $template->assign_block_vars('errors.error',array('ERROR'=>$errors[$i])); |
---|
87 | } |
---|
88 | } |
---|
89 | |
---|
90 | //-------------------------------------------------------------- visit as guest |
---|
91 | if ( $conf['access'] == 'free' ) |
---|
92 | { |
---|
93 | $template->assign_block_vars('free_access',array()); |
---|
94 | } |
---|
95 | //----------------------------------------------------------- html code display |
---|
96 | $template->pparse('identification'); |
---|
97 | include(PHPWG_ROOT_PATH.'include/page_tail.php'); |
---|
98 | ?> |
---|