0

I have a website where users can bet on specified coin they think it will win.
I have TT(1-7), CT(8-14) and DRAGON(0). Pretty roulette-based.
So, basically, users on my site can right click > inspect element > console and paste this command: send({"type" : "bet", "amount": "1e+2", "lower": 1, "upper" : 7, "round" : ROUND});
This command will bet amount 1e+2 (which is not valid) on TT which is (1-7), on execute.
Website will display that the bet only 1 credit, but they actually really put literally 1e+2 amount. Also, if they win, they are getting like 15000+ credits, insead of 2, because TT and CT coins just double your bet amount, while DRAGON do 14x.
Is there any way to disable console, disable console input, or something like that? I know its fixable, just not sure on which way.
Edit: additional informations: when user try to bet 1e+2 amount on valid-way, with the input box on my site, it will say it's not valid amount, but for console its not working. Also, its not just 1e+2 they can do like 2e+51 or just some random numbers and signs.

Bog Otac
  • 15
  • 5
  • 1
    You can't disable the console. –  Jun 13 '17 at 11:10
  • hmm im pretty sure its fixable, just dont know on which way. – Bog Otac Jun 13 '17 at 11:12
  • 2
    You can never trust anything that originates from a client & you can never make a client trustworthy. You should be running whatever checks are needed on the server and deciding if the request is legitimate there. – Alex K. Jun 13 '17 at 11:12
  • Well, Server checks valid-way bets, but no idea how can I make it check console-sided bets. – Bog Otac Jun 13 '17 at 11:52
  • If you don't know how to get your server to check those bets, you need to hire a programmer who does. **It is impossible to stop the user from submitting invalid/fraudulent data to your server.** Your server must be alert for such data. – Brock Adams Jun 13 '17 at 19:34

1 Answers1

1

You have to check on the server whether a sent request is valid. Always assume that every client tries to attack you. Client-sided inputs can be changed very easily.

EDIT: In PHP, you can validate the input like this:

if(preg_match("[0-9]", $sent_input) {
    // valid input, execute the code
} else {
    die("Invalid input");
}
StuntHacks
  • 457
  • 3
  • 15