简体   繁体   中英

How to send data from a client to my server without fake data?

How can I send data from a client (user) to my server safely without the possibility of fake data being sent to my server then into my database?

For example, let's say I made a program that plays a game and I want it to track stats of my user.

The game is redistributed with code to track the users progress then sends their progress to my server.

With this in mind, how can I prevent users from sending FAKE data to my server by decompiling my program and checking what the code was to send data to my server

Make the game server authoritative, meaning the client side only handles is the controls (movement, actions etc.), and all stat tracking and computation is handled on the server side. That way, the only fake data the client can send is user actions. Don't use the client side to track the stats of the user, only use it to display the stats.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM