1 | <?php |
---|
2 | /*************************************************************************** |
---|
3 | * register.php * |
---|
4 | * ------------------- * |
---|
5 | * application : PhpWebGallery 1.3 <http://phpwebgallery.net> * |
---|
6 | * author : Pierrick LE GALL <pierrick@z0rglub.com> * |
---|
7 | * * |
---|
8 | * $Id: register.php 345 2004-02-02 00:55:18Z gweltas $ |
---|
9 | * * |
---|
10 | ***************************************************************************/ |
---|
11 | |
---|
12 | /*************************************************************************** |
---|
13 | * * |
---|
14 | * This program is free software; you can redistribute it and/or modify * |
---|
15 | * it under the terms of the GNU General Public License as published by * |
---|
16 | * the Free Software Foundation; * |
---|
17 | * * |
---|
18 | ***************************************************************************/ |
---|
19 | |
---|
20 | //----------------------------------------------------------- include |
---|
21 | $phpwg_root_path = './'; |
---|
22 | include_once( $phpwg_root_path.'common.php' ); |
---|
23 | //-------------------------------------------------- access authorization check |
---|
24 | if ( $conf['access'] == "restricted" ) |
---|
25 | { |
---|
26 | echo $lang['only_members']; |
---|
27 | exit(); |
---|
28 | } |
---|
29 | //----------------------------------------------------------- user registration |
---|
30 | $error = array(); |
---|
31 | if ( isset( $_POST['submit'] ) ) |
---|
32 | { |
---|
33 | $error = register_user( $_POST['login'], $_POST['password'], |
---|
34 | $_POST['password_conf'], $_POST['mail_address'] ); |
---|
35 | if ( sizeof( $error ) == 0 ) |
---|
36 | { |
---|
37 | $session_id = session_create( $_POST['login'] ); |
---|
38 | $url = 'category.php?id='.$session_id; |
---|
39 | header( 'Request-URI: '.$url ); |
---|
40 | header( 'Content-Location: '.$url ); |
---|
41 | header( 'Location: '.$url ); |
---|
42 | exit(); |
---|
43 | } |
---|
44 | } |
---|
45 | //----------------------------------------------------- template initialization |
---|
46 | // |
---|
47 | // Start output of page |
---|
48 | // |
---|
49 | $title= $lang['register_page_title']; |
---|
50 | include('include/page_header.php'); |
---|
51 | |
---|
52 | $handle = $vtp->Open( './template/'.$user['template'].'/register.vtp' ); |
---|
53 | // language |
---|
54 | $vtp->setGlobalVar( $handle, 'register_title', $lang['register_title'] ); |
---|
55 | $vtp->setGlobalVar( $handle, 'ident_guest_visit',$lang['ident_guest_visit'] ); |
---|
56 | $vtp->setGlobalVar( $handle, 'submit', $lang['submit'] ); |
---|
57 | initialize_template(); |
---|
58 | //----------------------------------------------------------------- form action |
---|
59 | $vtp->setGlobalVar( $handle, 'form_action', './register.php' ); |
---|
60 | //-------------------------------------------------------------- errors display |
---|
61 | if ( sizeof( $error ) != 0 ) |
---|
62 | { |
---|
63 | $vtp->addSession( $handle, 'errors' ); |
---|
64 | for ( $i = 0; $i < sizeof( $error ); $i++ ) |
---|
65 | { |
---|
66 | $vtp->addSession( $handle, 'li' ); |
---|
67 | $vtp->setVar( $handle, 'li.li', $error[$i] ); |
---|
68 | $vtp->closeSession( $handle, 'li' ); |
---|
69 | } |
---|
70 | $vtp->closeSession( $handle, 'errors' ); |
---|
71 | } |
---|
72 | //----------------------------------------------------------------------- login |
---|
73 | $vtp->addSession( $handle, 'line' ); |
---|
74 | $vtp->setVar( $handle, 'line.name', $lang['login'] ); |
---|
75 | $vtp->addSession( $handle, 'text' ); |
---|
76 | $vtp->setVar( $handle, 'text.name', 'login' ); |
---|
77 | if (isset( $_POST['login'])) |
---|
78 | $vtp->setVar( $handle, 'text.value', $_POST['login'] ); |
---|
79 | $vtp->closeSession( $handle, 'text' ); |
---|
80 | $vtp->closeSession( $handle, 'line' ); |
---|
81 | //-------------------------------------------------------------------- password |
---|
82 | $vtp->addSession( $handle, 'line' ); |
---|
83 | $vtp->setVar( $handle, 'line.name', $lang['password'] ); |
---|
84 | $vtp->addSession( $handle, 'password' ); |
---|
85 | $vtp->setVar( $handle, 'password.name', 'password' ); |
---|
86 | $vtp->setVar( $handle, 'password.value', '' ); |
---|
87 | $vtp->closeSession( $handle, 'password' ); |
---|
88 | $vtp->closeSession( $handle, 'line' ); |
---|
89 | //------------------------------------------------------- password confirmation |
---|
90 | $vtp->addSession( $handle, 'line' ); |
---|
91 | $vtp->setVar( $handle, 'line.name', $lang['reg_confirm'] ); |
---|
92 | $vtp->addSession( $handle, 'password' ); |
---|
93 | $vtp->setVar( $handle, 'password.name', 'password_conf' ); |
---|
94 | $vtp->setVar( $handle, 'password.value', '' ); |
---|
95 | $vtp->closeSession( $handle, 'password' ); |
---|
96 | $vtp->closeSession( $handle, 'line' ); |
---|
97 | //---------------------------------------------------------------- mail address |
---|
98 | $vtp->addSession( $handle, 'line' ); |
---|
99 | $vtp->setVar( $handle, 'line.name', $lang['mail_address'] ); |
---|
100 | $vtp->addSession( $handle, 'text' ); |
---|
101 | $vtp->setVar( $handle, 'text.name', 'mail_address' ); |
---|
102 | if (isset( $_POST['mail_address'])) |
---|
103 | $vtp->setVar( $handle, 'text.value', $_POST['mail_address'] ); |
---|
104 | $vtp->closeSession( $handle, 'text' ); |
---|
105 | $vtp->closeSession( $handle, 'line' ); |
---|
106 | //----------------------------------------------------------- html code display |
---|
107 | $code = $vtp->Display( $handle, 0 ); |
---|
108 | echo $code; |
---|
109 | include('include/page_tail.php'); |
---|
110 | ?> |
---|