Keep in mind: Nothing on the player's computer should be trusted. Your game is your enemies hands, it is compromised. The perfect anti-cheating system doesn't exist if you have a dedicated hacker in front of you.
** I suggest to "record" your games and send it to the server (the inputs) so you can "replay" the game and check if the score is good. You can save random_seeds, save every move (ex: chess game), then replay it later. **
The next option is a bit more risky. The hash key is "obfuscation", which means "confusion" but it's not really unhackeable 100%.
Maybe this helps for hash:
construct.net/en/forum/extending-construct-2/addons-29/plugincb-hash-md5-sha-1-sha-39765
If you have: Andy 30, Brad 25, Charly 25, David 20, Edgar 15, Frank 15, George 15, Helen 10
- getrank.php?score=20 (for David) will return Rank #4 ("there are 3 better scores")
- getrank.php?score=15 (for Frank) will return Rank #5 ("there are 4 better scores." This ignores other people with same score -15-. In other words, it ranks you as the best in your same score. With 15 points your rank could be #5, #6 or #7. You can also make ALL of them with score=15 rank "5th")
This is like some top scores looking like this:
1 Andy
2 Brad
2 Charly
4 David
5 Edgar
5 Frank
5 George
8 Helen
When happened this error? Can you post a screenshot?
Check the new attachments in this tutorial. I have uploaded a 'getrank.php' ;)
To use it you call it like described in page 4 of this tutorial! :)
Updated 2020! Hope it helps. Let us know!
Try with these PHP files: duquekarlgames.000webhostapp.com/2020_php7.zip
Edit the login.php with your DB_Username, db_pwd, etc
Replace the "login.php" data with your own DB_username, db_pwd, etc.
Let me know if this works
Can you copy here the error message?
Check that you are using "mysqli_connect()"
("sqli_" is OK - "sql_" is bad)
(Continued...)
Changes in getrank.php:
1)
$sql = "SELECT COUNT(*) AS rank FROM scores WHERE score > " . $_GET['score'] . " GROUP BY name";
2)
In the while loop remove the "echo part". Outside of the loop, print i:
echo ($i + 1);
There are a few ways to do this.
Here is one idea:
Check the current getScores.php. Copy the PHP file and rename to getRank.php
When you call this PHP, check the DataBase and return a Number (the player RANK).
How?
When calling getRank you need to send a parameter. So the PHP code knows what to look for inside the DB.
One option is to use a UserName or Email, whatever "unique" identifier of the current player. The PHP would be called like this: "www.URL.com/getRank.php?playername=john"
It must return, for example: "99"
MY CHOICE. The second option.
Call the PHP using your best score, and the PHP code will check HOW MANY people have a better score than YOU.
Example: "www.URL.com/getRank.php?score=75"
The PHP code checks how many players have a better score than 75 and will return:
98
So you know that you are #99 in the rank
Maybe you used phps.zip (this is for PHP 5) that is deprecated if your server is using PHP 7. For PHP 7 try the php7.zip files
Member since 10 Mar, 2015