2
我通过php验证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 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;
}
错误日志:
[12月 - 2017年20点08分45秒UTC] PHP致命错误:在/ home不能重新声明类XenForo_Autoloader/****在线***/******* /库/ XenForo/Autoloader.php 16
所以,请帮助我,什么是错的