Need a little help with scores

0 favourites
  • 4 posts
From the Asset Store
Game with complete Source-Code (Construct 3 / .c3p) + HTML5 Exported.
  • Hi there guys!

    I could really use some help, hope one of you has got a minute :)

    (I'm a designer, but total non-programmer making a fun game for my personal website)

    What I've been struggling to do for the past few hours is add up everyone's scores in a flatfile using PHP. I just can't get the hang of it.

    I wanna make a scores file starting at 0, and everytime someone plays my game and gets, say, 3000 points, I want to add that to the number already in the file. Then retrieve the sum and show it in the game.

    Something like "1000000 points have been scored until now".

    I just can't get the hang of it. Arrrgh so frustrating I can't do a simple addition because I know absolutely no PHP. Pretty please help me?

    Excuse my English. I'm from Russia . <img src="smileys/smiley9.gif" border="0" align="middle" />

  • <?php

    $file = "c:\users\user\scorefile.dat";

    $score = $_GET['score'];

    $total = file_get_contents($file);

    $total += $score;

    file_put_contents($file, $total);


  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • have to call page from your game somehow like this

    but currently full of security holes e.g. anyone can post a score not just your game. May have to have game supply a secret key along with score

  • Thank you so very very much! It's all right, i'm sure my visitors aren't so interested in cheating at my game :)

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)