source: trunk/identification.php @ 1851

Last change on this file since 1851 was 1851, checked in by rub, 17 years ago

o Proposition: improved display of 'x images in y sub-categories' or 'x images in this category' for cases when categories contain both images and sub-categories
o Good idea of this new way for way confguest_access, but I kept last implementation for access methods (Could be useful on future development)

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 4.1 KB
Line 
1<?php
2// +-----------------------------------------------------------------------+
3// | PhpWebGallery - a PHP based picture gallery                           |
4// | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net |
5// | Copyright (C) 2003-2005 PhpWebGallery Team - http://phpwebgallery.net |
6// +-----------------------------------------------------------------------+
7// | branch        : BSF (Best So Far)
8// | file          : $RCSfile$
9// | last update   : $Date: 2007-02-22 20:20:30 +0000 (Thu, 22 Feb 2007) $
10// | last modifier : $Author: rub $
11// | revision      : $Revision: 1851 $
12// +-----------------------------------------------------------------------+
13// | This program is free software; you can redistribute it and/or modify  |
14// | it under the terms of the GNU General Public License as published by  |
15// | the Free Software Foundation                                          |
16// |                                                                       |
17// | This program is distributed in the hope that it will be useful, but   |
18// | WITHOUT ANY WARRANTY; without even the implied warranty of            |
19// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU      |
20// | General Public License for more details.                              |
21// |                                                                       |
22// | You should have received a copy of the GNU General Public License     |
23// | along with this program; if not, write to the Free Software           |
24// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
25// | USA.                                                                  |
26// +-----------------------------------------------------------------------+
27
28//--------------------------------------------------------------------- include
29define('PHPWG_ROOT_PATH','./');
30include_once( PHPWG_ROOT_PATH.'include/common.inc.php' );
31
32// +-----------------------------------------------------------------------+
33// | Check Access and exit when user status is not ok                      |
34// +-----------------------------------------------------------------------+
35check_status(ACCESS_NONE);
36
37//-------------------------------------------------------------- identification
38$errors = array();
39
40$redirect_to = '';
41if ( !empty($_GET['redirect']) )
42{
43  $redirect_to = urldecode($_GET['redirect']);
44  if ( $user['is_the_guest'] )
45  {
46    array_push($errors, $lang['access_forbiden']);
47  }
48}
49
50if (isset($_POST['login']))
51{
52  $redirect_to = isset($_POST['redirect']) ? $_POST['redirect'] : '';
53  $remember_me = isset($_POST['remember_me']) and $_POST['remember_me']==1;
54  if ( try_log_user($_POST['username'], $_POST['password'], $remember_me) )
55  {
56    redirect(empty($redirect_to) ? make_index_url() : $redirect_to);
57  }
58  else
59  {
60    array_push( $errors, $lang['invalid_pwd'] );
61  }
62}
63
64//----------------------------------------------------- template initialization
65//
66// Start output of page
67//
68$title = $lang['identification'];
69$page['body_id'] = 'theIdentificationPage';
70include(PHPWG_ROOT_PATH.'include/page_header.php');
71
72$template->set_filenames( array('identification'=>'identification.tpl') );
73
74$template->assign_vars(
75  array(
76    'U_REGISTER' => PHPWG_ROOT_PATH.'register.php',
77    'U_LOST_PASSWORD' => PHPWG_ROOT_PATH.'password.php',
78    'U_HOME' => make_index_url(),
79    'U_REDIRECT' => $redirect_to,
80
81    'F_LOGIN_ACTION' => PHPWG_ROOT_PATH.'identification.php'
82    ));
83
84if ($conf['authorize_remembering'])
85{
86  $template->assign_block_vars('remember_me',array());
87}
88if ($conf['allow_user_registration'])
89{
90  $template->assign_block_vars('register',array());
91}
92
93//-------------------------------------------------------------- errors display
94if ( sizeof( $errors ) != 0 )
95{
96  $template->assign_block_vars('errors',array());
97  for ( $i = 0; $i < sizeof( $errors ); $i++ )
98  {
99    $template->assign_block_vars('errors.error',array('ERROR'=>$errors[$i]));
100  }
101}
102//-------------------------------------------------------------- visit as guest
103$template->assign_block_vars('free_access',array());
104//----------------------------------------------------------- html code display
105$template->parse('identification');
106include(PHPWG_ROOT_PATH.'include/page_tail.php');
107?>
Note: See TracBrowser for help on using the repository browser.