• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP wp_nonce_tick函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中wp_nonce_tick函数的典型用法代码示例。如果您正苦于以下问题:PHP wp_nonce_tick函数的具体用法?PHP wp_nonce_tick怎么用?PHP wp_nonce_tick使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了wp_nonce_tick函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: wp_verify_nonce

 /**
  * Verify that correct nonce was used with time limit.
  *
  * The user is given an amount of time to use the token, so therefore, since the
  * UID and $action remain the same, the independent variable is the time.
  *
  * @since 2.0.3
  *
  * @param string $nonce Nonce that was used in the form to verify
  * @param string|int $action Should give context to what is taking place and be the same when nonce was created.
  *
  * @return false|int False if the nonce is invalid, 1 if the nonce is valid and generated between
  *                   0-12 hours ago, 2 if the nonce is valid and generated between 12-24 hours ago.
  */
 function wp_verify_nonce($nonce, $action = -1)
 {
     $nonce = (string) $nonce;
     $user = wp_get_current_user();
     $uid = (int) $user->ID;
     if (!$uid) {
         /**
          * Filter whether the user who generated the nonce is logged out.
          *
          * @since 3.5.0
          *
          * @param int $uid ID of the nonce-owning user.
          * @param string $action The nonce action.
          */
         $uid = apply_filters('nonce_user_logged_out', $uid, $action);
     }
     if (empty($nonce)) {
         die('<mainwp>' . base64_encode(json_encode(array('error' => 'You dont send nonce: ' . $action))) . '</mainwp>');
     }
     $token = wp_get_session_token();
     $i = wp_nonce_tick();
     // Nonce generated 0-12 hours ago
     $expected = substr(wp_hash($i . '|' . $action . '|' . $uid . '|' . $token, 'nonce'), -12, 10);
     if (hash_equals($expected, $nonce)) {
         return 1;
     }
     // Nonce generated 12-24 hours ago
     $expected = substr(wp_hash($i - 1 . '|' . $action . '|' . $uid . '|' . $token, 'nonce'), -12, 10);
     if (hash_equals($expected, $nonce)) {
         return 2;
     }
     // Invalid nonce
     die('<mainwp>' . base64_encode(json_encode(array('error' => 'Invalid nonce. Try use: ' . $action))) . '</mainwp>');
 }
开发者ID:jexmex,项目名称:mainwp-child,代码行数:48,代码来源:class-mainwp-child.php


示例2: wptouch_create_anonymous_nonce

function wptouch_create_anonymous_nonce($action)
{
    // Creates a valid WordPress nonce for anonymous requests.
    $uid = 0;
    $token = '';
    $i = wp_nonce_tick();
    $nonce = substr(wp_hash($i . '|' . $action . '|' . $uid . '|' . $token, 'nonce'), -12, 10);
    return $nonce;
}
开发者ID:sb-xs,项目名称:que-pour-elle,代码行数:9,代码来源:wptouch-admin-upgrade-license.php


示例3: verify_nonce

 public function verify_nonce($nonce, $action)
 {
     $i = wp_nonce_tick();
     if (substr(wp_hash($i . $action, 'nonce'), -12, 10) === $nonce) {
         return true;
     }
     if (substr(wp_hash($i - 1 . $action, 'nonce'), -12, 10) === $nonce) {
         return true;
     }
     return false;
 }
开发者ID:jeanpage,项目名称:ca_learn,代码行数:11,代码来源:authentication.php


示例4: wp_create_nonce

function wp_create_nonce($action = -1)
{
    $user = wp_get_current_user();
    $uid = (int) $user->ID;
    if (!$uid) {
        /** This filter is documented in wp-includes/pluggable.php */
        $uid = apply_filters('nonce_user_logged_out', $uid, $action);
    }
    $token = wp_get_session_token();
    $i = wp_nonce_tick();
    return substr(wp_hash($i . '|' . $action . '|' . $uid . '|' . $token, 'nonce'), -12, 10);
}
开发者ID:AppItNetwork,项目名称:yii2-wordpress-themes,代码行数:12,代码来源:pluggable.php


