首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >MySQLi显示为PHP代码

MySQLi显示为PHP代码
EN

Stack Overflow用户
提问于 2018-08-16 05:14:54
回答 1查看 53关注 0票数 0

我的问题是,我不能用这个登录,因为出于某种原因,它不让我登录,如果我让代码从数据库获取数据,它就不能工作(我有一个明确的连接,连接很好)

代码语言:javascript
复制
    <?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);
?>

但是另一方面,如果我有这样的代码,我可以毫无问题地登录

代码语言:javascript
复制
<?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',
];
?>

也许代码不是很好或者别的什么。我使用的是PHP 5.6!我想用这段代码做什么?我想在steamid列中,它将抓取steamid64并放在那里。

EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/51866540

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档