I have this code:

$login = $_POST["login"]; $password = $_POST["password"]; include "http://url/forum/XenForo.php?login=$login&password=$password"; echo $success; 

It connects to the file that checks whether the user is authorized here is the code to check the authorization in XenForo

 <?php header("Content-Type: text/plain; charset=UTF-8"); // Verify login and password $login = $_GET['login']; $password = $_GET['password']; if(empty($login) || empty($password)) { exit('Empty login or password'); } // Load XenForo core $dir = dirname(__FILE__); $libraryDir = $dir . '/library'; require_once($dir . '/library/XenForo/Autoloader.php'); XenForo_Autoloader::getInstance()->setupAutoloader($libraryDir); 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=' . $db->quote($login) . ' 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 : 'Incorrect login or password'); ?> 

It works great.

The question is how can I transfer the result of authorization from the code below to the code above. When trying to get data from $ success, it displays the following:

OK: Wolfys Notice: Undefined variable: success in /home/web/moderator/suscess.php on line 23

For early thanks for the help. It is necessary to specify only via the URL, since the forum is located on a different subdomain, unlike the micro site.

  • $RESULT = file_get_contents("http://url/forum/XenForo.php?login=$login&password=$password"); and in $RESULT will be your answer. - Manitikyl
  • Thank you very much this helped me) - Wolfys

0