示例5: verifyNonce

 /**
  * Local nonce verification.
  * WordPress uses the UID and sometimes I don't want that
  * Verify that correct nonce was used with time limit.
  *
  * The user is given an amount of time to use the token, so therefore, since the
  * $action remain the same, the independent variable is the time.
  *
  * @param string     $nonce  Nonce that was used in the form to verify
  * @param string|int $action Should give context to what is taking place and be the same when nonce was created.
  *
  * @return bool Whether the nonce check passed or failed.
  */
 public static function verifyNonce($nonce, $action = -1)
 {
     $r = false;
     $i = wp_nonce_tick();
     // Nonce generated 0-12 hours ago
     if (substr(wp_hash($i . $action, 'nonce'), -12, 10) == $nonce) {
         $r = 1;
     } elseif (substr(wp_hash($i - 1 . $action, 'nonce'), -12, 10) == $nonce) {
         // Nonce generated 12-24 hours ago
         $r = 2;
     }
     return $r;
 }
开发者ID:Nanotraktor,项目名称:AVH-First-Defense-Against-Spam,代码行数:26,代码来源:avh-security.php


示例6: wp_create_nonce

 /**
  * Creates a random, one time use token.
  *
  * @since 2.0.4
  *
  * @param string|int $action Scalar value to add context to the nonce.
  * @return string The one use form token
  */
 function wp_create_nonce($action = -1)
 {
     $user = wp_get_current_user();
     $uid = (int) $user->id;
     $i = wp_nonce_tick();
     return substr(wp_hash($i . $action . $uid), -12, 10);
 }
开发者ID:nurpax,项目名称:saastafi,代码行数:15,代码来源:pluggable.php


示例7: wp_create_nonce

 /**
  * Creates a random, one time use token.
  *
  * @since 2.0.3
  *
  * @param string|int $action Scalar value to add context to the nonce.
  * @return string The one use form token
  */
 function wp_create_nonce($action = -1)
 {
     $user = wp_get_current_user();
     $uid = (int) $user->ID;
     if (!$uid) {
         $uid = apply_filters('nonce_user_logged_out', $uid, $action);
     }
     $i = wp_nonce_tick();
     return substr(wp_hash($i . '|' . $action . '|' . $uid, 'nonce'), -12, 10);
 }
开发者ID:souljatechie,项目名称:Web-Dev,代码行数:18,代码来源:pluggable.php


示例8: rs_wpss_create_nonce

function rs_wpss_create_nonce($action, $name = '_wpss_nonce')
{
    /***
     * Creates a different nonce system than WordPress.
     * 24 hours or 1 time use. 
     * Difference vs WP nonces: Nonce must exist in database, is not tied to a user ID, and is truly 1 time use.
     * WP nonces don't work for every application. If a comment is posted, and a notification email is sent to admin with link to blacklist the IP, this works better.
     ***/
    $i = wp_nonce_tick();
    $timenow = time();
    $nonce = substr(rs_wpss_md5($i . $action . $name . WPSS_HASH . $timenow), -12, 10);
    $spamshield_nonces = get_option('spamshield_nonces');
    if (empty($spamshield_nonces)) {
        $spamshield_nonces = array();
    } else {
        foreach ($spamshield_nonces as $i => $n) {
            if ($n['expire'] <= $timenow) {
                unset($spamshield_nonces[$i]);
            }
        }
    }
    $expire = $timenow + 86400;
    /* 24 hours */
    $spamshield_nonces[] = array('nonce' => $nonce, 'action' => $action, 'name' => $name, 'expire' => $expire);
    update_option('spamshield_nonces', $spamshield_nonces, FALSE);
    return $nonce;
}
开发者ID:rosslibby,项目名称:davinaplugins,代码行数:27,代码来源:wp-spamshield.php


