source: trunk/identification.php @ 104

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

Remove log informations registration

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 4.5 KB
Line 
1<?php
2/***************************************************************************
3 *                            identification.php                           *
4 *                            ------------------                           *
5 *   application   : PhpWebGallery 1.3 <http://phpwebgallery.net>          *
6 *   author        : Pierrick LE GALL <pierrick@z0rglub.com>               *
7 *                                                                         *
8 *   $Id: identification.php 104 2003-09-14 16:12:27Z 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//-------------------------------------------------------------- identification
23$errors = array();
24if ( isset( $_POST['login'] ) )
25{
26  // retrieving the encrypted password of the login submitted
27  $query = 'SELECT password';
28  $query.= ' FROM '.PREFIX_TABLE.'users';
29  $query.= " WHERE username = '".$_POST['login']."';";
30  $row = mysql_fetch_array( mysql_query( $query ) );
31  if( $row['password'] == md5( $_POST['pass'] ) )
32  {
33    $session_id = session_create( $_POST['login'] );
34    $url = 'category.php?id='.$session_id;
35    header( 'Request-URI: '.$url );
36    header( 'Content-Location: '.$url ); 
37    header( 'Location: '.$url );
38    exit();
39  }
40  else
41  {
42    array_push( $errors, $lang['invalid_pwd'] );
43  }
44}
45//----------------------------------------------------- template initialization
46$vtp = new VTemplate;
47$handle = $vtp->Open( './template/default/identification.vtp' );
48// language
49$vtp->setGlobalVar( $handle, 'ident_page_title', $lang['ident_page_title'] );
50$vtp->setGlobalVar( $handle, 'ident_title',      $lang['ident_title'] );
51$vtp->setGlobalVar( $handle, 'login',            $lang['login'] );
52$vtp->setGlobalVar( $handle, 'password',         $lang['password'] );
53$vtp->setGlobalVar( $handle, 'submit',           $lang['submit'] );
54$vtp->setGlobalVar( $handle, 'ident_guest_visit',$lang['ident_guest_visit'] );
55$vtp->setGlobalVar( $handle, 'ident_register',   $lang['ident_register'] );
56$vtp->setGlobalVar( $handle, 'ident_forgotten_password',
57                    $lang['ident_forgotten_password'] );
58// conf
59$vtp->setGlobalVar( $handle, 'mail_webmaster',   $conf['mail_webmaster'] );
60// user
61$vtp->setGlobalVar( $handle, 'user_template',    $user['template'] );
62initialize_template();
63//-------------------------------------------------------------- errors display
64if ( sizeof( $errors ) != 0 )
65{
66  $vtp->addSession( $handle, 'errors' );
67  foreach ( $errors as $error ) {
68    $vtp->addSession( $handle, 'li' );
69    $vtp->setVar( $handle, 'li.li', $error );
70    $vtp->closeSession( $handle, 'li' );
71  }
72  $vtp->closeSession( $handle, 'errors' );
73}
74//------------------------------------------------------------------ users list
75// retrieving all the users login
76$query = 'select username from '.PREFIX_TABLE.'users;';
77$result = mysql_query( $query );
78if ( mysql_num_rows ( $result ) < $conf['max_user_listbox'] )
79{
80  $vtp->addSession( $handle, 'select_field' );
81  while ( $row = mysql_fetch_array( $result ) )
82  {
83    if ( $row['username'] != 'guest' )
84    {
85      $vtp->addSession( $handle, 'option' );
86      $vtp->setVar( $handle, 'option.option', $row['username'] );
87      $vtp->closeSession( $handle, 'option' );
88    }
89  }
90  $vtp->closeSession( $handle, 'select_field' );
91}
92else
93{
94  $vtp->addSession( $handle, 'text_field' );
95  $vtp->closeSession( $handle, 'text_field' );
96}
97//-------------------------------------------------------------- visit as guest
98if ( $conf['access'] == 'free' )
99{
100  $vtp->addSession( $handle, 'guest_visit' );
101  $vtp->closeSession( $handle, 'guest_visit' );
102}
103//---------------------------------------------------------------- registration
104if ( $conf['access'] == 'free' )
105{
106  $vtp->addSession( $handle, 'register' );
107  $vtp->closeSession( $handle, 'register' );
108}
109//----------------------------------------------------------- html code display
110$code = $vtp->Display( $handle, 0 );
111echo $code;
112?>
Note: See TracBrowser for help on using the repository browser.