Help for php, not sure if right section but hey i am new

Hello, i need some help if you have the answer, our php guy dropped off the planet and left us dry, the guy working on it made this email for help

[email protected] if you can help

Well this is the thing… we have a forum (Invision Power Board) setted up and we need to make the registration process send the account data to 2 different DBs, one locally on the same webhost (forum one) and another remote with non default port (game one). The modding is basically done, and works if you work with both DBs on the same MySQL Server. But the problems comes up when you need to get them sepparated. in that case registration inserts the account on forum DB but not on remote one (game one). is there any way to fix that? to make it send the info to remote server too?
Another problem with this (but not soo important) is that the game account is created when the user press create account button and not on account activation by email like happens with the forum. Can that be changed to create game account on account activation too?

This is basically the way there are setted up both DBs…

ForumDB:
host = ‘localhost’
database = ‘forum’
user = ‘root’
pass = ‘password’
tbl_prefix = ‘ibf_’
Game DB
host = ‘xxx.xxx.xxx.xxx:45123’
database = ‘accounts’
user = ‘root’
pass = ‘password’
tbl_prefix = ‘’

Thnxs in advance…
PS: Game DB config info on conf_global.php doesn’t seems to be read, so you have to change info on …ips_kernelclass_db_mysqli_client.php file

I personally add the following fields into the game registration script that way you do not need to modify IPB.

Forum UserName:
Forum Password:

Yeah… maybe you’re right on that… but, what I mean… since we already have the mod done, just the different SQL servers problem (when they are on the same sql server, works, without problem) is there any way to make it work in this way so we can use the whole forum reg system, wich also makes the changes on both DBs when user changes his password on userCP or when mods changes their password. So it’s not just a reg merge thing… that’s why we wanna get this fixed in this way instead using an external registration system.

Any ideas???

In ips_kernelclass_db_mysqli_client.php I have something like this…

		if($db) {
			$this->obj['sql_host']		 = 'host';
			$this->obj['sql_user'] 		 = 'user';
			$this->obj['sql_pass'] 		 = 'pass';
			$this->obj['sql_database']	 = 'gamedb';
			$this->obj['sql_tbl_prefix'] = '';
		}

and in modulesipb_member_sync.php i have something like this

global $ipsclass; $oldConnectionId = $ipsclass->DB->connection_id; $ipsclass->DB->connect('l2j'); $member['password'] = base64_encode(pack("H*", sha1(utf8_encode($member['password'])))); $ipsclass->DB->do_insert( 'accounts', array ( 'login' => $member['name'], 'password' => $member['password'], 'access_level' => '0', 'lastip' => $ipsclass->input['IP_ADDRESS'] ) ); $ipsclass->DB->connection_id = $oldConnectionId;

Maybe someone who actually knows about this can take a look at this and point me in the right direction??

Thnxs in advance…

It sounds like you need synchronization between two databases. I don’t know how fast (instant?) you want this to occur, but you could for example build a synchronization script that runs every x time (say, every 24 hours) to see if any new changes have been made on the forum side, and synchronize the game side with it.

Sorry but we are really new to php the guy that was helping our server started the work and vanished,

do you have an idea on how to make this sync script?

Now it sounds more like you need a new guy ;)

Yes, I know how to do a sync script:

Connect to forum database
Select relevant data
Disconnect

Connect to game database
Update relevant data
Disconnect

You can set a script like that as a cronjob and have it run periodically.

Sponsor our Newsletter | Privacy Policy | Terms of Service