..:D&G:.. Posted February 22, 2016 Share Posted February 22, 2016 Hey, is there any way to check if the login creditals of a MyBB forum login that the player enters in a gui in game, are correct? Thanks. Link to comment
Ab-47 Posted February 22, 2016 Share Posted February 22, 2016 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. Link to comment
..:D&G:.. Posted February 22, 2016 Author Share Posted February 22, 2016 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
Tomas Posted February 22, 2016 Share Posted February 22, 2016 You may also use MySQL, under which version are you running MyBB? Link to comment
GTX Posted February 23, 2016 Share Posted February 23, 2016 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
..:D&G:.. Posted February 23, 2016 Author Share Posted February 23, 2016 EDIT! Fixed! Link to comment
tosfera Posted February 23, 2016 Share Posted February 23, 2016 Why don't you just use the same hash from MyBB's php class and transfer it towards Lua? A lot less hussle with calling sites and what so ever. Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now