Welcome to TalkGraphics.com
Page 2 of 2 FirstFirst 12
Results 11 to 17 of 17
  1. #11
    Join Date
    Jan 2011
    Posts
    16

    Default Re: Adding php files.

    bjornkn, i think for taking the time to help me, but simply do not understand.

    another one of my buddies is taking over the project i showed him this thread and he may post on it for help, thank you for the time you have given.

    if you could help my friend out that would be nice, he has more patience than i do with this.

  2. #12
    Join Date
    Feb 2011
    Posts
    3

    Default Re: Adding php files.

    Hello, I'm Ikljo (John) and I am taking over the project for Joe. The main error we are receiving is:

    Notice: fwrite() [function.fwrite]: send of 1 bytes failed with errno=1 Operation not permitted in /home/content/15/7311615/html/php/GameQ/Communicate.php on line 138
    Around line 138 in the Communication.php file reads:

    /**
    * Write to a socket.
    *
    * @param resource $socket Socket to write to
    * @param string $packet String to write
    */
    private function write($socket, $packet)
    {
    fwrite($socket, $packet);
    }
    Line 138 being:
    fwrite($socket, $packet);
    I am thinking their may be a port conflict, but I am positive I set it correctly as it states in the game.ini file I have to set the port as the end port:

    [assaultcube]
    name = "Assault Cube"
    port = 28764
    prot = "cube"
    The default ports for the game are 28763 and 28764.

    Here is what I have set us in the example.php file

    <?php
    error_reporting(E_ALL);


    require_once 'GameQ.php';


    // Define your servers,
    // see list.php for all supported games and identifiers.
    $servers = array(
    'server 1' => array('cube', 'ca.hype-clan.com', 57576),
    'server 2' => array('cube', 'us.hype-clan.com', 22023),
    );


    // Call the class, and add your servers.
    $gq = new GameQ();
    $gq->addServers($servers);


    // You can optionally specify some settings
    $gq->setOption('timeout', 200);


    // You can optionally specify some output filters,
    // these will be applied to the results obtained.
    $gq->setFilter('normalise');
    $gq->setFilter('sortplayers', 'gq_ping');

    // Send requests, and parse the data
    $results = $gq->requestData();






    // Some functions to print the results
    function print_results($results) {

    foreach ($results as $id => $data) {

    printf("<h2>%s</h2>\n", $id);
    print_table($data);
    }

    }

    function print_table($data) {

    $gqs = array('gq_online', 'gq_address', 'gq_port', 'gq_prot', 'gq_type');


    if (!$data['gq_online']) {
    printf("<p>The server did not respond within the specified time.</p>\n");
    return;
    }

    print("<table><thead><tr><td>Variable</td><td>Value</td></tr></thead><tbody>\n");

    foreach ($data as $key => $val) {

    if (is_array($val)) continue;

    $cls = empty($cls) ? ' class="uneven"' : '';

    if (substr($key, 0, 3) == 'gq_') {
    $kcls = (in_array($key, $gqs)) ? 'always' : 'normalise';
    $key = sprintf("<span class=\"key-%s\">%s</span>", $kcls, $key);
    }

    printf("<tr%s><td>%s</td><td>%s</td></tr>\n", $cls, $key, $val);
    }

    print("</tbody></table>\n");

    }








    ?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
    <head>
    <title>GameQ - Example script</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <style type="text/css">
    * {
    font-size: 9pt;
    font-family: Verdana, sans-serif;
    }
    h1 {
    font-size: 12pt;
    }
    h2 {
    margin-top:2em;
    font-size: 10pt;
    }
    table {
    border: 1px solid #000;
    background-color: #DDD;
    border-spacing:1px 1px;
    }
    table thead {
    font-weight: bold;
    background-color: #CCC;
    }
    table tr.uneven td {
    background-color:#FFF;
    }
    table td {
    padding: 5px 8px;
    }
    table tbody {
    background-color: #F9F9F9;
    }
    .note {
    color: #333;
    font-style:italic;
    }
    .key-always {
    color:red;
    font-weight:bold;
    }
    .key-normalise {
    color:red;
    }
    </style>
    </head>
    <body>
    <h1>Server Stats</h1>
    <div class="note">
    I fail at making this thing work so far! <br/>
    <span class="key-always">Failed Attempt!</span> Time to go back and try again.
    Additionally, I hope I will figure this <span class="key-normalise">STUFF</span> out as soon as I can.<br/>
    I appoligize for any inconveniences!.<br/>
    <br/>
    </div>
    <?php
    print_results($results);
    ?>
    </body>
    </html>
    In FileZilla under the Remote Site, I made a folder called "php" and I put the GameQ folder and files inside of it. That is one of the steps I think was already mentioned. It looks similar to this:

    -"Folder '/' "
    .............|__"Folder 'php' "
    ................................|__"Folder 'GameQ' "
    .................................................. ...|__"Folder 'Filter' "
    .................................................. ...|__"Folder 'Protocol' "

    Inside the "php" folder is a "GameQ" folder, example.php, GameQ.php, list.php, ReadMe.txt
    Inside the "GameQ" folder is a "Filter" folder, "Protocol" folder, Buffer.php, Communication.php, Config.php, Exceptions.php, Filer.php, games.ini, packets.ini, Protocol.php and Results.php
    Then inside the "Filter" folder is more files and the same for the "Protocol" folder.

    I hope that gives you a basic idea of the folder layout in-case that helps at all.

    If you have any suggestions, I would be greatly appreciative!

    Thanks,
    Ikljo
    Last edited by ikljo; 14 February 2011 at 01:37 AM.

  3. #13
    Join Date
    Dec 2010
    Location
    Kristiansand, Norway
    Posts
    165

    Default Re: Adding php files.

    You need to isolate the problem.

    Q. Does it work with the original examples.php file?
    __A: No
    _____A problem with php setup, version, UDP, config?
    _____Ask your web host ?
    _____Ask the author of GameQ?
    __A: Yes
    _____ A problem with your new php file?
    _____Try with different servers/ports?
    _____Ask GameQ author?
    _____Ask on php forums?

    You're much more likely to find php help on other sites than this, and this is not a Xara problem/error.
    Last edited by bjornkn; 14 February 2011 at 10:17 AM.

  4. #14
    Join Date
    Feb 2011
    Posts
    3

    Default Re: Adding php files.

    Ok, thank you!

  5. #15
    Join Date
    Dec 2010
    Location
    Kristiansand, Norway
    Posts
    165

    Default Re: Adding php files.

    Good luck!

  6. #16
    Join Date
    Feb 2011
    Posts
    3

    Default Re: Adding php files.

    One last question, bjornkn when you set up your script what ports did you use and where did you type them into in the php files?

  7. #17
    Join Date
    Dec 2010
    Location
    Kristiansand, Norway
    Posts
    165

    Default Re: Adding php files.

    I didn't set up anything, but just used the example.php file that came with the package.
    Right at the top (l10) there is an array declaration:

    Code:
    $servers = array(
        'server 1' => array('quake3', '194.109.69.61'),
        'server 2' => array('cssource', '194.109.69.51', 27015),
        'server 3' => array('bf2142', '194.109.69.21'),
        'server 4' => array('ts3', 'voice.planetteamspeak.com')
    );
    And in that list.php there are all the supported servers/ports?

 

 

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •