2013-07-25, 08:40 PM
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 -
- Login box / or greeting (if already logged in.) -
Thank you to anyone who can help, any help is appreciated. - Anthony
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