MyBB Community Forums

Full Version: Login
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I have my forums in a directory called /forum. I would like to have a login for the main part of my site. You can see an image below. Is there a way to do this?

[Image: loginwh5.png]
Something like:
<form method="post" action="forum/member.php"><input name="action" value="do_login" type="hidden">
Username:&nbsp;&nbsp;<input class="textbox" name="username" value="" type="text"><br>
Password:&nbsp;&nbsp;<input class="textbox" name="password" value="" type="password"><br>
<input class="button" name="loginsubmit" value="Login!" type="submit"></form>
Should work. But if you want the box not to show up (or a different box to show up) if you are already logged in would require a deeper site integration.
Yea I would like it to have the box show up..
bump, can anyone help me with this?
At the top of your main site code, add:
<?php
define('IN_MYBB', 1);
chdir('forum');
require './global.php';
?>

Then where that box is, put:
<?php
if($mybb->user['uid'])
{
echo 'You are logged in as: '.$mybb->user['username'];
}
else
{
echo '<!-- the form code -->';
}
?>

You must change your cookie path to: /