From 347d2e34b3972ec1d0022b831dd5a1fe13adbaa5 Mon Sep 17 00:00:00 2001 From: rvelices Date: Thu, 23 Feb 2006 05:12:32 +0000 Subject: fix: permissioning not working (2 bugs) fix: locked gallery cannot be unlocked (impossible to login) improvement: nicer display in redirect.tpl improvement: when a page is not accessible because of permissions (accessed through bookmark or email), redirect to identification.php and after identification to the initially requested page git-svn-id: http://piwigo.org/svn/trunk@1052 68402e56-0260-453c-a942-63ccdbb3a9ee --- identification.php | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'identification.php') diff --git a/identification.php b/identification.php index 3ff9d468d..5cf65b5a2 100644 --- a/identification.php +++ b/identification.php @@ -31,8 +31,20 @@ include_once( PHPWG_ROOT_PATH.'include/common.inc.php' ); //-------------------------------------------------------------- identification $errors = array(); + +$redirect_to = ''; +if ( !empty($_GET['redirect']) ) +{ + $redirect_to = $_GET['redirect']; + if ( $user['is_the_guest'] ) + { + array_push($errors, $lang['access_forbiden']); + } +} + if (isset($_POST['login'])) { + $redirect_to = $_POST['redirect']; $username = mysql_escape_string($_POST['username']); // retrieving the encrypted password of the login submitted $query = ' @@ -54,7 +66,7 @@ SELECT '.$conf['user_fields']['id'].' AS id, session_set_cookie_params($session_length); session_start(); $_SESSION['id'] = $row['id']; - redirect('category.php'); + redirect(empty($redirect_to) ? 'category.php' : $redirect_to); } else { @@ -85,6 +97,7 @@ $template->assign_vars( 'U_REGISTER' => PHPWG_ROOT_PATH.'register.php', 'U_LOST_PASSWORD' => PHPWG_ROOT_PATH.'password.php', 'U_HOME' => PHPWG_ROOT_PATH.'category.php', + 'U_REDIRECT' => $redirect_to, 'F_LOGIN_ACTION' => PHPWG_ROOT_PATH.'identification.php' )); -- cgit v1.2.3