News:

Want to get involved in developing SMF, then why not lend a hand on our github!

Main Menu

Help Detect Error

Started by Biology Forums, April 29, 2021, 07:16:54 PM

Previous topic - Next topic

Biology Forums

Hi everyone,

I created a custom login code for my website (SMF 1.x) that let's users register/login using their social network.

Out of ten or so successful logins, roughly 1/10 results in an error that looks like this (see attachment).

The function that I created to login them in looks like this:

function hybridauth_login($id_member) {

global $db_prefix, $sourcedir, $sc;

require_once($sourcedir . '/LogInOut.php');

$request = db_query("
SELECT passwd, ID_MEMBER, ID_GROUP, lngfile, is_activated, emailAddress, additionalGroups, memberName, passwordSalt, totalTimeLoggedIn
FROM {$db_prefix}members
WHERE ID_MEMBER = '" . intval($id_member) . "'", __FILE__, __LINE__);

$user_settings = mysql_fetch_assoc($request);
mysql_free_result($request);

if (!empty($user_settings['memberName']))
{
//This is being used by Login2()
$_REQUEST['user'] = $user_settings['memberName'];
$_REQUEST['hash_passwrd'] = sha1($user_settings['passwd'] . $sc);

if(empty($_SESSION['login_url']))
{
if($user_settings['totalTimeLoggedIn'] < 15)
$_SESSION['login_url'] = 'https://mywebsiteURL.com/index.php?action=profile';
else
$_SESSION['login_url'] = 'https://mywebsiteURL.com';
}

// Login.
Login2();
}
}


Could someone try explaining why Login2() throws this error in roughly 1/10 logins? If it is in fact a cookie issue, what can I do server side to clear the cookie that's getting in the way?

I haven't been able to replicate the error myself, though it is happening to my members. I'm just not sure how they're doing it.

Advertisement: