Jump to content
  • 0
Sign in to follow this  
BuLaLaKaW

R > How to manage multiple Flux CP - Registration

Question

Hi !

 

Let say I use 3 different servers and create fluxcp for each of them, let say:

- server 1 FLux

- server 2 FLux

- server 3 FLux

 

 

 

If a player register in server 1 FLux and submits it successfully, it will create same login info to server 2 FLux and server 3 FLux. If a player register in server 2 FLux and submits it successfully, it will create same login info to server 3 FLux and server 1 FLux. If a player register in server 3 FLux and submits it successfully, it will create same login info to server 1 FLux and server 2 FLux. 

 

or

 

 

 

If a player register in server 1 FLux and submits it successfully, player can also login on server 2 FLux and server 3 Flux This way it will be like 1 login db and 3 different char db 

 

How to manage and do this ?

 

Thanks

Share this post


Link to post
Share on other sites

5 answers to this question

Recommended Posts

  • 0

I am no wiz at FluxCP, with a quick glance at the code (Not sure if there are plugins/modules that support what you asked for)

lib/Flux/LoginServer.php

	public function __construct(Flux_Config $config)	{		parent::__construct($config);		$this->loginDatabase = $config->getDatabase();	}

Replace with something like 

	public function __construct(Flux_Config $config)	{		parent::__construct($config);		$this->loginDatabase = $config->getDatabase();		$this->loginDatabase_2 = 'my_ro_db1';		$this->loginDatabase_3 = 'my_ro_db2';	}

And then

		$sql = "INSERT INTO {$this->loginDatabase}.login (userid, user_pass, email, sex, level) VALUES (?, ?, ?, ?, ?)";		$sth = $this->connection->getStatement($sql);		$res = $sth->execute(array($username, $password, $email, $gender, (int)$this->config->getLevel()));

To

		$sql = "INSERT INTO {$this->loginDatabase_2}.login (userid, user_pass, email, sex, level) VALUES (?, ?, ?, ?, ?)";		$sth = $this->connection->getStatement($sql);		$res = $sth->execute(array($username, $password, $email, $gender, (int)$this->config->getLevel()));		$sql = "INSERT INTO {$this->loginDatabase_1}.login (userid, user_pass, email, sex, level) VALUES (?, ?, ?, ?, ?)";		$sth = $this->connection->getStatement($sql);		$res = $sth->execute(array($username, $password, $email, $gender, (int)$this->config->getLevel()));		$sql = "INSERT INTO {$this->loginDatabase}.login (userid, user_pass, email, sex, level) VALUES (?, ?, ?, ?, ?)";		$sth = $this->connection->getStatement($sql);		$res = $sth->execute(array($username, $password, $email, $gender, (int)$this->config->getLevel()));

Something like that would work for what you're asking, keep in mind though, each instance of Flux will probabbly work with each server it is configured to work with, so the CP would only retrieve data from $this->loginDatabase and nowhere else.

