Submitted by Jan on
/** * create a link with token. */ $valid_token= drupal_get_token('checktoken'); $link = l('checktoken', 'Link', array('query' => array('token', $valid_token)); echo $link; modulename_menu() { $items['checktoken'] = array( 'page callback' => 'modulename_checktoken', 'access callback' => TRUE, 'type' => MENU_CALLBACK, ); } modulename_checktoken() { $token = empty($_GET['token'])?"":$_GET['token']; $valid = drupal_valid_token($token, 'checktoken'); if ($valid) { dsm ('This is local site request'); } else { dsm ('This is external site request'); drupal_access_denied(); } }
- Log in to post comments