<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ThinkChat2.0新版上線,更智能更精彩,支持會話、畫圖、視頻、閱讀、搜索等,送10W Token,即刻開啟你的AI之旅 廣告
                為了安全起見,生成用于驗證請求的起源和意圖的生成數字。 每個隨機數只能使用一次。 如果您的插件允許用戶提交數據; 無論是在行政部門還是公共方面; 您必須確保用戶是他們所說的,他們具有執行操作的必要功能。 同時進行這兩項意味著數據只會在用戶期望更改時發生變化。 ##使用Nonces 按照我們檢查用戶功能的示例,用戶數據提交安全性的下一步是使用隨機數。 功能檢查確保只有具有刪除帖子權限的用戶才能刪除帖子。但是如果有人欺騙你點擊那個鏈接呢?你有必要的能力,所以你可以不經意地刪除一個職位。 可以使用Nonces來檢查當前用戶是否實際打算執行該操作。 當您生成刪除鏈接時,您將需要使用wp_create_nonce()函數將一個隨機數添加到鏈接中,傳遞給該函數的參數可確保正在創建的隨機數對該特定操作是唯一的。 然后,當您處理刪除鏈接的請求時,可以檢查該隨機數是您期望的內容。 有關更多信息,馬克·賈奇斯(James Jaquith)在WordPress中的發布是一個很好的資源。 ##完整例子 使用功能檢查,數據驗證,安全輸入,安全輸出和隨機數的完整示例: ``` <?php /** * generate a Delete link based on the homepage url */ function wporg_generate_delete_link($content) { // run only for single post page if (is_single() && in_the_loop() && is_main_query()) { // add query arguments: action, post, nonce $url = add_query_arg( [ 'action' => 'wporg_frontend_delete', 'post' => get_the_ID(), 'nonce' => wp_create_nonce('wporg_frontend_delete'), ], home_url() ); return $content . ' <a href="' . esc_url($url) . '">' . esc_html__('Delete Post', 'wporg') . '</a>'; } return null; } /** * request handler */ function wporg_delete_post() { if ( isset($_GET['action']) && isset($_GET['nonce']) && $_GET['action'] === 'wporg_frontend_delete' && wp_verify_nonce($_GET['nonce'], 'wporg_frontend_delete') ) { // verify we have a post id $post_id = (isset($_GET['post'])) ? ($_GET['post']) : (null); // verify there is a post with such a number $post = get_post((int)$post_id); if (empty($post)) { return; } // delete the post wp_trash_post($post_id); // redirect to admin page $redirect = admin_url('edit.php'); wp_safe_redirect($redirect); // we are done die; } } if (current_user_can('edit_others_posts')) { /** * add the delete link to the end of the post content */ add_filter('the_content', 'wporg_generate_delete_link'); /** * register our request handler with the init hook */ add_action('init', 'wporg_delete_post'); } ```
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看