Guest User

Untitled

a guest
May 25th, 2018
158
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.66 KB | None | 0 0
  1. $login = $_POST["login"];
  2. $password = $_POST["password"];
  3. include "http://url/forum/XenForo.php?login=$login&password=$password";
  4. echo $success;
  5.  
  6. <?php
  7. header("Content-Type: text/plain; charset=UTF-8");
  8. // Verify login and password
  9. $login = $_GET['login'];
  10. $password = $_GET['password'];
  11. if(empty($login) || empty($password)) {
  12. exit('Empty login or password');
  13. }
  14. // Load XenForo core
  15. $dir = dirname(__FILE__);
  16. $libraryDir = $dir . '/library';
  17. require_once($dir . '/library/XenForo/Autoloader.php');
  18. XenForo_Autoloader::getInstance()->setupAutoloader($libraryDir);
  19. XenForo_Application::initialize($libraryDir, $dir);
  20. XenForo_Application::set('page_start_time', microtime(true));
  21. $db = XenForo_Application::get('db');
  22. // Resolve user_id by login
  23. $result = $db->fetchRow('SELECT user_id, username FROM xf_user WHERE username=' . $db->quote($login) . ' OR email=' . $db->quote($login));
  24. if(!count($result)) {
  25. exit('Incorrect login');
  26. }
  27. $user_id = $result['user_id'];
  28. $username = $result['username'];
  29. // Get user data
  30. $result = $db->fetchCol('SELECT data FROM xf_user_authenticate WHERE user_id=' . $db->quote($user_id));
  31. if(!count($result)) {
  32. exit('Unable to get user data: ' . $user_id);
  33. }
  34. $data = $result[0];
  35. // Select authentication core
  36. $auth = NULL;
  37. if(class_exists('XenForo_Authentication_Core12')) {
  38. $auth = new XenForo_Authentication_Core12;
  39. } else if(class_exists('XenForo_Authentication_Core')) {
  40. $auth = new XenForo_Authentication_Core;
  41. } else exit('Unable to select authentication core');
  42. // Try authenticate
  43. $auth->setData($data);
  44. $success = $auth->authenticate($user_id, $password);
  45. echo($success ? 'OK:' . $username : 'Incorrect login or password');
  46. ?>
Add Comment
Please, Sign In to add comment