source: trunk/register.php @ 57

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

improve the header of each file

  • 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                             *
4 *                            -------------------                          *
5 *   application   : PhpWebGallery 1.3 <http://phpwebgallery.net>          *
6 *   author        : Pierrick LE GALL <pierrick@z0rglub.com>               *
7 *                                                                         *
8 *   $Id: register.php 57 2003-08-24 07:40:56Z 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'] );
53// user
54$vtp->setGlobalVar( $handle, 'page_style',       $user['style'] );
55// structure
56$vtp->setGlobalVar( $handle, 'frame_start',      get_frame_start() );
57$vtp->setGlobalVar( $handle, 'frame_begin',      get_frame_begin() );
58$vtp->setGlobalVar( $handle, 'frame_end',        get_frame_end() );
59//----------------------------------------------------------------- form action
60$vtp->setGlobalVar( $handle, 'form_action', './register.php' );
61//-------------------------------------------------------------- errors display
62if ( sizeof( $error ) != 0 )
63{
64  $vtp->addSession( $handle, 'errors' );
65  for ( $i = 0; $i < sizeof( $error ); $i++ )
66  {
67    $vtp->addSession( $handle, 'li' );
68    $vtp->setVar( $handle, 'li.li', $error[$i] );
69    $vtp->closeSession( $handle, 'li' );
70  }
71  $vtp->closeSession( $handle, 'errors' );
72}
73//----------------------------------------------------------------------- login
74$vtp->addSession( $handle, 'line' );
75$vtp->setVar( $handle, 'line.name', $lang['login'] );
76$vtp->addSession( $handle, 'text' );
77$vtp->setVar( $handle, 'text.name', '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['reg_mail_address'] );
100$vtp->addSession( $handle, 'text' );
101$vtp->setVar( $handle, 'text.name', '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$code = $vtp->Display( $handle, 0 );
107echo $code;
108?>
Note: See TracBrowser for help on using the repository browser.