示例9: get_jobrun_url

 /**
  *
  * Get a url to run a job of BackWPup
  *
  * @param string     $starttype Start types are 'runnow', 'runnowlink', 'cronrun', 'runext', 'restart', 'test'
  * @param int        $jobid     The id of job to start else 0
  * @return array|object [url] is the job url [header] for auth header or object form wp_remote_get()
  */
 public static function get_jobrun_url($starttype, $jobid = 0)
 {
     $wp_admin_user = get_users(array('role' => 'backwpup_admin', 'number' => 1));
     //get a user for cookie auth
     $url = site_url('wp-cron.php');
     $header = array();
     $authurl = '';
     $query_args = array('_nonce' => substr(wp_hash(wp_nonce_tick() . 'backwpup_job_run-' . $starttype, 'nonce'), -12, 10), 'doing_wp_cron' => sprintf('%.22F', microtime(true)));
     if (in_array($starttype, array('restart', 'runnow', 'cronrun', 'runext', 'test'))) {
         $query_args['backwpup_run'] = $starttype;
     }
     if (in_array($starttype, array('runnowlink', 'runnow', 'cronrun', 'runext')) && !empty($jobid)) {
         $query_args['jobid'] = $jobid;
     }
     if (get_site_option('backwpup_cfg_httpauthuser') && get_site_option('backwpup_cfg_httpauthpassword')) {
         $header['Authorization'] = 'Basic ' . base64_encode(get_site_option('backwpup_cfg_httpauthuser') . ':' . BackWPup_Encryption::decrypt(get_site_option('backwpup_cfg_httpauthpassword')));
         $authurl = get_site_option('backwpup_cfg_httpauthuser') . ':' . BackWPup_Encryption::decrypt(get_site_option('backwpup_cfg_httpauthpassword')) . '@';
     }
     if ($starttype == 'runext') {
         $query_args['_nonce'] = get_site_option('backwpup_cfg_jobrunauthkey');
         $query_args['doing_wp_cron'] = NULL;
         if (!empty($authurl)) {
             $url = str_replace('https://', 'https://' . $authurl, $url);
             $url = str_replace('http://', 'http://' . $authurl, $url);
         }
     }
     if ($starttype == 'runnowlink' && (!defined('ALTERNATE_WP_CRON') || !ALTERNATE_WP_CRON)) {
         $url = wp_nonce_url(network_admin_url('admin.php'), 'backwpup_job_run-' . $starttype);
         $query_args['page'] = 'backwpupjobs';
         $query_args['action'] = 'runnow';
         $query_args['doing_wp_cron'] = NULL;
         unset($query_args['_nonce']);
     }
     if ($starttype == 'runnowlink' && defined('ALTERNATE_WP_CRON') && ALTERNATE_WP_CRON) {
         $query_args['backwpup_run'] = 'runnowalt';
         $query_args['_nonce'] = substr(wp_hash(wp_nonce_tick() . 'backwpup_job_run-runnowalt', 'nonce'), -12, 10);
         $query_args['doing_wp_cron'] = NULL;
     }
     //Extra for WP-Cron control
     if (class_exists('WP_Cron_Control') && ($starttype == 'runext' || $starttype == 'runnow' || $starttype == 'restart')) {
         $wp_cron_control_settings = get_option('wpcroncontrol_settings', array());
         if (empty($wp_cron_control_settings['secret_string']) && file_exists(WP_PLUGIN_DIR . '/wp-cron-control/wp-cron-control.php')) {
             $wp_cron_control_settings['secret_string'] = md5(realpath(WP_PLUGIN_DIR . '/wp-cron-control/wp-cron-control.php') . get_current_blog_id());
             $wp_cron_control_settings['enable'] = 1;
         }
         if (isset($wp_cron_control_settings['enable']) && $wp_cron_control_settings['enable'] == 1) {
             if (defined('WP_CRON_CONTROL_SECRET')) {
                 $wp_cron_control_settings['secret_string'] = WP_CRON_CONTROL_SECRET;
             }
             $query_args[$wp_cron_control_settings['secret_string']] = '';
             $query_args['doing_wp_cron'] = NULL;
         }
     }
     $cron_request = apply_filters('cron_request', array('url' => add_query_arg($query_args, $url), 'key' => $query_args['doing_wp_cron'], 'args' => array('blocking' => FALSE, 'sslverify' => apply_filters('https_local_ssl_verify', true), 'timeout' => 0.01, 'headers' => $header, 'cookies' => array(new WP_Http_Cookie(array('name' => AUTH_COOKIE, 'value' => wp_generate_auth_cookie($wp_admin_user[0]->ID, time() + 300, 'auth'))), new WP_Http_Cookie(array('name' => LOGGED_IN_COOKIE, 'value' => wp_generate_auth_cookie($wp_admin_user[0]->ID, time() + 300, 'logged_in')))), 'user-agent' => BackWpup::get_plugin_data('User-Agent'))));
     if ($starttype == 'test') {
         $cron_request['args']['timeout'] = 15;
         $cron_request['args']['blocking'] = TRUE;
     }
     if (!in_array($starttype, array('runnowlink', 'runext'))) {
         set_transient('doing_cron', $query_args['doing_wp_cron']);
         return wp_remote_post($cron_request['url'], $cron_request['args']);
     }
     return $cron_request;
 }
