Jump to content

[HELP] Checking MyBB login creditals


..:D&G:..

Recommended Posts

Using
fetchRemote 

and

callRemote 

it would be possible, but you'd also have to create a script on your forums which would be the tough part.

Well that's the thing, remoting won't be a problem, but the forum bit is. Isn't there a built in function that returns true or false if the password was correct/incorrect?

Link to comment

Use this class: https://github.com/olada/MyBBIntegrator

Put it somewhere, doesn't matter where.

You'll have to also download MTA PHP SDK: http://code.opencoding.net/mta/mtaphpsdk_0.4.zip

So, PHP should look like this:

  
<?php 
    define("IN_MYBB", NULL); // Is it in MyBB root directory? 
  
    require "sdk/mta_sdk.php"; // Include your MTA PHP SDK 
    $input = mta::getInput(); // Get input that is sent via callRemote 
  
    global $mybb, $lang, $query, $db, $cache, $plugins, $displaygroupfields; // Global variables. 
    require_once "/var/www/local/mybb/global.php"; // Global PHP file of MyBB. 
    require_once "/var/www/local/mybb/api/integrator.php"; // Integrator class you downloaded. 
  
    $c = new MyBBIntegrator($mybb, $db, $cache, $plugins, $lang, $config); // Class init. 
    $auth = $c->login($input[0], $input[1]); // Check if username and password is correct. Will return true if user was successfully logged in. 
    mta::doReturn($auth); // Send back to MTA. 
?> 
  

And Lua code:

  
function receiveDetails(username, password) 
    callRemote("http://127.0.0.1/mybb/mta/auth.php", callback, username, password) -- You might also wanna send player so you can get who logged in. 
end 
addEvent("sendAuthenticationRequest", true) 
addEventHandler("sendAuthenticationRequest", root, receiveDetails) 
  
  
  
function callback(ret) 
    if tostring(ret):lower() == "error" then 
        return outputChatBox("An unknown error has occurred", root, 255, 0, 0, true) 
    end 
    if ret then 
        -- Successfully logged in. 
  
    else 
        -- Wrong username or password or user does not exist. 
    end 
end 
  

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...