2010-11-26 34 views

回答

0

這是我invite.php爲我的作品:

<?php 

require_once "iframe-header.php"; 

if(!$fb_userid) { 
    $api->require_frame(); 
} 

$invite_href = $serverurl.'invite.php?'.$parms; // Rename this as needed 


if(isset($_REQUEST["ids"])) { 

    echo '<center>Thank you for inviting '.sizeof($_REQUEST["ids"]).' of your friends on <b><a href="'.$appurl.'?'.$parms.'" target="canvas_iframe">'.$app_name.'</a></b>.<br/><br/>'; 
    echo '<h2><a href="'.$appurl.'?'.$parms.'" target="canvas_iframe">Click here to return to '.$app_name.'</a>.</h2></center>'; 

} else if($fb_userid) { 

    // Retrieve array of friends who've already authorized the app. 
    $fql = 'SELECT uid FROM user WHERE uid IN (SELECT uid2 FROM friend WHERE uid1='.$fb_userid.') AND is_app_user = 1'; 

    $_friends = $api->api_client->fql_query($fql); 

    // Extract the user ID's returned in the FQL request into a new array. 
    $friends = array(); 
    if (is_array($_friends) && count($_friends)) { 

     foreach ($_friends as $friend) { 
      $friends[] = $friend['uid']; 
     } 

    } 

    // Convert the array of friends into a comma-delimeted string. 
    $friends = implode(',', $friends); 

    // Prepare the invitation text that all invited users will receive. 
    $content = '<fb:name uid="'.$fb_userid.'" firstnameonly="true" shownetwork="false" /> has started using <a href="'.$appurl.'">'.$app_name.'</a> and thought it&apos;s so cool even you should try it out! <fb:req-choice url="'.$api->get_add_url().'" label="Put '.$app_name.' on your profile" />'; 

    echo '<fb:serverFbml style="width: 755px;"><script type="text/fbml"><fb:fbml><fb:request-form action="'.$invite_href.'" method="get" type="'.$app_name.'" content="'.htmlentities($content,ENT_COMPAT,'UTF-8').'">'; 
    echo ' <fb:multi-friend-selector actiontext="Here are your friends who don&apos;t have '.$app_name.' yet. Invite whoever you want -it&apos;s free!" exclude_ids="'.$friends.'" />'; 
    echo '</fb:request-form></fb:fbml></script></fb:serverFbml>'; 

} 

require_once "iframe-footer.php"; 

>

+0

感謝您的代碼。我沒有使用,因爲我沒有發送邀請。我使用而不是 happyhardik 2010-11-26 20:40:07

相關問題