开发者ID:wangshijun101,项目名称:morketing.cn,代码行数:72,代码来源:class-job.php


示例10: is_valid_token

 public function is_valid_token($token)
 {
     $token_json = base64_decode($token);
     $token_array = json_decode($token_json, true);
     if (empty($token_array)) {
         return false;
     }
     $timestamp = $token_array['timestamp'];
     $user_id = $token_array['user_id'];
     $new_status = $token_array['new_status'];
     $entry_id = $token_array['entry_id'];
     $sig = $token_array['sig'];
     $expiration_days = apply_filters('gravityflow_approval_token_expiration_days', 1);
     $i = wp_nonce_tick();
     $is_valid = false;
     for ($n = 1; $n <= $expiration_days; $n++) {
         $sig_key = sprintf('%s|%s|%s|%s|%s|%s', $i, $this->get_id(), $timestamp, $entry_id, $user_id, $new_status);
         $verification_sig = substr(wp_hash($sig_key), -12, 10);
         if (hash_equals($verification_sig, $sig)) {
             $is_valid = true;
             break;
         }
         $i--;
     }
     return $is_valid;
 }
开发者ID:jakejackson1,项目名称:gravityflow,代码行数:26,代码来源:class-step-approval.php


示例11: check_backup_tasks

 /**
  * Checks if scheduled task is ready for execution,
  * if it is ready master sends google_drive_token, failed_emails, success_emails if are needed.
  *
  * @return void
  */
 function check_backup_tasks()
 {
     $this->check_cron_remove();
     $failed_emails = array();
     $settings = $this->tasks;
     if (is_array($settings) && !empty($settings)) {
         foreach ($settings as $task_name => $setting) {
             if (isset($setting['task_args']['next']) && $setting['task_args']['next'] < time()) {
                 //if ($setting['task_args']['next'] && $_GET['force_backup']) {
                 if ($setting['task_args']['url'] && $setting['task_args']['task_id'] && $setting['task_args']['site_key']) {
                     //Check orphan task
                     $check_data = array('task_name' => $task_name, 'task_id' => $setting['task_args']['task_id'], 'site_key' => $setting['task_args']['site_key'], 'worker_version' => MMB_WORKER_VERSION);
                     if (isset($setting['task_args']['account_info']['mwp_google_drive']['google_drive_token'])) {
                         $check_data['mwp_google_drive_refresh_token'] = true;
                     }
                     $check = $this->validate_task($check_data, $setting['task_args']['url']);
                     if ($check == 'paused' || $check == 'deleted') {
                         continue;
                     }
                     $worker_upto_3_9_22 = MMB_WORKER_VERSION <= '3.9.22';
                     // worker version is less or equals to 3.9.22
                     // This is the patch done in worker 3.9.22 because old worked provided message in the following format:
                     // token - not found or token - {...json...}
                     // The new message is a serialized string with google_drive_token or message.
                     if ($worker_upto_3_9_22) {
                         $potential_token = substr($check, 8);
                         if (substr($check, 0, 8) == 'token - ' && $potential_token != 'not found') {
                             $this->tasks[$task_name]['task_args']['account_info']['mwp_google_drive']['google_drive_token'] = $potential_token;
                             $settings[$task_name]['task_args']['account_info']['mwp_google_drive']['google_drive_token'] = $potential_token;
                             $setting['task_args']['account_info']['mwp_google_drive']['google_drive_token'] = $potential_token;
                         }
                     } else {
                         $potential_token = isset($check['google_drive_token']) ? $check['google_drive_token'] : false;
                         if ($potential_token) {
                             $this->tasks[$task_name]['task_args']['account_info']['mwp_google_drive']['google_drive_token'] = $potential_token;
                             $settings[$task_name]['task_args']['account_info']['mwp_google_drive']['google_drive_token'] = $potential_token;
                             $setting['task_args']['account_info']['mwp_google_drive']['google_drive_token'] = $potential_token;
                         }
                     }
                 }
                 $update = array('task_name' => $task_name, 'args' => $settings[$task_name]['task_args']);
                 if ($check != 'paused') {
                     $update['time'] = time();
                 }
                 //Update task with next schedule
                 $this->set_backup_task($update);
                 if ($check == 'paused') {
                     continue;
                 }
                 $result = $this->backup($setting['task_args'], $task_name);
                 $error = '';
                 if (is_array($result) && array_key_exists('error', $result)) {
                     $error = $result;
                     $this->set_backup_task(array('task_name' => $task_name, 'args' => $settings[$task_name]['task_args'], 'error' => $error));
                 } else {
                     if (@count($setting['task_args']['account_info'])) {
                         // Old way through sheduling.
                         // wp_schedule_single_event(time(), 'mmb_scheduled_remote_upload', array('args' => array('task_name' => $task_name)));
                         $nonce = substr(wp_hash(wp_nonce_tick() . 'mmb-backup-nonce' . 0, 'nonce'), -12, 10);
                         $cron_url = site_url('index.php');
                         $backup_file = $this->tasks[$task_name]['task_results'][count($this->tasks[$task_name]['task_results']) - 1]['server']['file_url'];
                         $del_host_file = $this->tasks[$task_name]['task_args']['del_host_file'];
                         $public_key = get_option('_worker_public_key');
                         $args = array('body' => array('backup_cron_action' => 'mmb_remote_upload', 'args' => json_encode(array('task_name' => $task_name, 'backup_file' => $backup_file, 'del_host_file' => $del_host_file)), 'mmb_backup_nonce' => $nonce, 'public_key' => $public_key), 'timeout' => 0.01, 'blocking' => false, 'sslverify' => apply_filters('https_local_ssl_verify', true));
                         wp_remote_post($cron_url, $args);
                     }
                 }
                 break;
                 //Only one backup per cron
             }
         }
     }
 }
