Take the following update:
The OP suggested security through obscurity and the editor amended the answer to remove the OP's update. Now, I agree with the editor that this is a bad practice but I'm unsure whether their action was the correct one.
In these scenarios isn't the norm to leave a comment/show your disapproval through voting rather than amending the OP's answer to suit what you want, irrespective of the validity of the edit in a technical sense, or, is what the editor did fine?
htmlspecialchars
should solve majority of your issues.[sql-injection]
; only a day later did the OP add[xss]
. The answer never explains the purpose of base64 encoding. It seems obvious to me that it's potentially useful as a way of storing arbitrary data in a DB without ever sending anything but plain text through SQL queries, not for defending against people stealing your database. And like I said, getting "nasty" data safely into your database with a prepared statement isn't always sufficient: 2nd-order SQL injection can attack unsafe interactive use of that data.