I have a user registration form using PHP & MySQL & jQuery.
What is the best way to limit user input to 120 chars.
1st) Using a field type like VARCHAR with 120 chars (length) and let the MySQL do the “dirty” job.
2nd) Using PHP substr.
or sth else…
Always having in mind:
1) Performance – Resources usage
2) Efficient
3) Safety – Vulnerabilities
For user comprehension : Limit in the GUI
For safety from data you receive : Limit in Php.
For safety from other programmers : Limit in SQL