source: branches/1.3/identification.php @ 3631

Last change on this file since 3631 was 414, checked in by z0rglub, 20 years ago

bug 24 : Identification page uses a hard-coded path towards default
template. Corrected.

  • 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 414 2004-04-30 17:58:44Z 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//
47// Start output of page
48//
49$title = $lang['ident_page_title'];
50include('include/page_header.php');
51
52$handle = $vtp->Open( './template/'.$user['template'].'/identification.vtp' );
53// language
54$vtp->setGlobalVar( $handle, 'ident_title',      $lang['ident_title'] );
55$vtp->setGlobalVar( $handle, 'login',            $lang['login'] );
56$vtp->setGlobalVar( $handle, 'password',         $lang['password'] );
57$vtp->setGlobalVar( $handle, 'submit',           $lang['submit'] );
58$vtp->setGlobalVar( $handle, 'ident_guest_visit',$lang['ident_guest_visit'] );
59$vtp->setGlobalVar( $handle, 'ident_register',   $lang['ident_register'] );
60$vtp->setGlobalVar( $handle, 'ident_forgotten_password',
61                    $lang['ident_forgotten_password'] );
62// conf
63$vtp->setGlobalVar( $handle, 'mail_webmaster',   $conf['mail_webmaster'] );
64// user
65$vtp->setGlobalVar( $handle, 'user_template',    $user['template'] );
66initialize_template();
67//-------------------------------------------------------------- errors display
68if ( sizeof( $errors ) != 0 )
69{
70  $vtp->addSession( $handle, 'errors' );
71  foreach ( $errors as $error ) {
72    $vtp->addSession( $handle, 'li' );
73    $vtp->setVar( $handle, 'li.li', $error );
74    $vtp->closeSession( $handle, 'li' );
75  }
76  $vtp->closeSession( $handle, 'errors' );
77}
78//------------------------------------------------------------------ users list
79// retrieving all the users login
80$query = 'select username from '.PREFIX_TABLE.'users;';
81$result = mysql_query( $query );
82if ( mysql_num_rows ( $result ) < $conf['max_user_listbox'] )
83{
84  $vtp->addSession( $handle, 'select_field' );
85  while ( $row = mysql_fetch_array( $result ) )
86  {
87    if ( $row['username'] != 'guest' )
88    {
89      $vtp->addSession( $handle, 'option' );
90      $vtp->setVar( $handle, 'option.option', $row['username'] );
91      $vtp->closeSession( $handle, 'option' );
92    }
93  }
94  $vtp->closeSession( $handle, 'select_field' );
95}
96else
97{
98  $vtp->addSession( $handle, 'text_field' );
99  $vtp->closeSession( $handle, 'text_field' );
100}
101//-------------------------------------------------------------- visit as guest
102if ( $conf['access'] == 'free' )
103{
104  $vtp->addSession( $handle, 'guest_visit' );
105  $vtp->closeSession( $handle, 'guest_visit' );
106}
107//---------------------------------------------------------------- registration
108if ( $conf['access'] == 'free' )
109{
110  $vtp->addSession( $handle, 'register' );
111  $vtp->closeSession( $handle, 'register' );
112}
113//----------------------------------------------------------- html code display
114$output.= $vtp->Display( $handle, 0 );
115include('include/page_tail.php');
116?>
Note: See TracBrowser for help on using the repository browser.