0
我有意见这个WordPress的形式,这是非常标准:是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-评论-post.php中。这是安全的开箱即用Wordpress还是我应该添加代码来防止通过我的评论表单进行攻击?
所以我把下面的第一场在我的形式是这样的:
是的,你也应该确保你正在验证nonce。您应该使用此代码验证您的随机数:if( !isset($ _POST ['my_nonce_name'])||!wp_verify_nonce($ _POST ['my_nonce_name']'my_nonce_action'){print'Sorry,your nonce没有核实。';出口; } else {//你的代码验证成功} – MMK 2015-03-02 15:58:14
这样做,在我的comments.php文件的顶部? $ retrieve_nonce = $ _REQUEST ['_ wpnonce'];如果(!wp_verify_nonce($ retrieve_nonce))死('失败的安全检查'); – 2015-03-03 13:54:45