2003-05-09 14:42:42 +02:00
|
|
|
<?php
|
2004-02-07 20:36:44 +01:00
|
|
|
// +-----------------------------------------------------------------------+
|
2004-11-06 22:12:59 +01:00
|
|
|
// | PhpWebGallery - a PHP based picture gallery |
|
|
|
|
// | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net |
|
2005-01-08 00:10:51 +01:00
|
|
|
// | Copyright (C) 2003-2005 PhpWebGallery Team - http://phpwebgallery.net |
|
2004-02-07 20:36:44 +01:00
|
|
|
// +-----------------------------------------------------------------------+
|
2004-11-06 22:12:59 +01:00
|
|
|
// | branch : BSF (Best So Far)
|
2004-02-07 20:36:44 +01:00
|
|
|
// | file : $RCSfile$
|
|
|
|
// | last update : $Date$
|
|
|
|
// | last modifier : $Author$
|
|
|
|
// | revision : $Revision$
|
|
|
|
// +-----------------------------------------------------------------------+
|
|
|
|
// | This program is free software; you can redistribute it and/or modify |
|
|
|
|
// | it under the terms of the GNU General Public License as published by |
|
|
|
|
// | the Free Software Foundation |
|
|
|
|
// | |
|
|
|
|
// | This program is distributed in the hope that it will be useful, but |
|
|
|
|
// | WITHOUT ANY WARRANTY; without even the implied warranty of |
|
|
|
|
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
|
|
|
// | General Public License for more details. |
|
|
|
|
// | |
|
|
|
|
// | You should have received a copy of the GNU General Public License |
|
|
|
|
// | along with this program; if not, write to the Free Software |
|
|
|
|
// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
|
|
|
|
// | USA. |
|
|
|
|
// +-----------------------------------------------------------------------+
|
2003-05-09 14:42:42 +02:00
|
|
|
|
2004-03-30 00:40:21 +02:00
|
|
|
//--------------------------------------------------------------------- include
|
2004-02-19 01:31:09 +01:00
|
|
|
define('PHPWG_ROOT_PATH','./');
|
|
|
|
include_once( PHPWG_ROOT_PATH.'include/common.inc.php' );
|
2004-02-02 01:55:18 +01:00
|
|
|
|
2003-05-09 14:42:42 +02:00
|
|
|
//-------------------------------------------------------------- identification
|
2003-07-27 10:24:10 +02:00
|
|
|
$errors = array();
|
2004-10-03 01:12:50 +02:00
|
|
|
if (isset($_POST['login']))
|
2003-05-09 14:42:42 +02:00
|
|
|
{
|
|
|
|
// retrieving the encrypted password of the login submitted
|
2004-10-03 01:12:50 +02:00
|
|
|
$query = '
|
|
|
|
SELECT id, password
|
|
|
|
FROM '.USERS_TABLE.'
|
|
|
|
WHERE username = \''.$_POST['username'].'\'
|
|
|
|
;';
|
2004-10-30 17:42:29 +02:00
|
|
|
$row = mysql_fetch_array(pwg_query($query));
|
2004-10-03 01:12:50 +02:00
|
|
|
if ($row['password'] == md5($_POST['password']))
|
2003-05-09 14:42:42 +02:00
|
|
|
{
|
2004-10-07 00:48:48 +02:00
|
|
|
$session_length = $conf['session_length'];
|
|
|
|
if ($conf['authorize_remembering']
|
|
|
|
and isset($_POST['remember_me'])
|
|
|
|
and $_POST['remember_me'] == 1)
|
2004-10-03 01:12:50 +02:00
|
|
|
{
|
2004-10-07 00:48:48 +02:00
|
|
|
$session_length = $conf['remember_me_length'];
|
2004-10-03 01:12:50 +02:00
|
|
|
}
|
2004-10-07 00:48:48 +02:00
|
|
|
$session_id = session_create($row['id'], $session_length);
|
|
|
|
redirect('category.php?id='.$session_id);
|
2003-05-09 14:42:42 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2003-07-27 10:24:10 +02:00
|
|
|
array_push( $errors, $lang['invalid_pwd'] );
|
2003-05-09 14:42:42 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
//----------------------------------------------------- template initialization
|
2004-02-02 01:55:18 +01:00
|
|
|
//
|
|
|
|
// Start output of page
|
|
|
|
//
|
2005-01-06 17:33:04 +01:00
|
|
|
$title = $lang['identification'];
|
2004-02-22 03:43:13 +01:00
|
|
|
include(PHPWG_ROOT_PATH.'include/page_header.php');
|
2004-02-02 01:55:18 +01:00
|
|
|
|
2004-02-19 21:21:56 +01:00
|
|
|
$template->set_filenames( array('identification'=>'identification.tpl') );
|
|
|
|
|
2004-03-30 00:40:21 +02:00
|
|
|
$template->assign_vars(
|
|
|
|
array(
|
|
|
|
'MAIL_ADMIN' => $conf['mail_webmaster'],
|
|
|
|
|
2005-01-06 17:33:04 +01:00
|
|
|
'L_TITLE' => $lang['identification'],
|
2004-03-30 00:40:21 +02:00
|
|
|
'L_USERNAME' => $lang['login'],
|
|
|
|
'L_PASSWORD' => $lang['password'],
|
|
|
|
'L_LOGIN' => $lang['submit'],
|
|
|
|
'L_GUEST' => $lang['ident_guest_visit'],
|
|
|
|
'L_REGISTER' => $lang['ident_register'],
|
2004-10-03 01:12:50 +02:00
|
|
|
'L_FORGET' => $lang['ident_forgotten_password'],
|
|
|
|
'L_REMEMBER_ME'=>$lang['remember_me'],
|
2004-03-30 00:40:21 +02:00
|
|
|
|
|
|
|
'F_LOGIN_ACTION' => add_session_id('identification.php')
|
|
|
|
));
|
2004-10-07 00:48:48 +02:00
|
|
|
|
|
|
|
if ($conf['authorize_remembering'])
|
|
|
|
{
|
|
|
|
$template->assign_block_vars('remember_me',array());
|
|
|
|
}
|
2003-05-09 14:42:42 +02:00
|
|
|
//-------------------------------------------------------------- errors display
|
2003-09-11 22:22:35 +02:00
|
|
|
if ( sizeof( $errors ) != 0 )
|
2003-05-09 14:42:42 +02:00
|
|
|
{
|
2004-02-19 21:21:56 +01:00
|
|
|
$template->assign_block_vars('errors',array());
|
|
|
|
for ( $i = 0; $i < sizeof( $errors ); $i++ )
|
2003-05-09 14:42:42 +02:00
|
|
|
{
|
2004-02-19 21:21:56 +01:00
|
|
|
$template->assign_block_vars('errors.error',array('ERROR'=>$errors[$i]));
|
2003-05-09 14:42:42 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
//-------------------------------------------------------------- visit as guest
|
2004-12-20 23:03:04 +01:00
|
|
|
$template->assign_block_vars('free_access',array());
|
2003-05-09 14:42:42 +02:00
|
|
|
//----------------------------------------------------------- html code display
|
2005-01-13 11:18:49 +01:00
|
|
|
$template->parse('identification');
|
2004-02-22 03:43:13 +01:00
|
|
|
include(PHPWG_ROOT_PATH.'include/page_tail.php');
|
2004-02-12 00:20:38 +01:00
|
|
|
?>
|