MyBB Community Forums

Full Version: External login
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello, i'm trying to make an external login from another php file, i've learned about MyBBIntegrator and i'm trying to work with it but i get some problems...
This is my actual test code (The page is in my forum root directory):
define('IN_MYBB', NULL);
  
    global $mybb, $lang, $query, $db, $cache, $plugins, $displaygroupfields; // Global variables. 
    require_once "./global.php";
    require_once "./MyBBIntegrator.php"; 
  
    $c = new MyBBIntegrator($mybb, $db, $cache, $plugins, $lang, $config); 
$auth = $c->login('Jonny','358365');
echo $auth;
Actually correct or wrong data gives me the same result, "1"
I hope you guys could help me, it's really important for me, thanks in advance!

EDIT:  SOLVED.
Solution:
I used validate_password_from_username from inc/functions_user.php 
(2018-08-18, 02:21 PM)Jonny1455 Wrote: [ -> ]Hello, i'm trying to make an external login from another php file, i've learned about MyBBIntegrator and i'm trying to work with it but i get some problems...
This is my actual test code (The page is in my forum root directory):
define('IN_MYBB', NULL);
  
    global $mybb, $lang, $query, $db, $cache, $plugins, $displaygroupfields; // Global variables. 
    require_once "./global.php";
    require_once "./MyBBIntegrator.php"; 
  
    $c = new MyBBIntegrator($mybb, $db, $cache, $plugins, $lang, $config); 
$auth = $c->login('Jonny','358365');
echo $auth;
Actually correct or wrong data gives me the same result, "1"
I hope you guys could help me, it's really important for me, thanks in advance!

EDIT:  SOLVED.
Solution:
I used validate_password_from_username from inc/functions_user.php 
 

Hi Jonny, I'm trying to do the same as you did, but not succeed yet. I tried this MyBBIntegrator.php, but not work as it should. So searching, found your thread and tried to use this function you mentioned, but i getting error for undefined function even i had included the file.
How did you do that? Could you share the code?

I tried to include global.php to use $mybb->validate_password_from_username(), but just including global.php it already show login page and do nothing anymore of the code.