source: trunk/register.php @ 21

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

* empty log message *

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 4.9 KB
Line 
1<?php
2/***************************************************************************
3 *                 register.php is a part of PhpWebGallery                 *
4 *                            -------------------                          *
5 *   last update          : Saturday, December 28, 2002                    *
6 *   email                : pierrick@z0rglub.com                           *
7 *                                                                         *
8 ***************************************************************************/
9
10/***************************************************************************
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 ***************************************************************************/
17
18//----------------------------------------------------------- personnal include
19include_once( './include/init.inc.php' );
20//-------------------------------------------------- access authorization check
21if ( $conf['access'] == "restricted" )
22{
23  echo $lang['only_members'];
24  exit();
25}
26//----------------------------------------------------------- user registration
27$error = array();
28if ( isset( $_POST['submit'] ) )
29{
30  $error = register_user( $_POST['login'], $_POST['password'],
31                          $_POST['password_conf'], $_POST['mail_address'] );
32  if ( sizeof( $error ) == 0 )
33  {
34    $session_id = session_create( $_POST['login'] );
35    $url = 'category.php?id='.$session_id;
36    header( 'Request-URI: '.$url );
37    header( 'Content-Location: '.$url ); 
38    header( 'Location: '.$url );
39    exit();
40  }
41}
42//----------------------------------------------------- template initialization
43$vtp = new VTemplate;
44$handle = $vtp->Open( './template/'.$user['template'].'/register.vtp' );
45// language
46$vtp->setGlobalVar( $handle, 'register_page_title',
47                    $lang['register_page_title'] );
48$vtp->setGlobalVar( $handle, 'register_title',   $lang['register_title'] );
49$vtp->setGlobalVar( $handle, 'ident_guest_visit',$lang['ident_guest_visit'] );
50$vtp->setGlobalVar( $handle, 'submit',           $lang['submit'] );
51// user
52$vtp->setGlobalVar( $handle, 'page_style',       $user['style'] );
53// structure
54$vtp->setGlobalVar( $handle, 'frame_start',      get_frame_start() );
55$vtp->setGlobalVar( $handle, 'frame_begin',      get_frame_begin() );
56$vtp->setGlobalVar( $handle, 'frame_end',        get_frame_end() );
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' );
76$vtp->setVar( $handle, 'text.value', $_POST['login'] );
77$vtp->closeSession( $handle, 'text' );
78$vtp->closeSession( $handle, 'line' );
79//-------------------------------------------------------------------- password
80$vtp->addSession( $handle, 'line' );
81$vtp->setVar( $handle, 'line.name', $lang['password'] );
82$vtp->addSession( $handle, 'password' );
83$vtp->setVar( $handle, 'password.name', 'password' );
84$vtp->setVar( $handle, 'password.value', '' );
85$vtp->closeSession( $handle, 'password' );
86$vtp->closeSession( $handle, 'line' );
87//------------------------------------------------------- password confirmation
88$vtp->addSession( $handle, 'line' );
89$vtp->setVar( $handle, 'line.name', $lang['reg_confirm'] );
90$vtp->addSession( $handle, 'password' );
91$vtp->setVar( $handle, 'password.name', 'password_conf' );
92$vtp->setVar( $handle, 'password.value', '' );
93$vtp->closeSession( $handle, 'password' );
94$vtp->closeSession( $handle, 'line' );
95//---------------------------------------------------------------- mail address
96$vtp->addSession( $handle, 'line' );
97$vtp->setVar( $handle, 'line.name', $lang['reg_mail_address'] );
98$vtp->addSession( $handle, 'text' );
99$vtp->setVar( $handle, 'text.name', 'mail_address' );
100$vtp->setVar( $handle, 'text.value', $_POST['mail_address'] );
101$vtp->closeSession( $handle, 'text' );
102$vtp->closeSession( $handle, 'line' );
103//----------------------------------------------------------- html code display
104$code = $vtp->Display( $handle, 0 );
105echo $code;
106?>
Note: See TracBrowser for help on using the repository browser.