public static function checkPass($data) { global $bd_names, $bd_users; self::start(); $db = XenForo_Application::get('db'); $XFauthLogic = self::getXFHashCheckLogic(); if ($XFauthLogic == 2) { $auth = new XenForo_Authentication_Core12(); } elseif ($XFauthLogic == 1) { $auth = new XenForo_Authentication_Core(); } else { vtxtlog('[xenforo.php] xenForo auth class not founded'); return false; } $res = $db->fetchCol("SELECT `data` FROM `{$bd_names['user_auth']}` WHERE `{$bd_users['id']}`=" . $data['user_id']); if (!count($res)) { return false; } $auth->setData($res[0]); if ($auth->authenticate($data['user_id'], $data['pass'])) { return true; } else { return false; } }
XenForo_Application::initialize($libraryDir, $dir); XenForo_Application::set('page_start_time', microtime(true)); $db = XenForo_Application::get('db'); // Resolve user_id by login $result = $db->fetchRow('SELECT user_id, username FROM xf_user WHERE username='******' OR email=' . $db->quote($login)); if (!count($result)) { exit('Incorrect login'); } $user_id = $result['user_id']; $username = $result['username']; // Get user data $result = $db->fetchCol('SELECT data FROM xf_user_authenticate WHERE user_id=' . $db->quote($user_id)); if (!count($result)) { exit('Unable to get user data: ' . $user_id); } $data = $result[0]; // Select authentication core $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(); } else { exit('Unable to select authentication core'); } } // Try authenticate $auth->setData($data); $success = $auth->authenticate($user_id, $password); echo $success ? 'OK:' . $username : '******';