MyBB Community Forums

Full Version: Automatic login from link
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi everyone, i am struggling to automate the login to the forum. 
What i am trying to do is when the user login to my site it will 
have a link to the forum that if clicked it will automatic login passing the username and password.
I tryed with file_get_contents, related with this old thread: https://community.mybb.com/thread-95502.html, but not works. 
It only set 3 cookies in browser: mybb[lastactive], mybb[lastvisit] and sid.
I already tried MyBBIntegrator class that worked in last version of mybb, but no success.
My current version in use is 1.8.19
So I started searching in this forum and reading the codes to try to understand how I could do that.
And most of the examples includes the global.php file to access the global variables like $mybb,
at least was i understood, but doing so was shown me the homepage forum and nothing more.
I follow the code bellow, to see if this works.

<?php

// Set some useful constants that the core may require or use
define("IN_MYBB", 1);
define('THIS_SCRIPT', 'my_plugin.php');

// Including global.php gives us access to a bunch of MyBB functions and variables
require_once "./global.php";

// Only required because we're using misc_help for our page wrapper
$lang->load("misc");

// Add a breadcrumb
add_breadcrumb('My Page', "my_plugin.php");

$hello_world = 'This text will appear on the page';
eval('$sections  = "' . $templates->get('hello_world_template') . '";');

// Using the misc_help template for the page wrapper
eval("\$page = \"".$templates->get("misc_help")."\";");

// Spit out the page to the user once we've put all the templates and vars together
output_page($page);

?>

But the output was this and not the access to the functions and variables of MyBB like says in the code.
[attachment=41534]

Could someone help me understand or clarify how I could do this, or some plugin that already exists and do this.
I searched but did not find anything yet.
I'm lokking for something similar.

I'm setting up a website with access controlled by a username and password. I'd like to have a link to a BB board which uses the same username and password for authentication, and pass the username and password to the BB board so that if you log in to the main website, you are automatically logged into the BB board when you press the link.