Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/api/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
PHP检查XenForo用户';s帐户数据_Php_Api_Xenforo - Fatal编程技术网

PHP检查XenForo用户';s帐户数据

PHP检查XenForo用户';s帐户数据,php,api,xenforo,Php,Api,Xenforo,我正在通过php验证XenForo用户 我的代码: public function Auth($username, $password) { $userIDA = $this->getarray("SELECT * FROM xf_user WHERE username='".$username."'"); if($userIDA) { define('SESSION_BYPASS', false); // if true: logged in

我正在通过php验证XenForo用户

我的代码:

public function Auth($username, $password)
{
    $userIDA = $this->getarray("SELECT * FROM xf_user WHERE username='".$username."'");

    if($userIDA) 
    {
        define('SESSION_BYPASS', false); // if true: logged in user info and sessions are not needed
        require_once('library/XenForo/Autoloader.php');

        $AutoLoader = XenForo_Autoloader::getInstance();
        $AutoLoader->setupAutoloader('library');
        XenForo_Application::initialize('library', '');
        XenForo_Application::set('page_start_time', microtime(true));
        XenForo_Application::disablePhpErrorHandler(); //
        XenForo_Session::startPublicSession(); //
        error_reporting(E_ALL & ~E_NOTICE); // Turn off the strict error reporting.

        $db = XenForo_Application::get('db');
        $result = $db->fetchCol('SELECT user_id FROM xf_user WHERE username='.$db->quote($username));
        $user_id = $result[0];
        $result = $db->fetchCol('SELECT data FROM xf_user_authenticate WHERE user_id='.$db->quote($user_id));
        $data = $result[0]; 

        $auth = NULL;

        if(class_exists('XenForo_Authentication_Core12'))
            $auth = new XenForo_Authentication_Core12;
        else if(class_exists('XenForo_Authentication_Core'))
            $auth = new XenForo_Authentication_Core;

        $auth->setData($data); 

        if ($auth->authenticate($user_id, $password))
        {
            switch (intval($user_id))
            {
                default: 
                    return 1; 
                break;
                case 1:
                    return -1; 
                case 3:
                    return -1;
                break;
            }
        }
        return 2;
    }
    else return 3;
}
错误日志:

[2017年8月12日20:08:45 UTC]PHP致命错误:无法在第16行的/home/********/********/library/xenfro/Autoloader.PHP中重新声明类XenForo_Autoloader


所以,请帮助我,出了什么问题

请尝试使用以下代码


XenForo_Autoloader::getInstance()->setupAutoloader($forum_directory.'/library')

尝试使用以下代码

XenForo_Autoloader::getInstance()->setupAutoloader($forum_directory.'/library')