function create_magnet($infohash, $auth_key, $logged_in)
{
global $bb_cfg, $_GET, $images, $userdata;
if(!$auth_key) {
require_once INC_DIR . '/functions_torrent.php';
generate_passkey($userdata['user_id'], true);
}
$passkey_url = ((!$logged_in || isset($_GET['no_passkey'])) && $bb_cfg['bt_tor_browse_only_reg']) ? '' : "?{$bb_cfg['passkey_key']}=$auth_key";
return '<a href="magnet:?xt=urn:btih:' . bin2hex($infohash) . '&tr=' . urlencode($bb_cfg['bt_announce_url'] . $passkey_url) . '" onclick="yaCounter47224737.reachGoal(\'magnet\'); return true;"><img src="' . $images['icon_magnet'] . '" width="12" height="12" border="0" /></a>';
}