A proper validation can keep your website safe from hacking.
The solution of this article will centralize the validation logic to sanitize
input data so that anytime this logic can modify which will take effect in the
whole site even within a sec. Also, this technique will help to protect from
not only SQL-injection, but also cross-site scripting (XSS).