X-Git-Url: https://git.mxchange.org/?p=mailer.git;a=blobdiff_plain;f=inc%2Fmodules%2Fguest%2Fwhat-login.php;h=7d2e4378957614d9d2534441e28777ce64f0eb0d;hp=60228452a64087e401424d8b2d586f4a6ad6044f;hb=e9da1508b2a3ccbf63adc999981674740a47e074;hpb=3161d70d2c3a86649dd16a7909ec16f801f16e4e diff --git a/inc/modules/guest/what-login.php b/inc/modules/guest/what-login.php index 60228452a6..7d2e437895 100644 --- a/inc/modules/guest/what-login.php +++ b/inc/modules/guest/what-login.php @@ -11,13 +11,8 @@ * Kurzbeschreibung : Loginbereich (leitet an das richtige Lgin-Modul * * weiter) * * -------------------------------------------------------------------- * - * $Revision:: $ * - * $Date:: $ * - * $Tag:: 0.2.1-FINAL $ * - * $Author:: $ * - * -------------------------------------------------------------------- * * Copyright (c) 2003 - 2009 by Roland Haeder * - * Copyright (c) 2009 - 2011 by Mailer Developer Team * + * Copyright (c) 2009 - 2015 by Mailer Developer Team * * For more information visit: http://mxchange.org * * * * This program is free software; you can redistribute it and/or modify * @@ -38,7 +33,7 @@ // Some security stuff... if (!defined('__SECURITY')) { - die(); + exit(); } // END - if // Add description as navigation point @@ -49,9 +44,9 @@ if ((!isExtensionActive('user')) && (!isAdmin())) { return; } // END - if -// Initialize variables +// Initialize variables as not logged in $errorCode = '0'; -$userid = false; +$userid = NULL; $hash = ''; $url = ''; $add = ''; @@ -60,11 +55,11 @@ $add = ''; if ((isMemberIdSet()) && (isSessionVariableSet('u_hash'))) { // Maybe, then continue with it $userid = getMemberId(); -} elseif ((isPostRequestElementSet('id')) && (isPostRequestElementSet('password')) && (isFormSent())) { +} elseif ((isPostRequestElementSet('id')) && (isPostRequestElementSet('password')) && (isFormSent('login'))) { // Set userid and crypt password when login data was submitted if (isNicknameUsed(postRequestElement('id'))) { // Nickname entered - $userid = SQL_ESCAPE(postRequestElement('id')); + $userid = sqlEscapeString(postRequestElement('id')); } else { // Direct userid entered $userid = bigintval(postRequestElement('id')); @@ -74,32 +69,37 @@ if ((isMemberIdSet()) && (isSessionVariableSet('u_hash'))) { $userid = NULL; if (isPostRequestElementSet('email')) { // Email is set - $userid = SQL_ESCAPE(postRequestElement('email')); + $userid = sqlEscapeString(postRequestElement('email')); } elseif (isPostRequestElementSet('id')) { - // Do we have nickname or userid? + // Is there nickname or userid? if (isNicknameUsed(postRequestElement('id'))) { // Nickname entered - $userid = SQL_ESCAPE(postRequestElement('id')); + $userid = sqlEscapeString(postRequestElement('id')); } else { // Direct userid entered $userid = bigintval(postRequestElement('id')); } } // END - if -} else { - // Not logged in - $userid = NULL; - $hash = ''; } if (isMember()) { // Login immidiately... $url = 'modules.php?module=login'; -} elseif ((isFormSent()) && ('' . $userid . '' != '' . postRequestElement('id') . '')) { +} elseif ((isFormSent('login')) && ('' . $userid . '' != '' . postRequestElement('id') . '')) { // Invalid input (no nickname extension installed but nickname entered) $errorCode = getCode('EXTENSION_PROBLEM'); -} elseif (isFormSent()) { - // Try the login (see inc/libs/user_functions.php) - $url = doUserLogin(postRequestElement('id'), postRequestElement('password')); +} elseif (isFormSent('login')) { + // Are both 'id' and 'password' set? + if ((isPostRequestElementSet('id')) && (isPostRequestElementSet('password'))) { + // Try the login (see inc/libs/user_functions.php) + $url = doUserLogin(postRequestElement('id'), postRequestElement('password')); + } elseif (!isPostRequestElementSet('id')) { + // Empty 'id' + $errorCode = getCode('LOGIN_EMPTY_ID'); + } else { + // Empty 'password' + $errorCode = getCode('LOGIN_EMPTY_PASSWORD'); + } } elseif ((isPostRequestElementSet('new_pass')) && (!empty($userid))) { // Try the userid/email lookup (see inc/libs/user_functions.php) $errorCode = doNewUserPassword(postRequestElement('email'), $userid); @@ -116,25 +116,21 @@ $content['message'] = ''; // Login problems? if (!empty($errorCode)) { - // Do we have a userid set? - if (isSessionVariableSet('current_userid')) { + // Is there a userid set? + if (isSessionVariableSet('userid')) { // Then prefetch data for this account - fetchUserData(getSession('current_userid')); + fetchUserData(getSession('userid')); } // END - if - // @TODO Move this HTML code into a template - $content['message'] = ' - - ' . getMessageFromErrorCode($errorCode) . ' - -'; + // Add message code + $content['message'] = loadTemplate('guest_login_error_message', TRUE, $errorCode); } // END - if // Display login form with resend-password form if (isExtensionActive('nickname')) { - loadTemplate('guest_nickname_login', false, $content); + loadTemplate('guest_nickname_login', FALSE, $content); } else { - loadTemplate('guest_login', false, $content); + loadTemplate('guest_login', FALSE, $content); } // Was an URL constructed?