Checking on the client side just allows you to avoid the client’s transition, but I filled it all out and he didn’t tell me anything! "It’s not really necessary, and actually checking on the client side is a very new thing (read: 5 years or less). In practice, everything that it does does not allow your client (with JS support) to find out whether the form is good before reloading the page. If AJAX is in the game, it is different - it allows you to save bandwidth and provide the user with feedback before submitting. Finally, if you create strictly client, peer-to-peer exchange applications (think about games), you want to check on the client side so that customers do not cheat.
Server-side validation is also crucial because client-side validation can be completely bypassed by disabling JavaScript. In a sense, JS-driven validation is a convenience and aesthetic / cosmetic enhancement that cannot be relied on. It’s also trivial to edit the page source locally to disable or bypass even the most complex JS check.
What can a user do if you do not check the server side? Everything, depending on how you use your data. You can let users drop entire databases (or, even worse, console them), change whatever they like (or, worse, read everything they like). Directory traversal errors are very common entry points for naughty people) and, if necessary, increase their privileges. Do you want to manage this risk? Not confirming user input is like trusting people, and not setting locks in your home.
Sebastien renauld
source share