Search Unity

PHP Master Server

Discussion in 'Made With Unity' started by duhprey, Oct 31, 2010.

  1. deve

    deve

    Joined:
    Dec 24, 2012
    Posts:
    3

    what kind of source do you need for this, I can get maybee the informations you need from the exe .
     
  2. deve

    deve

    Joined:
    Dec 24, 2012
    Posts:
    3
    Bump!

    can you show us a tutorial on how to use it also for other games what we need (information from the game) .

    Thanks
     
  3. mohebbi_hr

    mohebbi_hr

    Joined:
    Oct 18, 2013
    Posts:
    5
    HI , guys

    I am new to unity, I want to use the PHPMasterServer, I create the MasterServer Database, and upload other php files, but I don't know how to use the MainMenu.js and PHPMasterServerConnect.js. I've got this exception:

    NullReferenceException: Object reference not set to an instance of an object
    Sample_MainMenu.JoinableGames (Int32 id) (at Assets/Scripts/Sample_MainMenu.js:202)
    UnityEngine.GUI.CallWindowDelegate (UnityEngine.WindowFunction func, Int32 id, UnityEngine.GUISkin _skin, Int32 forceRect, Single width, Single height, UnityEngine.GUIStyle style) (at C:/BuildAgent/work/cac08d8a5e25d4cb/Runtime/ExportGenerated/Editor/GUI.cs:1324)

    Please help me, how to use these two js scripts, on Unity?
     
  4. Bunny83

    Bunny83

    Joined:
    Oct 18, 2010
    Posts:
    3,990
    Hi duhprey,

    Great job so far, i can't believe that no one has thought of this earlier ;)

    However I have a few concerns mainly about security. The way your interface works at the moment enables everyone to update or even delete a registrated host. That could easily abused even without any kind of software since the attacker just need to type your url into a browser. Someone could constantly unregister a certain host or automatically unregister all hosts of a certain gametype.

    RegisterHost should generate a hash token (GUID or something like that) and return this token to the caller. All manipulations on the registrated host should require this token so only the server owner can change / delete the host entry.

    Next thing is you have 0 (zero, nada) input vaildation. So hackers would have lots of fun dropping your table(s) / database(s) or "browse" your SQL server via SQL injections.

    So to anyone who wants to use this: You really need to improve this a lot to make it suitable for public use.
     
  5. duhprey

    duhprey

    Joined:
    Nov 13, 2009
    Posts:
    166
    Thanks. You are correct in all points there. I'm happy to take pull requests on github.
     
  6. Hoskins355

    Hoskins355

    Joined:
    Jan 3, 2013
    Posts:
    142
    Hi duhprey,

    Do you have a sql file that can generate the database table? Or do you have a picture of how the MasterServer table should look. I am just having trouble setting up the table.

    Thanks
    Brandon
     
  7. duhprey

    duhprey

    Joined:
    Nov 13, 2009
    Posts:
    166
  8. Hoskins355

    Hoskins355

    Joined:
    Jan 3, 2013
    Posts:
    142
    Thanks that worked Sorry I didn't see it.
     
  9. Hoskins355

    Hoskins355

    Joined:
    Jan 3, 2013
    Posts:
    142
    Ok I got the database setup. But I am having trouble connecting. I created an empty game object then added the PHP Masterserver Connect script and the main menu script. I added the url and game type. Then tagged it Main Menu. But I am getting an error on this line

    conn = GetComponent(PHPMasterServerConnect);

    and this line

    hostData : HostData[] = conn.PollHostList ();

    error says NullReferenceException: Object reference not set to an instance of an object

    I tried this

    conn = GameObject.FindWithTag("Main Menu").getComponent(PHPMasterServerConnect);

    But no luck any ideas as to what I am doing wrong? Thanks Again for all your help
     
    Last edited: Sep 1, 2014
  10. duhprey

    duhprey

    Joined:
    Nov 13, 2009
    Posts:
    166
    You need to add the PHPMasterServerConnect component to your object with the mainmenu component. Then it should work (although you'll need to configure the Connect with your server settings)
     
  11. Junkerdale

    Junkerdale

    Joined:
    Feb 14, 2015
    Posts:
    1
    Hi, I get the PHP masterserver working from this code https://github.com/tosos/PHPMasterServer I can query servers but connecting to server fails with error message:

    NAT target 148618790905851007 not connected to NAT facilitator 67.225.180.24:50005
    NATTargetNotConnected

    But as the desciption said, "This still uses Unity's default NAT facilitator.". I'm wondering why it cannot use this default NAT facilitator, how are those dependant? Switching master server back to Unity default master server works. Why doesn't this PHP solution work with the default NAT facilitator?
     
  12. duhprey

    duhprey

    Joined:
    Nov 13, 2009
    Posts:
    166
    It could be something changed in a recent unity version. I'm not really sure. Have you double checked your IPs to make sure nat facilitator is correct versus unity's masterserver ip?
     
  13. BlackPanda

    BlackPanda

    Joined:
    Jan 24, 2014
    Posts:
    78
    I'm sorry I didn't understand that part. Then can I host facilitator and connection tester in dreamhost or hostgator?
     
  14. dipixoft

    dipixoft

    Joined:
    Jan 17, 2014
    Posts:
    2
    but how can i host facilitator?