Answer the question
In order to leave comments, you need to log in
What is better, to save the user's post to the database by executing htmlentities() or not?
If not done, then we do EVERY TIME when visitors open a forum topic! This load on the server!!!!!!!!!!!!!!!
If done - what to do when the user tries to edit his post? after all, as far as I understand, the user needs the original text and not the text with extra characters that htmlentities () made
Answer the question
In order to leave comments, you need to log in
Most templating engines like twig always do something like <?php echo htmlspecialchars($var, ENT_QUOTES, 'UTF-8') ?> on output. So do not worry, the load on the server is small.
Always keep the original text.
The parsed one can be cached. (although the costs for htmlentites/ htmlspecialchars are very small)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question