2012-07-16, 05:40 PM
Following my previous thread, I've been working with the integrator but I've ended up getting stuck with the global.php login redirect.
Basically MyBB is installed here:
www.mywebsite.com
The script I use in the MyBB integrator is located here:
www.mywebsite.com/somedir/test.php
Inside test.php I have this code:
Now the problem is if I logout of the MyBB forum using the normal interface/url then it logs out like normal but whenever I access test.php it redirects me to the login screen right after it runs:
So it doesn't run the MyBB integrator code, it just looks at global.php and realizes I'm not logged in so instead of logging me in through the integrator, it redirects me to the login page. This is getting very frustrating for me as I'm trying to make the login built into test.php so that I can POST the login details to test.php and it can run the whole script in one go without any redirects, but I keep on getting stuck as it keeps on redirecting.
Could anyone help me sort out this problem or does anyone know a work around? I guess the solution would be to login before the script starts and to create the correct MyBB sessions, but I don't know how MyBB works or how to do that.
Basically MyBB is installed here:
www.mywebsite.com
The script I use in the MyBB integrator is located here:
www.mywebsite.com/somedir/test.php
Inside test.php I have this code:
define('IN_MYBB', NULL);
require_once '../global.php';
require_once 'class.MyBBIntegrator.php';
$MyBBI = new MyBBIntegrator($mybb, $db, $cache, $plugins, $lang, $config);
$loginResult = $MyBBI->login($_POST['username'],$_POST['password']);
If ($loginResult)
{
Echo "Login Success";
}
Now the problem is if I logout of the MyBB forum using the normal interface/url then it logs out like normal but whenever I access test.php it redirects me to the login screen right after it runs:
require_once '../global.php';
So it doesn't run the MyBB integrator code, it just looks at global.php and realizes I'm not logged in so instead of logging me in through the integrator, it redirects me to the login page. This is getting very frustrating for me as I'm trying to make the login built into test.php so that I can POST the login details to test.php and it can run the whole script in one go without any redirects, but I keep on getting stuck as it keeps on redirecting.
Could anyone help me sort out this problem or does anyone know a work around? I guess the solution would be to login before the script starts and to create the correct MyBB sessions, but I don't know how MyBB works or how to do that.