If you have no need for players to use the CP on other the other servers. (FluxCP seems to keep its own record for created accounts too, so simply adding the entry to your other server's login table might not fully work either, unless you redo the queries for each server that FluxCP depends on. 

Also this will not check for already-in-use usernames, you'd have to look at the register function and repeat the function three times.

 

Another approach could be something like:

Copy the register function into 3 new functions (register_srv1, register srv_2, register_srv3, load each one of your database into 3 new vars and do the inserts as needed. This again wouldnt work if you already have the login tables populated with information unless you do the proper checks first to see if the data can be inserted. 

Share this post


Link to post
Share on other sites
  • 0

thanks for your response Xgear!i just realized with the info you have provided that it may complicate thingsmaybe if it is possible for flux to do something like :1 login db3 char dbnot so sure though if flux needs info about map db

Share this post


Link to post
Share on other sites
  • 0

You can use 1 login table and multiple map/char servers databases, thats easier. You'd only need to add arrays as needed into CharMapServers, one per each server with its corresponding settings. (I added 2 more servers, which I only changed the name to FluxRO2 and FluxRO3

config/servers.php

    // Example server configuration. You may have more arrays like this one to
// specify multiple server groups (however they should share the same login
// server whilst they are allowed to have multiple char/map pairs).

'CharMapServers' => array(			array(				'ServerName'    => 'FluxRO',				'BaseExpRates'  => 200,				'JobExpRates'   => 200,				'MvpExpRates'   => 200,				'DropRates'     => 25,				'MvpDropRates'  => 25,				'CardDropRates' => 25,				'MaxCharSlots'  => 9,				'DateTimezone'  => null,       // Specifies game server's timezone for this char/map pair. (See: http://php.net/timezones)				//'ResetDenyMaps' => 'sec_pri',  // Defaults to 'sec_pri'. This value can be an array of map names.				//'Database'      => 'ragnarok', // Defaults to DbConfig.Database				'CharServer'    => array(					'Address'   => '127.0.0.1',					'Port'      => 6121				),				'MapServer'     => array(					'Address'   => '127.0.0.1',					'Port'      => 5121				),				// -- WoE days and times --				// First parameter: Starding day 0=Sunday / 1=Monday / 2=Tuesday / 3=Wednesday / 4=Thursday / 5=Friday / 6=Saturday				// Second parameter: Starting hour in 24-hr format.				// Third paramter: Ending day (possible value is same as starting day).				// Fourth (final) parameter: Ending hour in 24-hr format.				// ** (Note, invalid times are ignored silently.)				'WoeDayTimes'   => array(					//array(0, '12:00', 0, '14:00'), // Example: Starts Sunday 12:00 PM and ends Sunday 2:00 PM					//array(3, '14:00', 3, '15:00')  // Example: Starts Wednesday 2:00 PM and ends Wednesday 3:00 PM				),				// Modules and/or actions to disallow access to during WoE.				'WoeDisallow'   => array(					array('module' => 'character', 'action' => 'online'),  // Disallow access to "Who's Online" page during WoE.					array('module' => 'character', 'action' => 'mapstats') // Disallow access to "Map Statistics" page during WoE.				)			)		)

Change to

'CharMapServers' => array(			array(				'ServerName'    => 'FluxRO',				'BaseExpRates'  => 200,				'JobExpRates'   => 200,				'MvpExpRates'   => 200,				'DropRates'     => 25,				'MvpDropRates'  => 25,				'CardDropRates' => 25,				'MaxCharSlots'  => 9,				'DateTimezone'  => null,       // Specifies game server's timezone for this char/map pair. (See: http://php.net/timezones)				//'ResetDenyMaps' => 'sec_pri',  // Defaults to 'sec_pri'. This value can be an array of map names.				//'Database'      => 'ragnarok', // Defaults to DbConfig.Database				'CharServer'    => array(					'Address'   => '127.0.0.1',					'Port'      => 6121				),				'MapServer'     => array(					'Address'   => '127.0.0.1',					'Port'      => 5121				),				// -- WoE days and times --				// First parameter: Starding day 0=Sunday / 1=Monday / 2=Tuesday / 3=Wednesday / 4=Thursday / 5=Friday / 6=Saturday				// Second parameter: Starting hour in 24-hr format.				// Third paramter: Ending day (possible value is same as starting day).				// Fourth (final) parameter: Ending hour in 24-hr format.				// ** (Note, invalid times are ignored silently.)				'WoeDayTimes'   => array(					//array(0, '12:00', 0, '14:00'), // Example: Starts Sunday 12:00 PM and ends Sunday 2:00 PM					//array(3, '14:00', 3, '15:00')  // Example: Starts Wednesday 2:00 PM and ends Wednesday 3:00 PM				),				// Modules and/or actions to disallow access to during WoE.				'WoeDisallow'   => array(					array('module' => 'character', 'action' => 'online'),  // Disallow access to "Who's Online" page during WoE.					array('module' => 'character', 'action' => 'mapstats') // Disallow access to "Map Statistics" page during WoE.				)			)			array(				'ServerName'    => 'FluxRO2',				'BaseExpRates'  => 200,				'JobExpRates'   => 200,				'MvpExpRates'   => 200,				'DropRates'     => 25,				'MvpDropRates'  => 25,				'CardDropRates' => 25,				'MaxCharSlots'  => 9,				'DateTimezone'  => null,       // Specifies game server's timezone for this char/map pair. (See: http://php.net/timezones)				//'ResetDenyMaps' => 'sec_pri',  // Defaults to 'sec_pri'. This value can be an array of map names.				//'Database'      => 'ragnarok', // Defaults to DbConfig.Database				'CharServer'    => array(					'Address'   => '127.0.0.1',					'Port'      => 6121				),				'MapServer'     => array(					'Address'   => '127.0.0.1',					'Port'      => 5121				),				// -- WoE days and times --				// First parameter: Starding day 0=Sunday / 1=Monday / 2=Tuesday / 3=Wednesday / 4=Thursday / 5=Friday / 6=Saturday				// Second parameter: Starting hour in 24-hr format.				// Third paramter: Ending day (possible value is same as starting day).				// Fourth (final) parameter: Ending hour in 24-hr format.				// ** (Note, invalid times are ignored silently.)				'WoeDayTimes'   => array(					//array(0, '12:00', 0, '14:00'), // Example: Starts Sunday 12:00 PM and ends Sunday 2:00 PM					//array(3, '14:00', 3, '15:00')  // Example: Starts Wednesday 2:00 PM and ends Wednesday 3:00 PM				),				// Modules and/or actions to disallow access to during WoE.				'WoeDisallow'   => array(					array('module' => 'character', 'action' => 'online'),  // Disallow access to "Who's Online" page during WoE.					array('module' => 'character', 'action' => 'mapstats') // Disallow access to "Map Statistics" page during WoE.				)			)			array(				'ServerName'    => 'FluxRO3',				'BaseExpRates'  => 200,				'JobExpRates'   => 200,				'MvpExpRates'   => 200,				'DropRates'     => 25,				'MvpDropRates'  => 25,				'CardDropRates' => 25,				'MaxCharSlots'  => 9,				'DateTimezone'  => null,       // Specifies game server's timezone for this char/map pair. (See: http://php.net/timezones)				//'ResetDenyMaps' => 'sec_pri',  // Defaults to 'sec_pri'. This value can be an array of map names.				//'Database'      => 'ragnarok', // Defaults to DbConfig.Database				'CharServer'    => array(					'Address'   => '127.0.0.1',					'Port'      => 6121				),				'MapServer'     => array(					'Address'   => '127.0.0.1',					'Port'      => 5121				),				// -- WoE days and times --				// First parameter: Starding day 0=Sunday / 1=Monday / 2=Tuesday / 3=Wednesday / 4=Thursday / 5=Friday / 6=Saturday				// Second parameter: Starting hour in 24-hr format.				// Third paramter: Ending day (possible value is same as starting day).				// Fourth (final) parameter: Ending hour in 24-hr format.				// ** (Note, invalid times are ignored silently.)				'WoeDayTimes'   => array(					//array(0, '12:00', 0, '14:00'), // Example: Starts Sunday 12:00 PM and ends Sunday 2:00 PM					//array(3, '14:00', 3, '15:00')  // Example: Starts Wednesday 2:00 PM and ends Wednesday 3:00 PM				),				// Modules and/or actions to disallow access to during WoE.				'WoeDisallow'   => array(					array('module' => 'character', 'action' => 'online'),  // Disallow access to "Who's Online" page during WoE.					array('module' => 'character', 'action' => 'mapstats') // Disallow access to "Map Statistics" page during WoE.				)			)		)
Edited by Xgear

Share this post


Link to post
Share on other sites
  • 0

i guess the first one is good, i will try it.

 

server 1 > does the registration

server 2 > redirect to server 1 for registration

server 3 > redirect to server 1 for registration

 

i hope it works :)

Share this post


Link to post
Share on other sites
  • 0

@Xgear, tried the first option and it did not work :(

i have set same username and password for all three databases in phpmyadmin

 

hope you can help me,

 

copied all entries on login from server 1

paste all entries on login to server 2 and 3

redirect registration for both server 2 and 3 to registration page for server 1

main registration will be at server 1

then when server 1 creates the account, it will create same account on the other two servers

 

please help

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.