X-Git-Url: https://git.mxchange.org/?p=mailer.git;a=blobdiff_plain;f=inc%2Flibs%2Fuser_functions.php;h=18fd084d45f53da630e732fa215638e04f581c8f;hp=e967ca4cf21580c678c1255b0ce80d6e33875a53;hb=d476e02cca701687022b734b396ca49267c5e103;hpb=0da4efca52cd97ed8b385d81ae03125698f55e93 diff --git a/inc/libs/user_functions.php b/inc/libs/user_functions.php index e967ca4cf2..18fd084d45 100644 --- a/inc/libs/user_functions.php +++ b/inc/libs/user_functions.php @@ -264,6 +264,7 @@ function doUserLogin ($userid, $passwd, $successUrl = '', $errorUrl = 'modules.p $dmy = ''; $add = ''; $errorCode = '0'; + $ext = ''; // Add last_login if available $lastOnline = ''; @@ -287,17 +288,18 @@ function doUserLogin ($userid, $passwd, $successUrl = '', $errorUrl = 'modules.p } elseif (isNicknameUsed($userid)) { // No nickname installed $errorCode = getCode('EXTENSION_PROBLEM'); + $ext = 'nickname'; } else { // Direct userid entered fetchUserData($userid); } + // Load entry + $content = getUserDataArray(); + if (!empty($content['userid'])) $userid = bigintval($content['userid']); + // Is there an entry? if (((isUserDataValid()) && (getUserData('status') == 'CONFIRMED') && (!empty($content['userid']))) || ($content['userid'] == $userid)) { - // Load entry - $content = getUserDataArray(); - if (!empty($content['userid'])) $userid = bigintval($content['userid']); - // Check for old MD5 passwords if ((strlen($content['password']) == 32) && (md5($passwd) == $content['password'])) { // Just set the hash to the password from DB... :) @@ -323,7 +325,7 @@ function doUserLogin ($userid, $passwd, $successUrl = '', $errorUrl = 'modules.p // Probe for last online timemark $probe = time() - $content['last_online']; if (!empty($content['last_login'])) $probe = time() - $content['last_login']; - if ((getExtensionVersion('bonus') >= '0.2.2') && ($probe >= getConfig('login_timeout'))) { + if ((isExtensionInstalledAndNewer('bonus', '0.2.2')) && ($probe >= getConfig('login_timeout'))) { // Add login bonus to user's account $add = ', `login_bonus`=`login_bonus`+{?login_bonus?}'; $GLOBALS['bonus_payed'] = true; @@ -384,7 +386,7 @@ function doUserLogin ($userid, $passwd, $successUrl = '', $errorUrl = 'modules.p // id not found! $errorCode = getCode('WRONG_ID'); } - } else { + } elseif ($errorCode == '0') { // id not found! $errorCode = getCode('WRONG_ID'); } @@ -393,6 +395,9 @@ function doUserLogin ($userid, $passwd, $successUrl = '', $errorUrl = 'modules.p if ($errorCode > 0) { // Then reconstruct the URL $URL = $errorUrl . $errorCode; + + // Extension set? Then add it as well. + if (!empty($ext)) $URL .= '&ext=' . $ext; } // END - if // Return URL