$add = '';
$errorCode = '0';
$ext = '';
+ $isFound = false;
// Init array
$content = array(
$ext = 'nickname';
} else {
// Direct userid entered
- fetchUserData($userid);
+ $isFound = fetchUserData($userid);
}
// No error found?
- if ($errorCode == '0') {
+ if (($errorCode == '0') && ($isFound === true)) {
// Get user data array and set userid (e.g. important if we login with nickname)
$content = getUserDataArray();
if (!empty($content['userid'])) $userid = bigintval($content['userid']);
$userid = getMemberId();
} elseif ((isPostRequestParameterSet('id')) && (isPostRequestParameterSet('password')) && (isFormSent())) {
// Set userid and crypt password when login data was submitted
- if ((isExtensionActive('nickname')) && (isNicknameUsed(postRequestParameter('id')))) {
+ if (isExtensionActive('nickname')) {
// Nickname entered
$userid = SQL_ESCAPE(postRequestParameter('id'));
} else {
} elseif (isPostRequestParameterSet('new_pass')) {
// New password requested
$userid = '0';
- if ((isPostRequestParameterSet('id')) && (postRequestParameter('id') > 0)) $userid = bigintval(postRequestParameter('id'));
+ if (isPostRequestParameterSet('id')) {
+ // Do we have nickname or userid?
+ if ((isExtensionActive('nickname')) && (isNicknameUsed(postRequestParameter('id')))) {
+ // Nickname entered
+ $userid = SQL_ESCAPE(postRequestParameter('id'));
+ } else {
+ // Direct userid entered
+ $userid = bigintval(postRequestParameter('id'));
+ }
+ } // END - if
} else {
// Not logged in
$userid = '0'; $hash = '';
// Init status
$data['action'] = '';
- //* DEBUG: */ debugOutput(__LINE__.'='.$module.'/'.$what.'/'.getAction().'=');
+ //* DEBUG: */ debugOutput(__LINE__ . '=' . $module . '/'.$what . '/' . getAction() . '=');
if (!isExtensionInstalledAndNewer('sql_patches', '0.0.5')) {
// sql_patches is missing so choose depending on mode
if (isWhatSet()) {
// Get user id
$uid = getCurrentUserId();
- // User id should not be zero
- if ($uid < 1) debug_report_bug(__FUNCTION__, __LINE__, 'User id is zero.');
+ // Is the current userid valid?
+ if (!isValidUserId($uid)) {
+ // Should be always valid
+ debug_report_bug(__FUNCTION__, __LINE__, 'User id is zero.');
+ } // END - if
// Get the whole array if found
if (isset($GLOBALS['user_data'][$uid])) {