..:D&G:.. Posted February 22, 2016 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. MTA:Rust Pre-Alpha Build v.0.3: https://forum.mtasa.com/viewtopic.php?f=114&t=97848 2Pac: ''Only God can judge me!''
Ab-47 Posted February 22, 2016 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. And now Aurora is back again, pm for more info. Ex. Lead dev & L6 Staff at AUR, NGC, MTA RP & SAA. Ex. Developer at Community of Social Gamers - CSG Ex Founder of International Gaming Community - IGC and Union of Individual Players- UIP Ab-47
..:D&G:.. Posted February 22, 2016 Author 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? MTA:Rust Pre-Alpha Build v.0.3: https://forum.mtasa.com/viewtopic.php?f=114&t=97848 2Pac: ''Only God can judge me!''
Tomas Posted February 22, 2016 Posted February 22, 2016 You may also use MySQL, under which version are you running MyBB? Currently developing for International Gaming Community - Join us!
GTX Posted February 23, 2016 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 Do you require a paid scripter? Contact me! (Unavailable) Currently I am experienced in Lua, PHP, HTML, CSS, SQL and JS. Developer and owner of https://projectbea.st - Project Beast
..:D&G:.. Posted February 23, 2016 Author Posted February 23, 2016 EDIT! Fixed! MTA:Rust Pre-Alpha Build v.0.3: https://forum.mtasa.com/viewtopic.php?f=114&t=97848 2Pac: ''Only God can judge me!''
tosfera Posted February 23, 2016 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. If you want to contact me directly concerning Advanced-Gaming, please contact me at [email protected]
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