Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.0k views
in Technique[技术] by (71.8m points)

php - Securing javascript game timing

I'm creating a canvas-based game that has an important timing element to it. Upon completion of the game, the user's completion time is to be sent to PHP/MySQL on the server for comparison with other players.

Server-side timing (i.e. begin request time to submit request time) seems like it could introduce load times as affecting the user's actual time and therefore inefficient in this case.

What I'm having trouble with is determining a way to assure that the time sent is legitimate. How can I stop someone from using their console and editing the client-side code in such a way as to submit a false time?

Any help would be greatly appreciated.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

You can't. Never trust the client. Every request to your server could be spoofed.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...