source: branches/1.3/register.php @ 8528

Last change on this file since 8528 was 350, checked in by z0rglub, 20 years ago

append central HTML to $output, do not echo $code anymore

  • 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 350 2004-02-05 23:18:05Z 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//
46// Start output of page
47//
48$title= $lang['register_page_title'];
49include('include/page_header.php');
50
51$handle = $vtp->Open( './template/'.$user['template'].'/register.vtp' );
52// language
53$vtp->setGlobalVar( $handle, 'register_title',   $lang['register_title'] );
54$vtp->setGlobalVar( $handle, 'ident_guest_visit',$lang['ident_guest_visit'] );
55$vtp->setGlobalVar( $handle, 'submit',           $lang['submit'] );
56initialize_template();
57//----------------------------------------------------------------- form action
58$vtp->setGlobalVar( $handle, 'form_action', './register.php' );
59//-------------------------------------------------------------- errors display
60if ( sizeof( $error ) != 0 )
61{
62  $vtp->addSession( $handle, 'errors' );
63  for ( $i = 0; $i < sizeof( $error ); $i++ )
64  {
65    $vtp->addSession( $handle, 'li' );
66    $vtp->setVar( $handle, 'li.li', $error[$i] );
67    $vtp->closeSession( $handle, 'li' );
68  }
69  $vtp->closeSession( $handle, 'errors' );
70}
71//----------------------------------------------------------------------- login
72$vtp->addSession( $handle, 'line' );
73$vtp->setVar( $handle, 'line.name', $lang['login'] );
74$vtp->addSession( $handle, 'text' );
75$vtp->setVar( $handle, 'text.name', 'login' );
76if (isset( $_POST['login']))
77        $vtp->setVar( $handle, 'text.value', $_POST['login'] );
78$vtp->closeSession( $handle, 'text' );
79$vtp->closeSession( $handle, 'line' );
80//-------------------------------------------------------------------- password
81$vtp->addSession( $handle, 'line' );
82$vtp->setVar( $handle, 'line.name', $lang['password'] );
83$vtp->addSession( $handle, 'password' );
84$vtp->setVar( $handle, 'password.name', 'password' );
85$vtp->setVar( $handle, 'password.value', '' );
86$vtp->closeSession( $handle, 'password' );
87$vtp->closeSession( $handle, 'line' );
88//------------------------------------------------------- password confirmation
89$vtp->addSession( $handle, 'line' );
90$vtp->setVar( $handle, 'line.name', $lang['reg_confirm'] );
91$vtp->addSession( $handle, 'password' );
92$vtp->setVar( $handle, 'password.name', 'password_conf' );
93$vtp->setVar( $handle, 'password.value', '' );
94$vtp->closeSession( $handle, 'password' );
95$vtp->closeSession( $handle, 'line' );
96//---------------------------------------------------------------- mail address
97$vtp->addSession( $handle, 'line' );
98$vtp->setVar( $handle, 'line.name', $lang['mail_address'] );
99$vtp->addSession( $handle, 'text' );
100$vtp->setVar( $handle, 'text.name', 'mail_address' );
101if (isset( $_POST['mail_address']))
102        $vtp->setVar( $handle, 'text.value', $_POST['mail_address'] );
103$vtp->closeSession( $handle, 'text' );
104$vtp->closeSession( $handle, 'line' );
105//----------------------------------------------------------- html code display
106$output.= $vtp->Display( $handle, 0 );
107include('include/page_tail.php');
108?>
Note: See TracBrowser for help on using the repository browser.