Xenforo Sessions in external php files, IPv6 issues?

Gomez

Member
So I've been using this code to grab the user sessions for a long time, and it works great. However I've started getting user complaints of pages not working, and the only thing I can see different about the users with issues is they have IPv6 Addresses. Any Ideas?

PHP:
        //Xenforo install location
        $fileDir = '/var/www/vhosts/public_html/forums';
        
        //Xenforo Session Setup
        require ($fileDir . '/library/XenForo/Autoloader.php');
        XenForo_Autoloader::getInstance()->setupAutoloader($fileDir . '/library');
        XenForo_Application::initialize($fileDir . '/library/', $fileDir);
        $request = new Zend_Controller_Request_Http();
        $request->setBasePath('/community');
        $session = XenForo_Session::startPublicSession($request);
        $userModel = XenForo_Model::create('XenForo_Model_User');
        $this->user = $userModel->getUserById($session->get('user_id'));
        $this->visitor = XenForo_Visitor::getInstance()->toArray();
        $this->custom_fields = unserialize($this->visitor['custom_fields']);
 
I think its has something to do with https. I was able to work around the problem by modifying the xenforo->helper->cookie.php

PHP:
return self::_setCookieInternal($name, $value, $expiration, $httponly, $secure);

To

PHP:
return self::_setCookieInternal($name, $value, $expiration, false, false);
 
Top Bottom