I have created a JavaScript game using the HTML5 canvas tag that communicates with a server through AJAX to update the database. The issue I am facing is that users are able to manipulate data sent to the server, potentially leading to unauthorized actions.
Currently, everything is validated on the server side, with actions being executed based solely on the ID sent by the user. However, this opens up the possibility of users sending fraudulent IDs (such as someone else's) to carry out actions they should not have access to.
To address this concern, I plan to leverage the 'LoginSession' table in my database, which records user IDs along with their signed-in date, signed-out date, and IP address. My solution involves cross-referencing the current IP address of the requester with the IP address associated with their ID in the 'LoginSession' table.
My main question now is whether checking the user's IP against the stored IP is an effective strategy. Can IPs change during a session? Is it possible for users to spoof or manipulate their IP addresses to match an existing one?
While all input is validated on the server side and stored safely in the database, the challenge remains in preventing users from gaining an advantage by logging in multiple times simultaneously.