MyBB Community Forums

Full Version: merge Users table in SQL
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I want to use both the forum and my site.


I know the authorization in member.php, but I don’t understand the MyBB code where the user's password is checking and it is authenticated

Solved

Not solved! If i login i see "You have successfully been logged in.
You will now be taken back to where you came from." but i dont login.

Where code that login users?
Hi there,

You can merge users in the Admin Control Panel:
Admin CP -> Users & Groups -> Users -> Merge Users

The code for handling the login & redirect is here (for MyBB 1.8.22): https://github.com/mybb/mybb/blob/mybb_1...1940-L1980

It sounds like it may be a cookie issue. Please see the following places which already cover how to resolve login issues:
https://docs.mybb.com/1.8/faq/login-problems/
https://community.mybb.com/thread-42123.html
Where i can see mybb code how to log in user?
https://github.com/mybb/mybb/blob/mybb_1...#L301-L336

Are you trying to integrate MyBB login with another part of your site?
(2020-06-22, 01:39 PM)JordanMussi Wrote: [ -> ]https://github.com/mybb/mybb/blob/mybb_1...#L301-L336

Are you trying to integrate MyBB login with another part of your site?
Yes

Fatal error: Class 'DataHandler' not found in /home/.../domains/.../public_html/forum/inc/datahandlers/login.php on line 23

Why? I required this file.

<?php

session_start();

require_once "../forum/inc/datahandlers/login.php";

require "../DataBase/rb.php";

R::setup(  );

if ( !R::testConnection() )
{
    exit ();
}

$name = $_POST["name"];
$password = $_POST["password"];

if(empty($name) || empty($password)){
    $_SESSION["message"] = "Заполните все поля!";
    header("Location: login.php");
    die();
}

$loginhandler = new LoginDataHandler("get");

$user = array(
    'username' => $mybb->get_input('username'),
    'password' => $mybb->get_input('password'),
    'remember' => $mybb->get_input('remember'),
    'imagestring' => $mybb->get_input('imagestring')
);

$options = array(
    'fields' => 'loginattempts',
    'username_method' => (int)$mybb->settings['username_method'],
);

$user_loginattempts = get_user_by_username($user['username'], $options);
$user['loginattempts'] = (int)$user_loginattempts['loginattempts'];

$loginhandler->set_data($user);

$validated = $loginhandler->validate_login();

if(!$validated)
{
    $mybb->input['action'] = "login";
    $mybb->request_method = "get";

    $login_user = get_user_by_username($user['username'], array('fields' => 'uid'));

    // Is a fatal call if user has had too many tries
    $logins = login_attempt_check($login_user['uid']);

    $db->update_query("users", array('loginattempts' => 'loginattempts+1'), "uid='".(int)$loginhandler->login_data['uid']."'", 1, true);

    $errors = $loginhandler->get_friendly_errors();

    $user['loginattempts'] = (int)$loginhandler->login_data['loginattempts'];

    // If we need a captcha set it here
    if($mybb->settings['failedcaptchalogincount'] > 0 && ($user['loginattempts'] > $mybb->settings['failedcaptchalogincount'] || (int)$mybb->cookies['loginattempts'] > $mybb->settings['failedcaptchalogincount']))
    {
        $do_captcha = true;
        $correct = $loginhandler->captcha_verified;
    }
}
else if($validated && $loginhandler->captcha_verified == true) {
    // Successful login
    if ($loginhandler->login_data['coppauser']) {
        error($lang->error_awaitingcoppa);
    }

    $loginhandler->complete_login();

    $plugins->run_hooks("member_do_login_end");

    $mybb->input['url'] = $mybb->get_input('url');
}

You may need to require inc/datahandler.php for the base class.
Where Call to a member function get_input() on null in defined get_input function? I dont see
It is defined in the MyBB class in inc/class_core.php. You may want to include inc/init.php to setup important things for you. This is where it sets up $mybb https://github.com/mybb/mybb/blob/mybb_1...hp#L60-L61