im working on a single player game in java and want to add a high scores table. what im thinking is when a player finishes a session my script will contact my server like this "mywebsite.com/sethighscore.php?secretkey=23234234&user=bob&itemscollected=45&timeplayed=1hour" <-- this would add a new user to database
i have very little knowledge of php and mysql so anything helps
the secretkey will make it so players cant cheat- there is only one secret key
"user" is the players name
itemscollected is the number of items that player collected that round
timeplayed will be calculated with java's timer
.
.
the script should also know if a user is already in the mysql database and not overwrite it, unless its to update a score.
.
.
the items collected wouldn't be reset. so if bob collected 45 in game session 1 itemscollected=45
but then in game session 2 bob collected 30 then itemscollected=75
.
.
.
then i want to make it so that i can get a players info like this:
"mywebsite.com/gethighscore.php?user=bob&info=itemscollected"
this would display bob's collected items "45"
or
"mywebsite.com/gethighscore.php?user=bob&info=timeplayed"
this would display"1hour"
or
"mywebsite.com/gethighscore.php?user=bob&info=name"
this would display bob's name "bob"
or
"mywebsite.com/gethighscore.php?user=bob&info=all"
this would display "Items collected:45 Time Played:1 hour"
each players info would be stored in a mysql database.
then if the url = "mywebsite.com/gethighscore.php?stat=collected"
then it would display all the users items collected combined
or
if the url = "mywebsite.com/gethighscore.php?stat=time"
then it would display all the users playing time combined
thank you