Facebook 应用程序 FBML,fb:friend-selector 获取好友用户 ID
我正在尝试获取当前登录用户的朋友,他们应该使用下面的表单选择一位朋友,然后将其提交到同一页面。 该脚本假设获取朋友的用户 ID(只有一个)并将其添加到数据库中。
该脚本工作正常,但它没有发布正确的 ID(错误的 ID $_POST['friend_selector_id']
),它发布的 ID 如下所示:2147483647,我不确定这是否是配置文件 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我的错,这不是脚本,而是我的数据库。我必须将字段设置为 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 :)