我想問問JS 做表單驗證, 還是交曬比PHP做?

本帖最後由 student_abc 於 2014-11-22 17:53 編輯

I am developing  the black end system.



我想問問JS 做表單驗證, 還是交曬比PHP做?

我無咩做黑暗端系統ge經驗,但應該兩邊都要做

TOP

php一定要做,因為有辦法忽略HTML的js
JS for user experience

TOP

我有做黑暗端系統ge經驗,要安全既話,表單一定要交比PHP (Server Side)做驗證,Fun End 可以用JS/HTML做驗證 或姐 唔做都得

TOP

black end system 黑暗端系統

TOP

做曬2次
另外應該每過一次頁都要再做

TOP

回覆 1# student_abc

Rule of thumb:
Frontend validation for user experience (aiding user to fill in data correctly)
Backend validation for actual data verification.

It is possible to by-pass frontend validation.
for example, by browser developer tools
or build & send request from other programs like curl, REST  API tool, or even telnet

Therefore, to your question, ideally do both,  but backend validation is a must

TOP

Backend must do validation. For front-end, do the validation if you are concerning about user experience.

TOP

Ok easy. you should open the browser to say i want use JS 做表單驗證 and php handle the reset, the browser will do all the thing to you.. like all the head and boss do lo.

TOP

common practice 係 both frontend 同 backend 都要做 validation.

TOP