开发者

Facebook App FBML, fb:friend-selector get friend userid

开发者 https://www.devze.com 2023-01-09 11:30 出处:网络
i am trying to get the current logged in user\'s friends, they should select one friend using the form below and then submit it to the same page.

i am trying to get the current logged in user's friends, they should select one friend using the form below and then submit it to the same page. The script is suppose to get the friend's userid (only one) and add it to the database.

The script is working fine but its not posting the right ID (Wrong ID $_POST['friend_selector_id']), it posts an id that looks like this: 2147483647 and i am not sure if this is the profile id or what but i need the id that you use with this code <fb:profile-pic uid=. i need the userid. Could somebody help me out ?

Thank You :D

<form action="<?php echo $appCanvasUrl.'challenge.php?gameid='.$_GET[gameid].'&userid='.$user.'&userid2='.$开发者_开发问答friend_selector_id; ?>" id="challenge" method="post">
<fb:friend-selector uid="<?PHP echo $user; ?>" name="userid2" idname="friend_selector_id"/>
<INPUT type="submit" value="Challenge"> </form>
<?php
    if(isset($_GET['gameid']) && is_numeric($_GET['userid']) && isset($_GET['userid2'])) {
    $gameid = am_injection($_GET[gameid]);
    $userid2 = am_injection($_POST['friend_selector_id']);
    $userid1 = am_injection($user);
    am_queries($db, "INSERT INTO `AMCMS_challenges` (`primkey` ,`userkey1` ,`userkey2` ,`gameid` ,`winner`, `score1`, `score2`) VALUES (NULL, $userid1, $userid2, $gameid, 0, 0, 0);");
    echo 'Challenge recorded.';
    } else {
    echo 'Please select a friend to challenge!';
    exit;
    }


My bad, it wasn't the script, it was my database. I had to set the fields to BIGINT otherwise the number recorded in the database was completely different :)

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号