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: register.php 2177 2007-12-11 06:04:07Z rub $ |
---|
8 | // | last update : $Date: 2007-12-11 06:04:07 +0000 (Tue, 11 Dec 2007) $ |
---|
9 | // | last modifier : $Author: rub $ |
---|
10 | // | revision : $Revision: 2177 $ |
---|
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 | //----------------------------------------------------------- user registration |
---|
37 | |
---|
38 | if (!$conf['allow_user_registration']) |
---|
39 | { |
---|
40 | page_forbidden('User registration closed'); |
---|
41 | } |
---|
42 | |
---|
43 | $errors = array(); |
---|
44 | if (isset($_POST['submit'])) |
---|
45 | { |
---|
46 | if ($_POST['password'] != $_POST['password_conf']) |
---|
47 | { |
---|
48 | array_push($errors, l10n('reg_err_pass')); |
---|
49 | } |
---|
50 | |
---|
51 | $errors = |
---|
52 | register_user($_POST['login'], |
---|
53 | $_POST['password'], |
---|
54 | $_POST['mail_address'], |
---|
55 | true, |
---|
56 | $errors); |
---|
57 | |
---|
58 | if (count($errors) == 0) |
---|
59 | { |
---|
60 | $user_id = get_userid($_POST['login']); |
---|
61 | log_user($user_id, false); |
---|
62 | redirect(make_index_url()); |
---|
63 | } |
---|
64 | } |
---|
65 | |
---|
66 | $login = !empty($_POST['login'])?$_POST['login']:''; |
---|
67 | $email = !empty($_POST['mail_address'])?$_POST['mail_address']:''; |
---|
68 | |
---|
69 | //----------------------------------------------------- template initialization |
---|
70 | // |
---|
71 | // Start output of page |
---|
72 | // |
---|
73 | $title= l10n('register_page_title'); |
---|
74 | $page['body_id'] = 'theRegisterPage'; |
---|
75 | include(PHPWG_ROOT_PATH.'include/page_header.php'); |
---|
76 | |
---|
77 | $template->set_filenames( array('register'=>'register.tpl') ); |
---|
78 | $template->assign_vars(array( |
---|
79 | 'U_HOME' => make_index_url(), |
---|
80 | |
---|
81 | 'F_ACTION' => 'register.php', |
---|
82 | 'F_LOGIN' => $login, |
---|
83 | 'F_EMAIL' => $email |
---|
84 | )); |
---|
85 | |
---|
86 | //-------------------------------------------------------------- errors display |
---|
87 | if ( sizeof( $errors ) != 0 ) |
---|
88 | { |
---|
89 | $template->assign_block_vars('errors',array()); |
---|
90 | for ( $i = 0; $i < sizeof( $errors ); $i++ ) |
---|
91 | { |
---|
92 | $template->assign_block_vars('errors.error',array('ERROR'=>$errors[$i])); |
---|
93 | } |
---|
94 | } |
---|
95 | |
---|
96 | $template->parse('register'); |
---|
97 | include(PHPWG_ROOT_PATH.'include/page_tail.php'); |
---|
98 | ?> |
---|