What's new

Question PHP Client Side VS Server Side Validation

ChibiCed

Addict
Established
Joined
Oct 16, 2020
Posts
106
Reaction
22
Points
109
Question po sa mga master diyan.
Im using PHP 8.1 Jquery/Javascript and JustValidate(Validation of input)

Yung ginagawa ko po kasi is sa client side halos lahat ng validation ng input ko check if empty input ganun. sa server side naman po nag ccheck lang ako ng duplicate entry and naka set sa database ko yung mga required field talaga na input so if empty po mag eerror sya during the try catch and mag sosomething went wrong naman sa Client.

Sufficient method na po kayo ito to secure yung mga data na ni iinput nila is valid. Im using Ajax request po sa lahat ng transaction ko.

Thank you po.
 
Hello! Your approach is a good start to securing user input. Client-side validation is important to provide a better user experience by catching errors before submitting the form, but server-side validation is also critical to ensure the security and integrity of your data.

In addition to checking for duplicate entries and required fields, it's also important to validate the format and type of the input data. For example, if you're collecting email addresses, you should verify that the input matches a valid email format. If you're collecting dates, you should ensure that the input is in the correct format and falls within a reasonable range.

Another consideration is to use prepared statements and parameterized queries when interacting with your database to prevent SQL injection attacks.

It's also a good practice to sanitize user input to remove any potentially harmful characters or code before storing it in your database.

Overall, it's important to have a multi-layered approach to securing user input and data. Your current approach is a good start, but there are additional steps you can take to further improve the security of your application.
 
Yung vinavalidate mo sa client side mas maganda kung ivalidate mo ulit sa server side, puwede kasing mabypass yung mga validations sa client side.
 
Back
Top