Jump to content

[TUT/CODE] Synchronize account creation between IPB and MTA


Unknown76

Recommended Posts

This code will help with the connection between IP.Board forum platform and your MTA server. In fact, when a player registers on the MTA server, this script will automatically create a forum account with the same username and password. All you need is PHP SDK (for more info, there is a tutorial in this section about PHP SDK), a IP Board forum and a MTA server.

First step: download PHP SDK from the wiki or from the tutorial provided in this section

Second step: create a new folder at this path ipb-forum-root/admin/sources/base/ called sdk and extract everything from php sdk archive to it

Third step: create a new PHP file called mtaforum.php in ipb-forum-root/admin/sources/base/ and add this piece of code to the file:

<?php 
//By QuantumZ  
  
require( "../../../initdata.php");  //we need to include this because ipsRegistry requires it 
include( "sdk/mta_sdk.php" );  //the sdk is a must  
require( "ipsRegistry.php" );  //this will give us the functions to modify things in the forum platform  
  
ipsRegistry::init();            
$input = mta::getInput(); // $input[0] is username, $input[1] is password, $input[2] is e-mail 
mta::doReturn($input[0]); 
  
//$passSalt = IPSMember::generatePasswordSalt(5);   
//$passCompiled = IPSMember::generateCompiledPasshash($passSalt, md5($input[1])); 
$user = IPSMember::create( array( 'core' => array( 'email' => $input[2], 'password' => $input[1], 'name' => $input[0], 'members_display_name' => $input[0] ) ) ); 
  
?>  

Fourth step: Now we finshed with the web-based things let's go to our MTA server and add this in our Register function:

callRemote("http://FORUM ADRESS/admin/sources/base/mtaforum.php", inReturn,username, password, mail) 

Fifth step: Add this in the same .lua as the callRemote to ouput in console whenever somebody will create a forum account:

function inReturn(name) 
    outputDebugString("[FORUM] " ..tostring(name).. " registered.") 
end 

Sixth step: Profit.

  • Like 3
Link to comment
  • 4 weeks later...
  • 1 year later...
  • 5 years later...
  • Recently Browsing   0 members

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