我的问题是,我不能用这个登录,因为出于某种原因,它不让我,如果我有从数据库获取数据的代码它不工作(我有一个明确的连接和连接刚刚好)
<?php
$steamauth['apikey'] = APIKEY; // Your Steam WebAPI-Key found at http://steamcommunity.com/dev/apikey
$steamauth['domainname'] = WEBSITE; // The main URL of your website displayed in the login page
$steamauth['logoutpage'] = WEBSITE; // Page to redirect to after a successfull logout (from the directory the SteamAuth-folder is located in) - NO slash at the beginning!
$steamauth['loginpage'] = WEBSITE; // Page to redirect to after a successfull login (from the directory the SteamAuth-folder is located in) - NO slash at the beginning!
// System stuff
if (empty($steamauth['apikey'])) {die("<div style='display: block; width: 100%; background-color: red; text-align: center;'>SteamAuth:<br>Please supply an API-Key!<br>Find this in steamauth/SteamConfig.php, Find the '<b>\$steamauth['apikey']</b>' Array. </div>");}
if (empty($steamauth['domainname'])) {$steamauth['domainname'] = $_SERVER['SERVER_NAME'];}
if (empty($steamauth['logoutpage'])) {$steamauth['logoutpage'] = $_SERVER['PHP_SELF'];}
if (empty($steamauth['loginpage'])) {$steamauth['loginpage'] = $_SERVER['PHP_SELF'];}
$steamid=mysqli_connect("","","","");
$steamid->set_charset("utf8");
if (mysqli_connect_errno()) {
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
$result = mysqli_query($steamid, "SELECT * FROM panel_admins");
if (!$result) {
printf("Error: %s\n", mysqli_error($steamid));
exit();
}
echo "";
while ($row = mysqli_fetch_array($result)) {
$allowed_ids = [
'"' . $row['steamid'] . '"',
];
}
mysqli_close($steamid);
?>
但另一方面,如果我有这样的代码,我可以登录没有问题
<?php
$steamauth['apikey'] = APIKEY; // Your Steam WebAPI-Key found at http://steamcommunity.com/dev/apikey
$steamauth['domainname'] = WEBSITE; // The main URL of your website displayed in the login page
$steamauth['logoutpage'] = WEBSITE; // Page to redirect to after a successfull logout (from the directory the SteamAuth-folder is located in) - NO slash at the beginning!
$steamauth['loginpage'] = WEBSITE; // Page to redirect to after a successfull login (from the directory the SteamAuth-folder is located in) - NO slash at the beginning!
// System stuff
if (empty($steamauth['apikey'])) {die("<div style='display: block; width: 100%; background-color: red; text-align: center;'>SteamAuth:<br>Please supply an API-Key!<br>Find this in steamauth/SteamConfig.php, Find the '<b>\$steamauth['apikey']</b>' Array. </div>");}
if (empty($steamauth['domainname'])) {$steamauth['domainname'] = $_SERVER['SERVER_NAME'];}
if (empty($steamauth['logoutpage'])) {$steamauth['logoutpage'] = $_SERVER['PHP_SELF'];}
if (empty($steamauth['loginpage'])) {$steamauth['loginpage'] = $_SERVER['PHP_SELF'];}
// allow only these ids
$allowed_ids = [
'steamid64here',
];
?>
可能是代码不好什么的。我用的是PHP5.6!我想要这个代码做什么?我想在steamid列中,它将获取steamid64并放在那里。
1条答案
按热度按时间mfpqipee1#
您正在覆盖
$allowed_ids
在每个过程中进行while循环。请尝试以下代码: