Jump to content

The way to avoid re-login when changing server


abadabadu

Recommended Posts

Hello. I was looking for some way to avoid double login.

(Case:

2 servers with same resource running ( server 1, server 2 ).

1 MySQL database with table named "users" containing nicks and passwords for all players.

Player connects server 1 and log in with nick and password.

Then player will know that his friend is playing in server 2. He leave server 1 and go to server 2. But player must to login again in server 2.)

We can use cookies only in http, not with gamemode resources.

Serials do not 100% grant security.

Suggestion:

Add "key" value to redirectPlayer function.

I mean, when server 1 redirect player to server 2 it do it with function redirectPlayer.

bool redirectPlayer ( player thePlayer, string serverIP, int serverPort, [ string serverPassword ] ) 

To avoid double login in server 2, we can use some "key" value in redirectPlayer function

bool redirectPlayer ( player thePlayer, string serverIP, int serverPort, [ string serverPassword ], [ string key ] ) 

In this way, before redirect player server 1 creates some secret key KDHFL9070324, save it in MySQL database + associate it with player who want to go to server 2, then redirect this player to server 2 with key param in redirectPlayer function .

bool redirectPlayer ( player, 127.0.0.1, 22003, "", [b]KDHFL9070324  [/b]) 

Server 2 then select from MySQL db data associated with this key KDHFL9070324 and will know who was redirected to.

(For security reason key must be for one-use only and has 1 min live time, plus associated with IP/serial etc)

Link to comment

Then when player join server 2, onPlayerJoin event have this key value as param

onPlayerJoin

parameters: string key

and mb it is possible to make another param redirectedFrom wich contains ip/port server made redirect

onPlayerJoin

parameters: string key, string redirectedServerIP, int redirectedServerPort

Link to comment
  • Recently Browsing   0 members

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