Support Forums
Upon Registration on One Site | Register on a Forum - Printable Version

+- Support Forums (https://www.supportforums.net)
+-- Forum: Categories (https://www.supportforums.net/forumdisplay.php?fid=87)
+--- Forum: Coding Support Forums (https://www.supportforums.net/forumdisplay.php?fid=18)
+---- Forum: PHP The Hypertext Preprocessor (https://www.supportforums.net/forumdisplay.php?fid=21)
+---- Thread: Upon Registration on One Site | Register on a Forum (/showthread.php?tid=3838)



Upon Registration on One Site | Register on a Forum - Grizzly - 12-21-2009

I want to, on registration with one site (and RPG Game) have an automatic registration on a forum (MyBB) on another site. I'm not 100% sure how to do this though Sad

Pretty much I want a script that will, upon clicking Register, create the user on the site for registration in that DB, then go to the MyBB forum and create the new account using the same username and password.


RE: Upon Registration on One Site | Register on a Forum - Gaijin - 12-21-2009

Are you using the same users table to load user data from both sides.
In that case you can just either, redirect a registration form to the same url as myBB one does or you can copy the SQL command of myBB.




RE: Upon Registration on One Site | Register on a Forum - Grizzly - 12-21-2009

Lol that rep was for the last thing you helped me on.

I believe the tables are named something else in each one.


RE: Upon Registration on One Site | Register on a Forum - Gaijin - 12-21-2009

But they are still in the same databse?
If and if not you still can just write up a custom sql_query that will insert the needed things into myBB table
If they are not in the same db then you'll also need a new connection.

Just take a look on what data myBB saves upon the registration and copy that query based on your other form inputs.
For a login I would then check for the myBB cookie when loging the user into the Game.


RE: Upon Registration on One Site | Register on a Forum - Grizzly - 12-21-2009

Yeah, I'll have to play around with it, I'm still new to the SQL part of PHP so it may take a little bit of trial and error. The DB's are different DB's that are part of a completely different domain. Is that possible? I may look at making an individual forum for each game, instead of running wtih one centralized forum, that may be the easiest way to do it, and just have the forum and game run out of the same DB. It would be like game.com adn then forum.game.com.


RE: Upon Registration on One Site | Register on a Forum - Gaijin - 12-21-2009

Well own forums are always better, but yes it's possible to load from different hosts.
A configuration array would be:

PHP Code:
$config = array(
    
'host' => 'localhost'// or you change it to your diff sql host ex: sql.example.com
    
'user' => 'root',
    
'pass' => '',
    
'base' => 'game_users'


You need to change the "host" and point it to a remote host. And also use the user and password that one db uses..
Everything other is simple mysql_connect, mysql_select, mysql_query, etc..

Here is a simple connection tut.
http://www.supportforums.net/showthread.php?tid=116


RE: Upon Registration on One Site | Register on a Forum - Grizzly - 12-21-2009

Thanks, I'll fiddle around with it some once I get my laptop back. I'm trying to get a few things knocked out while I don't have it.


RE: Upon Registration on One Site | Register on a Forum - wat - 12-21-2009

What you're basically doing is trying one script to modify two databases, the game and the forum. You could do this manually. i.e. have an sql query for the first database, close the connection, open a connection on the second database, insert everything, and close it. It's a lot of work, I know. The other thing you could try to do, is find a way to call the script that the forum uses to add a member. I'm not quite sure how to do this, but all it really takes is a post request. Either way works, the second one _might_ be a little bit simpler, though.