gpt4 book ai didi

PHP,openId - 无法写入mysql

转载 作者:行者123 更新时间:2023-11-29 19:51:11 25 4
gpt4 key购买 nike

您好,我正在尝试建立一个游戏投注网站。我使用 openId 将数据从 steam 传输到我的网站。但这个“bug”是不久前发生的。我无法为每个连接的新用户写入新行。 2天前还在工作。我不认为我改变了任何东西,但它不起作用,所以必须改变一些东西。我的代码很长,所以我只会发布我认为有问题的部分。所以就是这样。正如我所说,它应该为新用户写入新行。

        if($openid->validate()) 
{
$id = $openid->identity;
// identity is something like: http://steamcommunity.com/openid/id/76561197960435530
// we only care about the unique account ID at the end of the URL.
$ptn = "/^http:\/\/steamcommunity\.com\/openid\/id\/(7[0-9]{15,25}+)$/";
preg_match($ptn, $id, $matches);
echo "Sucesfully logged in (steamID: $matches[1])\n";

$url = "http://api.steampowered.com/ISteamUser/GetPlayerSummaries/v0002/?key=$_STEAMAPI&steamids=$matches[1]";
$json_object= file_get_contents($url);
$json_decoded = json_decode($json_object);

foreach ($json_decoded->response->players as $player)
{
$sql_fetch_id = "SELECT * FROM users_steam WHERE steamid = $player->steamid";
$query_id = mysqli_query($conn,$sql_fetch_id);

if(mysqli_num_rows($query_id)==0){
$sql_steam = "INSERT INTO users_steam (name, steamid, avatar, loggedin, tradeurl) VALUES ('$player->personaname', '$player->steamid', '$player->avatar',' ',' ')";
mysqli_query($conn,$sql_steam);}

$_SESSION["id"] = $player->steamid;
$_SESSION["name"] = $player->personaname;
$_SESSION["url"] = $player->profileurl;
$_SESSION["smallavatar"] = $player->avatar;
$_SESSION["mediumavatar"] = $player->avatarmedium;
$_SESSION["largeavatar"] = $player->avatarfull;
}
}

编辑:我忘了提及它没有显示任何错误或任何内容。它只是没有反应,表现得就像过去了一样。例如, session 索引是在玩家登录后设置的。它只是不写入mysql。

最佳答案

好吧,问题是我在表中添加了新的必需列。感谢马特·克拉克的努力!

关于PHP,openId - 无法写入mysql,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40812851/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com