MyBB Community Forums

Full Version: Mini login not working with 1.2
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I got a mini board login from a post on this board that no longer works for 1.2. How would I set this up now to work with 1.2

<?php

if($mybb->user['uid'])
{
  // The user is logged in, say Hi
echo "Hey, $mybbuser[username].<br>
Thanks for logging in.";
}
else
{
  // The user is not logged in, Display the form
echo "<form action='forum/member.php' method='post'>
Username: <input type='text' name='username' size='10' maxlength='30' /><br />
Password: <input type='password' name='password' size='10' />
<input  type='hidden' name='action' value='do_login'>
<input  type='hidden' name='url' value='index.php' />
<input  type='submit' class='submit' name='submit' value='Login' /></form>";
}
?>
<?php

if($mybb->user['uid'])
{
  // The user is logged in, say Hi
echo "Hey, ".$mybb->user['username'].".<br>
Thanks for logging in.";
}
else
{
  // The user is not logged in, Display the form
	echo '<form action="'.$mybb->settings['bburl'].'/member.php" method="post">
Username: <input type="text" name="username" size="10" maxlength="30" /><br />
Password: <input type="password" name="password" size="10" />
<input  type="hidden" name="action" value="do_login">
<input  type="hidden" name="url" value="index.php" />
<input  type="submit" class="submit" name="submit" value="Login" /></form>';
}
?>
should work.
Thanks for the reply.

When I insert this new code and I bring up the page it gives me this error


Direct initialization of this file is not allowed.

Please make sure IN_MYBB is defined.
You'll need to define the constant IN_MYBB. This can be done by adding the following line under the initial <?php tag.

define('IN_MYBB', 1);