source: trunk/register.php @ 105

Last change on this file since 105 was 105, checked in by z0rglub, 21 years ago

Using template_initialize

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 4.7 KB
Line 
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 105 2003-09-14 16:21:02Z z0rglub $
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//----------------------------------------------------------- personnal include
21include_once( './include/init.inc.php' );
22//-------------------------------------------------- access authorization check
23if ( $conf['access'] == "restricted" )
24{
25  echo $lang['only_members'];
26  exit();
27}
28//----------------------------------------------------------- user registration
29$error = array();
30if ( isset( $_POST['submit'] ) )
31{
32  $error = register_user( $_POST['login'], $_POST['password'],
33                          $_POST['password_conf'], $_POST['mail_address'] );
34  if ( sizeof( $error ) == 0 )
35  {
36    $session_id = session_create( $_POST['login'] );
37    $url = 'category.php?id='.$session_id;
38    header( 'Request-URI: '.$url );
39    header( 'Content-Location: '.$url ); 
40    header( 'Location: '.$url );
41    exit();
42  }
43}
44//----------------------------------------------------- template initialization
45$vtp = new VTemplate;
46$handle = $vtp->Open( './template/'.$user['template'].'/register.vtp' );
47// language
48$vtp->setGlobalVar( $handle, 'register_page_title',
49                    $lang['register_page_title'] );
50$vtp->setGlobalVar( $handle, 'register_title',   $lang['register_title'] );
51$vtp->setGlobalVar( $handle, 'ident_guest_visit',$lang['ident_guest_visit'] );
52$vtp->setGlobalVar( $handle, 'submit',           $lang['submit'] );
53initialize_template();
54//----------------------------------------------------------------- form action
55$vtp->setGlobalVar( $handle, 'form_action', './register.php' );
56//-------------------------------------------------------------- errors display
57if ( sizeof( $error ) != 0 )
58{
59  $vtp->addSession( $handle, 'errors' );
60  for ( $i = 0; $i < sizeof( $error ); $i++ )
61  {
62    $vtp->addSession( $handle, 'li' );
63    $vtp->setVar( $handle, 'li.li', $error[$i] );
64    $vtp->closeSession( $handle, 'li' );
65  }
66  $vtp->closeSession( $handle, 'errors' );
67}
68//----------------------------------------------------------------------- login
69$vtp->addSession( $handle, 'line' );
70$vtp->setVar( $handle, 'line.name', $lang['login'] );
71$vtp->addSession( $handle, 'text' );
72$vtp->setVar( $handle, 'text.name', 'login' );
73$vtp->setVar( $handle, 'text.value', $_POST['login'] );
74$vtp->closeSession( $handle, 'text' );
75$vtp->closeSession( $handle, 'line' );
76//-------------------------------------------------------------------- password
77$vtp->addSession( $handle, 'line' );
78$vtp->setVar( $handle, 'line.name', $lang['password'] );
79$vtp->addSession( $handle, 'password' );
80$vtp->setVar( $handle, 'password.name', 'password' );
81$vtp->setVar( $handle, 'password.value', '' );
82$vtp->closeSession( $handle, 'password' );
83$vtp->closeSession( $handle, 'line' );
84//------------------------------------------------------- password confirmation
85$vtp->addSession( $handle, 'line' );
86$vtp->setVar( $handle, 'line.name', $lang['reg_confirm'] );
87$vtp->addSession( $handle, 'password' );
88$vtp->setVar( $handle, 'password.name', 'password_conf' );
89$vtp->setVar( $handle, 'password.value', '' );
90$vtp->closeSession( $handle, 'password' );
91$vtp->closeSession( $handle, 'line' );
92//---------------------------------------------------------------- mail address
93$vtp->addSession( $handle, 'line' );
94$vtp->setVar( $handle, 'line.name', $lang['mail_address'] );
95$vtp->addSession( $handle, 'text' );
96$vtp->setVar( $handle, 'text.name', 'mail_address' );
97$vtp->setVar( $handle, 'text.value', $_POST['mail_address'] );
98$vtp->closeSession( $handle, 'text' );
99$vtp->closeSession( $handle, 'line' );
100//----------------------------------------------------------- html code display
101$code = $vtp->Display( $handle, 0 );
102echo $code;
103?>
Note: See TracBrowser for help on using the repository browser.