开发者ID:jeanpage,项目名称:ca_learn,代码行数:79,代码来源:backup.class.php


示例12: verify_nonce

 /**
  * Verifies nonce.
  *
  * @version 1.17.3
  */
 public static function verify_nonce($nonce, $action = false)
 {
     $user = wp_get_current_user();
     $uid = (int) $user->ID;
     if (empty($uid)) {
         $uid = $_SERVER['REMOTE_ADDR'];
     }
     $i = wp_nonce_tick();
     // Nonce generated 0-12 hours ago
     if (substr(wp_hash($i . $action . $uid, 'nonce'), -12, 10) == $nonce) {
         return 1;
     }
     // Nonce generated 12-24 hours ago
     if (substr(wp_hash($i - 1 . $action . $uid, 'nonce'), -12, 10) == $nonce) {
         return 2;
     }
     // Invalid nonce
     return false;
 }
开发者ID:ksan5835,项目名称:rankproperties,代码行数:24,代码来源:class_functions.php


示例13: verify_anon_nonce

 function verify_anon_nonce($nonce, $action = -1)
 {
     $i = wp_nonce_tick();
     // Nonce generated 0-12 hours ago
     if (substr(wp_hash($i . $action), -12, 10) == $nonce) {
         return 1;
     }
     // Nonce generated 12-24 hours ago
     if (substr(wp_hash($i - 1 . $action), -12, 10) == $nonce) {
         return 2;
     }
     // Invalid nonce
     return false;
 }
