首页 > 解决方案 > 注意:尝试访问 bool 类型值的数组偏移量

问题描述

您好,当我通过 Steam 连接到我的网站时遇到问题,它给了我错误:

Notice: Trying to access array offset on value of type bool in /var/www/boutique.sky-community.com/index.php on line 67
Notice: Trying to access array offset on value of type bool in /var/www/boutique.sky-community.com/index.php on line 68
Notice: Trying to access array offset on value of type bool in /var/www/boutique.sky-community.com/index.php on line 69
Notice: Trying to access array offset on value of type bool in /var/www/boutique.sky-community.com/index.php on line 70
Notice: Trying to access array offset on value of type bool in /var/www/boutique.sky-community.com/index.php on line 71

这是我的 index.php 的一部分:

    if (!isset($_SESSION['gex_steamid64'])) {
        if (isset($_COOKIE['gex_loginsession'])) {
            $db->where('session', $_COOKIE['gex_loginsession']);
            $db->where('expires > NOW()');

            $steamid64 = $db->getValue('sessions', 'steamid64');

            if ($db->count) {
                $db->where('session', $_COOKIE['gex_loginsession']);
                $db->update('sessions', array('expires' => $db->func('DATE_ADD(NOW(), INTERVAL ? DAY)', array(30))));

                $_SESSION['gex_steamid64'] = $steamid64;

                setcookie('gex_loginsession', $_COOKIE['gex_loginsession'], time() + 2592000, '/');
            }
        }
    } elseif (isset($_GET['login_started'])) {
        $steamprofile = SteamAPI::GetUserData($_SESSION['gex_steamid64']);

        $steamid32 = $steamprofile['steamid32'];
        $nick = $steamprofile['personaname'];
        $avatar_small = $steamprofile['avatar'];
        $avatar_medium = $steamprofile['avatarmedium'];
        $avatar_large = $steamprofile['avatarfull'];

        $db->where('steamid64', $_SESSION['gex_steamid64']);
        $userdata = $db->getOne('users');

        $ip = GetClientIP();
        $ips = array($ip);

        if ($db->count) {
            $sessionkey = hash('sha512', random_string(25).$userdata['random']); //(hash("sha256", md5('Ew97f9N3vq4' . $_SESSION['gex_steamid64'] . '86V' . $result['email'] . 'b93z7' . $_SERVER['HTTP_USER_AGENT'] . '4E$HSJH8gjsA' . $result['random'] . '3oikjfA')));

            setcookie('gex_loginsession', $sessionkey, time() + 2592000, '/');

它只有在您登录并且无法正常工作时才完成,有人可以帮助我吗?

标签: phphtml

解决方案


推荐阅读