Facebook 应用程序 FBML,fb:friend-selector 获取好友用户 ID

发布于 2024-09-11 21:26:41 字数 1241 浏览 2 评论 0原文

我正在尝试获取当前登录用户的朋友,他们应该使用下面的表单选择一位朋友,然后将其提交到同一页面。 该脚本假设获取朋友的用户 ID(只有一个)并将其添加到数据库中。

该脚本工作正常,但它没有发布正确的 ID(错误的 ID $_POST['friend_selector_id']),它发布的 ID 如下所示:2147483647,我不确定这是否是配置文件 ID 或其他什么,但我需要您与此代码一起使用的 ID 。我需要用户 ID。有人可以帮我吗?

谢谢你: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;
    }

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;
    }

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

我只土不豪 2024-09-18 21:26:41

我的错,这不是脚本,而是我的数据库。我必须将字段设置为 BIGINT,否则数据库中记录的数字完全不同:)

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 :)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文