Switch language

wpseek.com
A WordPress-centric search engine for devs and theme authors




check_admin_referer [ WordPress Function ]

check_admin_referer ( $action = -1, $query_arg = '_wpnonce' )
Parameters:
  • (string) $action Action nonce
  • (string) $query_arg where to look for nonce in $_REQUEST (since 2.5)
Uses:
Defined at:



Makes sure that a user was referred from another admin page.

To avoid security exploits.

Source


<?php
function check_admin_referer($action = -1$query_arg '_wpnonce') {
    if ( -
== $action )
        
_doing_it_wrong__FUNCTION____'You should specify a nonce action to be verified by using the first parameter.' ), '3.2' );

    
$adminurl strtolower(admin_url());
    
$referer strtolower(wp_get_referer());
    
$result = isset($_REQUEST[$query_arg]) ? wp_verify_nonce($_REQUEST[$query_arg], $action) : false;
    if ( !
$result && !(-== $action && strpos($referer$adminurl) === 0) ) {
        
wp_nonce_ays($action);
        die();
    }
    
do_action('check_admin_referer'$action$result);
    return 
$result;
}endif;
?>

Examples [ wp-snippets.com ]

Google Arama Sonuçlarý

Dahasý ...

0 User Note(s)

Henüz yok. Ýlk sen ol!

Yeni Ekle ...



HTML5 Powered with CSS3 / Styling, Performance & Integration, and Semantics