开发者ID:masayukiando,项目名称:wordpress-event-search,代码行数:14,代码来源:ktai_style.php


示例14: wooRedirect

 function wooRedirect($message, $error = false)
 {
     if (!$this->useWoo()) {
         return false;
     }
     if ($error === false) {
         $type = 'cs_message';
     } else {
         $type = 'cs_error';
     }
     $i = wp_nonce_tick();
     $nonce = substr(wp_hash($i . 'dit_logout' . 0, 'nonce'), -12, 10);
     wp_redirect(get_permalink(woocommerce_get_page_id('myaccount')) . '?' . $type . '=' . urlencode($message) . '&_nonce=' . $nonce);
     exit;
 }
开发者ID:laiello,项目名称:suitex,代码行数:15,代码来源:loginx_functions.php


示例15: verify_noprivnonce

 public static function verify_noprivnonce($nonce, $action, $id)
 {
     $i = wp_nonce_tick();
     if (substr(wp_hash($i . $action . $id, 'nonce'), -12, 10) == $nonce) {
         return 1;
     }
     if (substr(wp_hash($i - 1 . $action . $id, 'nonce'), -12, 10) == $nonce) {
         return 2;
     }
     return false;
 }
开发者ID:xiphe,项目名称:thewptools,代码行数:11,代码来源:THEWPTOOLS.php


示例16: verify_shared_nonce

/**
 * Verify that correct shared nonce was used with time limit.
 *
 * Uses nonces not linked to the current user. See {@see create_shared_nonce()}
 * for more about why this exists.
 *
 * @param string $nonce Nonce that was used in the form to verify
 * @param string|int $action Should give context to what is taking place and be the same when nonce was created.
 * @return bool Whether the nonce check passed or failed.
 */
function verify_shared_nonce($nonce, $action)
{
    if (empty($nonce)) {
        return false;
    }
    $i = wp_nonce_tick();
    // Nonce generated 0-12 hours ago
    $expected = substr(wp_hash($i . '|' . $action, 'nonce'), -12, 10);
    if (hash_equals($expected, $nonce)) {
        return 1;
    }
    // Nonce generated 12-24 hours ago
    $expected = substr(wp_hash($i - 1 . '|' . $action, 'nonce'), -12, 10);
    if (hash_equals($expected, $nonce)) {
        return 2;
    }
    // Invalid nonce
    return false;
}
开发者ID:fansided,项目名称:Mercator,代码行数:29,代码来源:sso.php


示例17: verify_token

 /**
  * Verify Token
  * Based on wp_verify_nonce() this function requires the user id used when the token
  * was created as by default not logged in users would generate different tokens causing us
  * to fail.
  *
  * @param $user_id (int) required user id
  * @param $nonce (string) required nonce to check
  * @returns true or false
  * @since 0.1
  * @version 1.0.1
  */
 function verify_token($user_id, $nonce)
 {
     $uid = absint($user_id);
     $i = wp_nonce_tick();
     if (substr(wp_hash($i . 'mycred-buy-' . $this->id . $uid, 'nonce'), -12, 10) == $nonce) {
         return true;
     }
     if (substr(wp_hash($i - 1 . 'mycred-buy-' . $this->id . $uid, 'nonce'), -12, 10) === $nonce) {
         return true;
     }
     return false;
 }
