MyBB Community Forums

Full Version: Need help with external login and authentication
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I've been trying to solve this problem for about two hours now. And I can't seem to get it to work. I have a main site hosted on my webhost in /public_html/ and my MyBB installation is at /public_html/mybb/. I'm trying to make it so I can log-in to MyBB through my mainsite, but I haven't been able to get it working. I used a tutorial found on these forums that can be found HERE. And I followed it exactly, with no luck. On my main page I enter in credentials and click log-in then get re-directed to /mybb/member.php where it says, "You have successfully been logged in.
You will now be taken back to where you came from." I get taken back to 'where I came from' and it once more displays the username and password box, as if I hadn't logged in. I'm assuming it's a problem with carrying over sessions, but I'm not sure how to fix it. Here's my few bits of code:

- Included at the top of my mainsite page -
<?php
session_start();
chdir("/home/WEBNAME/public_html/mybb/"); // path to MyBB
define("IN_MYBB", 1);
require("./global.php");
chdir("../");
?>

- Login box / or greeting (if already logged in.) -
<?php

if($mybb->user['uid'])
{
    // If the user if logged in, display a welcoming message.
    echo "Welcome back ".$mybb->user['username']."!<br />";
    echo "Thanks for logging in.";
}
else
{
    // If the user is not logged in, display the login form.
    echo "<form action='mybb/member.php' method='post'>";
    echo "<input type='hidden' name='action' value='do_login' />";
    echo "<input type='hidden' name='url' value='../index.php' />";
    echo "Username: <input type='text' name='username' maxlength='30' /><br />";
    echo "Password: <input type='password' name='password' /><br />";
    echo "<input type='submit' name='submit' value='Login' />";
    echo "</form>";
}

?>


Thank you to anyone who can help, any help is appreciated. - Anthony
Can you provide the link to your forum and a test account?
what are your cookie settings in MyBB? The path should be "/" in your case and not "/mybb"