source: trunk/identification.php @ 2041

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

Resolved issue 0000697: with generic user a author name is necessary to comment picture.

+ Change way to determinate if user is a guest (use functions like is_admin)

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