User Tag List

Page 1 of 4 1 2 3 ... LastLast
Results 1 to 10 of 32

Thread: Counting button taps

  1. #1
    Clicker Multimedia Fusion 2iOS Export ModuleSWF Export Module

    Join Date
    May 2008
    Posts
    251
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Post Counting button taps

    Hi all, I want to make an app that will add to an online counter every time it is tapped by a user. I also want a counter to show how mny times it has been clicked by people who use the app. I'm guessing i'd have to use the GET object or something. Can someone please point me in the right direction. If you have any questions about it, let me know. :-)

  2. #2
    Clicker Fusion 2.5 DeveloperiOS Export ModuleSWF Export Module

    Join Date
    Sep 2011
    Location
    Germany
    Posts
    31
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yes you have to use the GET object, JosephFTaylor...

    Furthermore you need a database (best option) or a simple text file on a webserver where you can store and count the button taps...
    So with the GET object you send data through the URL and parameters (GET or POST) and on your server you recieve the data.
    You will need a PHP script (i.e. "counter.php") to manipulate the text file or database.
    Your app will only initiate the process and the PHP-file does the rest .
    With "echo" or "print" (in PHP) you get back the counter information which is stored on your server.

    If you aren´t familiar with PHP I can help you and attach an example file.

  3. #3
    Clicker Multimedia Fusion 2iOS Export Module

    Join Date
    Apr 2009
    Posts
    157
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    http://community.clickteam.com/showthread.php?t=69985

    Take a look here. This was for a counter using an SQL database and the GET extension.
    You can just change the update procedure from being on each unique start up to your button click.

  4. #4
    Clicker Multimedia Fusion 2iOS Export ModuleSWF Export Module

    Join Date
    May 2008
    Posts
    251
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks you two, I'm currently having a play around and brushing off my basic PHP skills. I'm trying to devise a plan on how I would remove the player's count after 5 seconds. I don't want to retrieve the value and subtract 1 from it and then send that back to the server, because the slim chance there is, more than one people would be doing that request at the same time.

  5. #5
    Clicker Multimedia Fusion 2iOS Export ModuleSWF Export Module

    Join Date
    May 2008
    Posts
    251
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Maybe an easier way to explain it and for the sake of making any examples you rustle up easier, you could make a 'Current Online Users' count, have it add 1 to the count on launch and then subtract 1 from the count when they leave/get disconnected. This isn't what I'll be doing though. I just though it might explain it easier.

  6. #6
    Clicker Multimedia Fusion 2iOS Export ModuleSWF Export Module

    Join Date
    May 2008
    Posts
    251
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I'm no PHP genius but looking at the PHP code, I've noticed a + 1 bit, would I just replace the + 1 with - 1 and give it another name so I can shoot the request to run that action from the app?

    if ($_GET["onlinestatus"])
    {
    $sqlselect=mysql_query("SELECT * FROM $table"); //$table should be changed to your table name.
    $array5=mysql_fetch_array($sqlselect);
    $downloads=$array5['$column'];
    $newdownloads = $downloads + 1;
    $sqlupdate=mysql_query("UPDATE $table SET $column = $newdownloads"); //$column should be changed to your column name.
    exit;
    }

  7. #7
    Clicker Fusion 2.5 DeveloperiOS Export ModuleSWF Export Module

    Join Date
    Sep 2011
    Location
    Germany
    Posts
    31
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by JosephFTaylor
    I don't want to retrieve the value and subtract 1 from it and then send that back to the server, because the slim chance there is, more than one people would be doing that request at the same time.
    The server will complete the first task before it goes on with the other request...
    On every webpage (for example on webpages with a shoutbox) there would be this problem if the server completes tasks at the same time.

    Quote Originally Posted by JosephFTaylor
    I'm no PHP genius but looking at the PHP code, I've noticed a + 1 bit, would I just replace the + 1 with - 1 and give it another name so I can shoot the request to run that action from the app?
    PHP Code:
    if ($_GET["onlinestatus"])
    {
    $sqlselect=mysql_query("SELECT * FROM $table"); //$table should be changed to your table name.
    $array5=mysql_fetch_array($sqlselect);
    $downloads=$array5['$column'];
    $newdownloads $downloads 1;
    $sqlupdate=mysql_query("UPDATE $table SET $column = $newdownloads"); //$column should be changed to your column name.
    exit; 
    }
    In this case you need a database to connect with...
    Here is your customized PHP script:
    PHP Code:
    <?php
    if (isset($_GET["onlinestatus"]) && ($_GET["onlinestatus"] == true))
    {
    mysql_connect("localhost""username","password") or die ("connection failed."); //Connect with the sql-database
    mysql_select_db("database") or die ("database does not exist.");

    $sqlselect=mysql_query("SELECT * FROM $table"); //get all the content of one table 
    $array5=mysql_fetch_array($sqlselect); //...and store it in an array
    $online_users=$array5['$column']; 
    $new_online_users $online_users 1
    $sqlupdate=mysql_query("UPDATE $table SET $column = $newdownloads"); //get the value of the online counter, subtract one from it and update the database
    mysql_close();
    ?>
    So now if you call the function within your app (with the GET method: "http://www.your-site.com/index.php?onlinestatus=true") you get no value back but the counter in your database gets lowered...
    I hope that I heven´t misunderstood your problem

  8. #8
    Clicker Multimedia Fusion 2iOS Export ModuleSWF Export Module

    Join Date
    May 2008
    Posts
    251
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Okay, now I'm confused and to make it even worse, I can't seem to get anything working, it says it's connected but it doesn't do anything.

  9. #9
    Clicker Fusion 2.5 DeveloperiOS Export ModuleSWF Export Module

    Join Date
    Sep 2011
    Location
    Germany
    Posts
    31
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Sorry for confusing xD
    So you have a real database and a webserver and you have customized the code I posted above?
    You changed some vars in this code?
    And as I said already you won´t SEE anything within your app cause the webpage will be empty if there is no error message...
    In your database you will see that the counter gets lowered if the GET object sends the parameter (in this case "onlinestatus=true") to the server.

  10. #10
    Clicker

    Fusion 2.5 MacFusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleSWF Export ModuleUnicode Add-onInstall Creator Pro
    StingRay's Avatar
    Join Date
    Nov 2006
    Location
    Austria
    Posts
    1,057
    Mentioned
    7 Post(s)
    Tagged
    0 Thread(s)
    Hi Atrox! Would it be possible with get and php to add some Facebook functionality to iOS Apps?

Page 1 of 4 1 2 3 ... LastLast

Similar Threads

  1. Button is clicked condition works even when button disabled - Beta9
    By AyreGuitar in forum iOS Export Module Version 2.0
    Replies: 0
    Last Post: 29th May 2012, 02:29 PM
  2. Do you start counting from zero or one?
    By Grim_Jester in forum Multimedia Fusion 2 - Technical Support
    Replies: 15
    Last Post: 6th April 2012, 04:30 PM
  3. counting objects of a certain value?
    By Bigfoot in forum iOS Export Module Version 2.0
    Replies: 2
    Last Post: 1st February 2012, 07:32 PM
  4. Counting Fun
    By Jakinbandw in forum File Archive
    Replies: 3
    Last Post: 17th January 2009, 12:05 AM
  5. Counting how many...
    By MechatheSlag in forum Multimedia Fusion 2 - Technical Support
    Replies: 3
    Last Post: 17th October 2006, 09:36 AM

Posting Permissions

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