Intergate Chat And Log Hall of Fame

    This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

    • Intergate Chat And Log Hall of Fame

      Hello everything,

      All is in the title, in addition to 2Moons I have a Wordpress site and I would like to integrate the Chat and or battle logs directly into my site, even db and ftp, an idea?

      Thx a lot ! :D

      (I had in mind to integrate an iframe but you need a connection... I overlooked the connection for these two tables)
    • the user always needs to log in, else you can not verify if it's really the user.

      you could make the chat viewable from outside with a guest account for example.
      guestaccount can be made in game, then form a post/xhr request from your iframe that logs the user in(writs the cookies and opens a session). after succesful login you can redirect the user directly to the chat.
      this could also be done without iframe, but to avoid unwanted interference between wordpress and 2moons or chat it is the easier way.
      but if you don't like iframes you can of course try to use a div as target.

      the battlehall is easier, index.php?page=battleHall.
    • here is an example:

      1.wp.php (this represents your wp page and shows how to place the iframes(may you have to change the path to your game))
      2.wp2moons.php manages the login with the guestaccount(in this example i used user:test1 pw: testtest, please register a user in your game, wich is named like the user in this file and has the password)
      3.includes/pages/game/ShowChatPage.class.php
      changed line 30 from

      PHP Source Code: includes/pages/game/ShowChatPage.class.php

      1. if($action == 'alliance') {
      to

      PHP Source Code: includes/pages/game/ShowChatPage.class.php

      1. if($action == 'alliance' || HTTP::_GP('iframe', '') == 1) {
      to initiate popupmode, when it is called by the iframescript in wp2moons.php file.

      here is how it should look in the end
      hosting102733.af991.netcup.net/2moonsplay/wp.php
      Files
      • wpiframe.zip

        (2.05 kB, downloaded 8 times, last: )
    • A big thank you to you, it works in part because I can see the battle logs correctly but the chat does not answer.
      Images
      • Example.JPG

        76.9 kB, 762×933, viewed 14 times
    • change

      JavaScript Source Code: wp2moons.php

      1. <script>
      2. var http = new XMLHttpRequest();
      3. http.open("POST", "index.php?page=login", true);
      4. http.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
      5. http.onreadystatechange = function() { if(http.readyState == 4 && http.status == 200) { location.href = 'chat/index.php'; } }
      6. http.send("username=test1&password=testtest");
      7. </script>
      line 16 (location.href = 'chat/index.php';)
    • ok i changed the wp2moons.php like aboth
      then i added
      if($username == 'test1'){
      die();
      }
      in line 66 of includes\pages\login\ShowLoginPage.class.php
      now there is one iframe less, cause the game calls the chat in an iframe
      and its one redirect less, cause after login
      Files
      • wpiframe.zip

        (2.31 kB, downloaded 9 times, last: )
    • I think the problem is on the wp + iframe + action side

      but I have the fighting events and that's already very, very good. Thanks again!!!!
      I'll try to look at where it came from.