wordpress评论表单安全吗?
Is wordpress comment form safe?
我有这个用于评论的 Wordpress 表单,它非常标准:
<form action="http://sitename.com/wp-comments-post.php" target="writeIframe" method="post" id="commentform" class="comment-form">
<p class="comment-form-author">
<label for="author">Your name</label>
<input id="author" name="author" type="text" value="" size="30">
</p>
<p class="comment-form-comment">
<label for="comment">Comment</label>
<textarea id="comment" name="comment" cols="45" rows="8" aria-required="true"></textarea>
</p>
<p class="form-submit">
<input name="submit" type="submit" id="submit" class="submit" value="Send">
<input type="hidden" name="comment_post_ID" value="1" id="comment_post_ID">
<input type="hidden" name="comment_parent" id="comment_parent" value="0">
</p>
</form>
它将用户输入数据发送到隐藏 iframe 内的 wp-comments-post.php。这是开箱即用的 Wordpress 安全还是我应该添加代码以防止通过我的评论表单进行攻击?
您是否看过使用 wp_nonce_field()。
这是 WordPress 法典的内容:
随机数是 "number used once" 以帮助保护 URL 和表单免受某些类型的滥用。
所以我一定会建议您看一看并使用它。
转到此手抄本页面了解更多信息:
http://codex.wordpress.org/WordPress_Nonces#Adding_a_nonce_to_a_form
请阅读将随机数添加到表单部分
我有这个用于评论的 Wordpress 表单,它非常标准:
<form action="http://sitename.com/wp-comments-post.php" target="writeIframe" method="post" id="commentform" class="comment-form">
<p class="comment-form-author">
<label for="author">Your name</label>
<input id="author" name="author" type="text" value="" size="30">
</p>
<p class="comment-form-comment">
<label for="comment">Comment</label>
<textarea id="comment" name="comment" cols="45" rows="8" aria-required="true"></textarea>
</p>
<p class="form-submit">
<input name="submit" type="submit" id="submit" class="submit" value="Send">
<input type="hidden" name="comment_post_ID" value="1" id="comment_post_ID">
<input type="hidden" name="comment_parent" id="comment_parent" value="0">
</p>
</form>
它将用户输入数据发送到隐藏 iframe 内的 wp-comments-post.php。这是开箱即用的 Wordpress 安全还是我应该添加代码以防止通过我的评论表单进行攻击?
您是否看过使用 wp_nonce_field()。
这是 WordPress 法典的内容:
随机数是 "number used once" 以帮助保护 URL 和表单免受某些类型的滥用。
所以我一定会建议您看一看并使用它。 转到此手抄本页面了解更多信息:
http://codex.wordpress.org/WordPress_Nonces#Adding_a_nonce_to_a_form
请阅读将随机数添加到表单部分