Free php script!

Discussion in 'PHP' started by satyrion, Oct 21, 2007.

  1. #1
    I need a free phpscript that counts how many people played games on my game site. Anyone know where i can get this?
    and is it possible to use PHP script like this with no database?
     
    satyrion, Oct 21, 2007 IP
  2. nickstan

    nickstan Peon

    Messages:
    781
    Likes Received:
    31
    Best Answers:
    0
    Trophy Points:
    0
    #2
    which game? Different games uses different tracking
     
    nickstan, Oct 21, 2007 IP
  3. LosTFacE

    LosTFacE Peon

    Messages:
    72
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Provide more information.
     
    LosTFacE, Oct 21, 2007 IP
  4. satyrion

    satyrion Active Member

    Messages:
    1,204
    Likes Received:
    42
    Best Answers:
    0
    Trophy Points:
    90
    #4
    DO you have anything to recomend me? The games are Flash games SWF files.
     
    satyrion, Oct 21, 2007 IP
  5. Koster

    Koster Guest

    Messages:
    19
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    There are no scripts you need.
    Write it for yourself.
    For example, when user connected to the game, send the "message" to some php script which counts it.

    Like this:
    flash-games.swf
    onClipEvent (load) {
    loadVariables("http: //supersite.com/count.php", this, "GET");
    }

    Into count.php insert some counter:
    $filename = "counter.dat";
    $handle = fopen($filename, "r");
    $count = fread($handle, filesize($filename));
    fclose($handle);
    
    $handle = fopen($filename, 'a');
    fwrite($handle, ++$count);
    fclose($handle);
    PHP:
    It is code only for example...
     
    Koster, Oct 21, 2007 IP
  6. Koster

    Koster Guest

    Messages:
    19
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Some more information!
    Tutorial - Hit Counter using PHP & Flash
    http webwasp.co.uk/tutorials/b39-hit-counter/index.php
     
    Koster, Oct 21, 2007 IP
  7. phpl33t

    phpl33t Banned

    Messages:
    456
    Likes Received:
    33
    Best Answers:
    0
    Trophy Points:
    0
    #7
    I would just put a sql query to add to a count in the database everytime the page loads. You can even have it insert the game title and game id to narrow down by game, somthing like:

    mysql_query('UPDATE `games` SET `playcount`=(playcount+1), `title`="'.$title.'" WHERE `gid`="'.$gid.'"') or die(mysql_error());
     
    phpl33t, Oct 22, 2007 IP
  8. satyrion

    satyrion Active Member

    Messages:
    1,204
    Likes Received:
    42
    Best Answers:
    0
    Trophy Points:
    90
    #8
    I see, but is it possible to do this with no SQL databse, because i dont like to use database
     
    satyrion, Oct 22, 2007 IP