User Tag List

Results 1 to 7 of 7

Thread: Double post score with Get Object on Android Only

  1. #1
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleUniversal Windows Platform Export ModuleXNA Export Module
    Dobermann's Avatar
    Join Date
    Feb 2009
    Location
    France
    Posts
    280
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Double post score with Get Object on Android Only

    I have a game that i designed for windows phone, i want to port it to android and i have only one problem, the online leaderboard always post 2 time the same score with the same timestamp when the game submit a new score from my android phone. On my computer it works perfectly, and it always worked fine on windows phone, so is this a bug of android?

    My PHP files look like this :

    Code:
    <?php
    
        include('config.php');
    
        $bd = mysql_connect(HOST, USER, PASSWORD);
        mysql_select_db(DATABASE, $bd);
    
        if (isset($_GET['name'], $_GET['score'], $_GET['key']))
        {
            $name = stripslashes($_GET['name']);
            $score = stripslashes($_GET['score']);
            $key = stripslashes($_GET['key']);
    
            function insertNewUser($name, $score)
            {
                mysql_query("INSERT INTO spacerabbit VALUES('', '" . $name . "', '" . $score . "', now())");
                $lastId = mysql_insert_id();
                return $lastId;
            }
    
            if (md5($name . $score . "spacerabbit") == $key)
            {
                if (isset($_GET['id']) && is_numeric($_GET['id']))
                {
    				$id = stripslashes($_GET['id']);
    				
                    mysql_query("UPDATE spacerabbit SET name='" . $name . "', score='" . $score ."' WHERE id ='" . $id . "'");
                    if (!mysql_affected_rows())
                        echo insertNewUser($name, $score);
                    else
                        echo $id;
                }
                else
                    echo insertNewUser($name, $score);
            }
        }
    
        mysql_close();
    And in my game i do a "start of frame" condition to Get this PHP file to work.

    I'm really lost with this bug...

  2. #2
    Clickteam Clickteam
    Fernando's Avatar
    Join Date
    Dec 2006
    Posts
    4,928
    Mentioned
    3 Post(s)
    Tagged
    1 Thread(s)
    mm I think the error are

    if (!mysql_affected_rows())

    should be

    if (!mysql_affected_rows($bd))

    to correctly know which connection is related to

    this also apply to

    mysql_query("UPDATE


    should be

    mysql_query($bd, "UPDATE

    now we sure the results are referenced to the connection was opened
    Regards,


    Fernando Vivolo

    ... new things are coming ...

  3. #3
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleUniversal Windows Platform Export ModuleXNA Export Module
    Dobermann's Avatar
    Join Date
    Feb 2009
    Location
    France
    Posts
    280
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Fernando View Post
    mm I think the error are

    if (!mysql_affected_rows())

    should be

    if (!mysql_affected_rows($bd))

    to correctly know which connection is related to

    this also apply to

    mysql_query("UPDATE


    should be

    mysql_query($bd, "UPDATE

    now we sure the results are referenced to the connection was opened
    Thank you, i did the changes but the problem is still here... The score are posted twice, with two different ID (as i use auto-incremetation), the same name, the same score and the same timestamp... The game receive the second ID, not the first like if it was the game that was asking to enter the score 2 times.

    I have no problem on Windows and never got any problem on XNA and windows phone.

  4. #4
    Clickteam Clickteam
    Fernando's Avatar
    Join Date
    Dec 2006
    Posts
    4,928
    Mentioned
    3 Post(s)
    Tagged
    1 Thread(s)
    do me a favor post a small mfa for me to test
    Regards,


    Fernando Vivolo

    ... new things are coming ...

  5. #5
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleUniversal Windows Platform Export ModuleXNA Export Module
    Dobermann's Avatar
    Join Date
    Feb 2009
    Location
    France
    Posts
    280
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Sure, here is a small MFA with the post methode to insert a score and a frame to show the leaderboard, it bugs only on Android...

    http://dobermannstudios.com/files/test-leaderboard.mfa

  6. #6
    Clickteam Clickteam
    Fernando's Avatar
    Join Date
    Dec 2006
    Posts
    4,928
    Mentioned
    3 Post(s)
    Tagged
    1 Thread(s)
    I see the issue please post a bug report for this

    thanks
    Regards,


    Fernando Vivolo

    ... new things are coming ...

  7. #7
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleUniversal Windows Platform Export ModuleXNA Export Module
    Dobermann's Avatar
    Join Date
    Feb 2009
    Location
    France
    Posts
    280
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You think it comes from the Get runtime for android ?

Similar Threads

  1. Get Object Android - Post utf8mb4 emojis
    By AlanRuno in forum Android Export Module 2.5
    Replies: 5
    Last Post: 20th May 2017, 12:19 AM
  2. Hi Score Object In Android
    By Megabeard in forum Android Export Module 2.5
    Replies: 7
    Last Post: 11th March 2016, 03:00 PM
  3. Replies: 3
    Last Post: 28th September 2015, 09:35 AM
  4. Double score ?
    By Owling2005 in forum Multimedia Fusion 2 - Technical Support
    Replies: 3
    Last Post: 16th December 2013, 02:55 PM

Posting Permissions

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