我正在寻找从网页中过滤输入html文本的最好方法,并保留文本格式,剥离标签和其他危险标签,同时仍然防止mysql注入。
示例:
输入
<p>I'm new here and i dont know much about php programming</p>
<a href='maliciousWebsite.com'>Click here!</a>
'MYSQL INSTRUCTIONS TO GET THE WHOLE DB
输出
<p>I'm new here and i dont kno
我有一个博客系统,用户必须将内容输入到html文本区,包括<p>等html标签。这被存储在数据库中。如果此输入随后使用php回显到网页,我如何才能转义输出以防止XSS,同时保留html标记的含义,以便正确格式化博客帖子?如果我使用htmlentities($blog_content),它会直接把html标签打印到页面上,所以你会看到<p>hello this is a blog</p>。
这个是可能的吗?
我想允许用户add link in text, <b> and <code>,所以我这样做了:
$texto = nl2br($texto);
$texto = strip_tags($texto, "<br><a><b><code>");
这将允许用户输入类似以下内容:
<b>Some</b> text <a href="/someurl">Link</a> and
<code>
<?php
echo ""
我想将自动增量ID添加到 我在tinymce编辑器中保存的任何文本中的标签(或任何标签)。例如: <p> Hey </p>
<p> This is an example </p>
<p> Thanks </p>
I want this to be stores in the db as:
<p id=1> Hey </p>
<p id=2> This is an example </p>
<p id=3> Thanks </p> 有没有办法在Ti