[2] | 1 | <?php |
---|
| 2 | /*************************************************************************** |
---|
[57] | 3 | * register.php * |
---|
[2] | 4 | * ------------------- * |
---|
[57] | 5 | * application : PhpWebGallery 1.3 <http://phpwebgallery.net> * |
---|
| 6 | * author : Pierrick LE GALL <pierrick@z0rglub.com> * |
---|
[2] | 7 | * * |
---|
[57] | 8 | * $Id: register.php 350 2004-02-05 23:18:05Z z0rglub $ |
---|
| 9 | * * |
---|
[2] | 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 |
---|
[21] | 21 | include_once( './include/init.inc.php' ); |
---|
[2] | 22 | //-------------------------------------------------- access authorization check |
---|
[21] | 23 | if ( $conf['access'] == "restricted" ) |
---|
[2] | 24 | { |
---|
| 25 | echo $lang['only_members']; |
---|
| 26 | exit(); |
---|
| 27 | } |
---|
| 28 | //----------------------------------------------------------- user registration |
---|
| 29 | $error = array(); |
---|
| 30 | if ( 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 |
---|
[290] | 45 | // |
---|
| 46 | // Start output of page |
---|
| 47 | // |
---|
| 48 | $title= $lang['register_page_title']; |
---|
| 49 | include('include/page_header.php'); |
---|
| 50 | |
---|
[2] | 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'] ); |
---|
[105] | 56 | initialize_template(); |
---|
[2] | 57 | //----------------------------------------------------------------- form action |
---|
| 58 | $vtp->setGlobalVar( $handle, 'form_action', './register.php' ); |
---|
| 59 | //-------------------------------------------------------------- errors display |
---|
| 60 | if ( 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' ); |
---|
[280] | 76 | if (isset( $_POST['login'])) |
---|
| 77 | $vtp->setVar( $handle, 'text.value', $_POST['login'] ); |
---|
[2] | 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' ); |
---|
[105] | 98 | $vtp->setVar( $handle, 'line.name', $lang['mail_address'] ); |
---|
[2] | 99 | $vtp->addSession( $handle, 'text' ); |
---|
| 100 | $vtp->setVar( $handle, 'text.name', 'mail_address' ); |
---|
[280] | 101 | if (isset( $_POST['mail_address'])) |
---|
| 102 | $vtp->setVar( $handle, 'text.value', $_POST['mail_address'] ); |
---|
[2] | 103 | $vtp->closeSession( $handle, 'text' ); |
---|
| 104 | $vtp->closeSession( $handle, 'line' ); |
---|
| 105 | //----------------------------------------------------------- html code display |
---|
[350] | 106 | $output.= $vtp->Display( $handle, 0 ); |
---|
[290] | 107 | include('include/page_tail.php'); |
---|
[350] | 108 | ?> |
---|