PHP XSS Question / Clarification -


Previously asked, but I need 100% clarity on this issue because it is very important to be right for me is.

Status: A messaging system on the website enters a message in a text box, then it submits the form and it enters the database. This data can then be called from the database and & lt; Span & gt; can be displayed to another user in the tag.

What protection process do I need to prevent this data from being malicious? I already use mysql_real_escape_string to prevent any injection and strip_tag seems useful but I have mentioned many other names. & lt; Span & gt; What do I need to use to keep this data safe due to appearing in tag

? The incorrect assumption is that you want to avoid input, which is wrong.

You must filter out the output (and the database is also output)

This means that when the form is stored, you can use the mysql_real_escape_string () to send the database (output) data , And you use htmlspecialchars () to output the content on the screen, the same principle applies to regular expression, where you preg_quote () , And so on

It does not matter if Where is it coming from, you have to save from the place where you are sending it.

To prevent XSS attacks, you must Htmlspecialchars () / homelandity () . mysql_real_escape_string is nothing to do with the XSS (but it also needs to be used even when you send data to the database).

Comments

Popular posts from this blog

mysql - BLOB/TEXT column 'value' used in key specification without a key length -

c# - Using Vici cool Storage with monodroid -

python - referencing a variable in another function? -