How to accept programming code input to display goals?

What is the safest way to accept user-entered program code in PHP, save it in a database and display it using the HTML pre-tag?

I am currently converting input to HTML objects, but for some reason I think it will not be so simple ...

Any suggestions?

+3
source share
1 answer

Programming code is just text; if it is not executed, there can be no harm.

This means that you are concerned:

  • SQL-. , (mysql_real_escape_string()) .

  • XSS. html- (: htmlspecialchars()), ( : <script>) (: &lt;script&gt;).

+5

Source: https://habr.com/ru/post/1766869/


All Articles