开发者ID:sebastianringel,项目名称:stammtisch,代码行数:24,代码来源:mycred-abstract-payment-gateway.php


示例18: wpcf7_create_nonce

function wpcf7_create_nonce($action = -1)
{
    $i = wp_nonce_tick();
    $uid = 0;
    return substr(wp_hash($i . $action . $uid, 'nonce'), -12, 10);
}
开发者ID:Savantos,项目名称:cow-theme,代码行数:6,代码来源:functions.php


示例19: cron_active

 /**
  * Start job if in cron and run query args are set.
  */
 public static function cron_active()
 {
     //only if cron active
     if (!defined('DOING_CRON') || !DOING_CRON) {
         return;
     }
     //only work if backwpup_run as query var ist set and nothing else and the value ist right
     if (empty($_GET['backwpup_run']) || !in_array($_GET['backwpup_run'], array('test', 'restart', 'runnow', 'runnowalt', 'runext', 'cronrun'))) {
         return;
     }
     //special header
     @session_write_close();
     @header('Content-Type: text/html; charset=' . get_bloginfo('charset'), TRUE);
     @header('X-Robots-Tag: noindex, nofollow', TRUE);
     @header('X-BackWPup-Version: ' . BackWPup::get_plugin_data('version'), TRUE);
     nocache_headers();
     //on test die for fast feedback
     if ($_GET['backwpup_run'] == 'test') {
         die('BackWPup Test');
     }
     // generate normal nonce
     $nonce = substr(wp_hash(wp_nonce_tick() . 'backwpup_job_run-' . $_GET['backwpup_run'], 'nonce'), -12, 10);
     //special nonce on external start
     if ($_GET['backwpup_run'] == 'runext') {
         $nonce = get_site_option('backwpup_cfg_jobrunauthkey');
     }
     // check nonce
     if (empty($_GET['_nonce']) || $nonce != $_GET['_nonce']) {
         return;
     }
     //check runext is allowed for job
     if ($_GET['backwpup_run'] == 'runext') {
         $jobids_external = BackWPup_Option::get_job_ids('activetype', 'link');
         if (!isset($_GET['jobid']) || !in_array($_GET['jobid'], $jobids_external)) {
             return;
         }
     }
     //run BackWPup job
     BackWPup_Job::start_http($_GET['backwpup_run']);
     die;
 }
开发者ID:congtrieu112,项目名称:anime,代码行数:44,代码来源:class-cron.php


示例20: verify_nonce_without_session

 protected function verify_nonce_without_session($nonce, $action = -1)
 {
     $nonce = (string) $nonce;
     $user = wp_get_current_user();
     $uid = (int) $user->ID;
     if (!$uid) {
         $uid = apply_filters('nonce_user_logged_out', $uid, $action);
     }
     if (empty($nonce)) {
         return false;
     }
     $i = wp_nonce_tick();
     $expected = substr(wp_hash($i . '|' . $action . '|' . $uid, 'nonce'), -12, 10);
     if (hash_equals($expected, $nonce)) {
         return 1;
     }
     $expected = substr(wp_hash($i - 1 . '|' . $action . '|' . $uid, 'nonce'), -12, 10);
     if (hash_equals($expected, $nonce)) {
         return 2;
     }
     return false;
 }
开发者ID:jexmex,项目名称:mainwp-child,代码行数:22,代码来源:class-mainwp-child-back-wp-up.php



注:本文中的wp_nonce_tick函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP wp_nonce_url函数代码示例发布时间:2022-05-23
下一篇:
PHP wp_nonce_field函数代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap