source: trunk/identification.php @ 345

Last change on this file since 345 was 345, checked in by gweltas, 20 years ago

Merge of the 1.3.1 release
Creation of an unique include file (common.php)
Creation of an unique define file (include/constants.php)
Modification of the installation procedure

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 4.6 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 345 2004-02-02 00:55:18Z gweltas $
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//----------------------------------------------------------- include
21$phpwg_root_path = './';
22include_once( $phpwg_root_path.'common.php' );
23
24//-------------------------------------------------------------- identification
25$errors = array();
26if ( isset( $_POST['login'] ) )
27{
28  // retrieving the encrypted password of the login submitted
29  $query = 'SELECT password';
30  $query.= ' FROM '.USERS_TABLE;
31  $query.= " WHERE username = '".$_POST['login']."';";
32  $row = mysql_fetch_array( mysql_query( $query ) );
33  if( $row['password'] == md5( $_POST['pass'] ) )
34  {
35    $session_id = session_create( $_POST['login'] );
36    $url = 'category.php?id='.$session_id;
37    header( 'Request-URI: '.$url );
38    header( 'Content-Location: '.$url ); 
39    header( 'Location: '.$url );
40    exit();
41  }
42  else
43  {
44    array_push( $errors, $lang['invalid_pwd'] );
45  }
46}
47//----------------------------------------------------- template initialization
48//
49// Start output of page
50//
51$title = $lang['ident_page_title'];
52include('include/page_header.php');
53
54$handle = $vtp->Open( './template/default/identification.vtp' );
55// language
56$vtp->setGlobalVar( $handle, 'ident_title',      $lang['ident_title'] );
57$vtp->setGlobalVar( $handle, 'login',            $lang['login'] );
58$vtp->setGlobalVar( $handle, 'password',         $lang['password'] );
59$vtp->setGlobalVar( $handle, 'submit',           $lang['submit'] );
60$vtp->setGlobalVar( $handle, 'ident_guest_visit',$lang['ident_guest_visit'] );
61$vtp->setGlobalVar( $handle, 'ident_register',   $lang['ident_register'] );
62$vtp->setGlobalVar( $handle, 'ident_forgotten_password',
63                    $lang['ident_forgotten_password'] );
64// conf
65$vtp->setGlobalVar( $handle, 'mail_webmaster',   $conf['mail_webmaster'] );
66// user
67$vtp->setGlobalVar( $handle, 'user_template',    $user['template'] );
68initialize_template();
69//-------------------------------------------------------------- errors display
70if ( sizeof( $errors ) != 0 )
71{
72  $vtp->addSession( $handle, 'errors' );
73  foreach ( $errors as $error ) {
74    $vtp->addSession( $handle, 'li' );
75    $vtp->setVar( $handle, 'li.li', $error );
76    $vtp->closeSession( $handle, 'li' );
77  }
78  $vtp->closeSession( $handle, 'errors' );
79}
80//------------------------------------------------------------------ users list
81// retrieving all the users login
82$query = 'select username from '.USERS_TABLE.';';
83$result = mysql_query( $query );
84if ( mysql_num_rows ( $result ) < $conf['max_user_listbox'] )
85{
86  $vtp->addSession( $handle, 'select_field' );
87  while ( $row = mysql_fetch_array( $result ) )
88  {
89    if ( $row['username'] != 'guest' )
90    {
91      $vtp->addSession( $handle, 'option' );
92      $vtp->setVar( $handle, 'option.option', $row['username'] );
93      $vtp->closeSession( $handle, 'option' );
94    }
95  }
96  $vtp->closeSession( $handle, 'select_field' );
97}
98else
99{
100  $vtp->addSession( $handle, 'text_field' );
101  $vtp->closeSession( $handle, 'text_field' );
102}
103//-------------------------------------------------------------- visit as guest
104if ( $conf['access'] == 'free' )
105{
106  $vtp->addSession( $handle, 'guest_visit' );
107  $vtp->closeSession( $handle, 'guest_visit' );
108}
109//---------------------------------------------------------------- registration
110if ( $conf['access'] == 'free' )
111{
112  $vtp->addSession( $handle, 'register' );
113  $vtp->closeSession( $handle, 'register' );
114}
115//----------------------------------------------------------- html code display
116$code = $vtp->Display( $handle, 0 );
117echo $code;
118include('include/page_tail.php');
119?>
Note: See TracBrowser for help on using the repository browser.