MyBB Community Forums

Full Version: Integrating MyBB into your website. (Login Form)
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
Well the file is included into another page. home.html (<< code there) is included into index.php.
Can we see the codes of both files please.
I have figured out why I got that error and sadly it is because i am including the file into another file...my whole site runs like that.. it shows the log in forum when I am already logged in. Does cookie path have anything to do with it? \

When I print "$mybb->user['uid']"; i get Array['uid'].
I am assuming that is normal...
I can't do anything without seeing your codes. But anyway what's below should work for you

<?php

define('IN_MYBB', 1);
chdir('efforums'); // path to MyBB
require 'global.php';
?>
<HTML>
<?php

if($mybb->user['uid'] > 0)
{
  // 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='efforums/member.php' method='post'>
Username: <input type='text' name='username' size='25' maxlength='30' /><br />
Password: <input type='password' name='password' size='25' />
<input type='hidden' name='action' value='do_login'>
<input type='hidden' name='url' value='http://www.yousite.com/' />
<input type='submit' class='submit' name='submit' value='Login' /></form><br>";
}
?>
</HTML>

Regarding both issues mentioned above.
Is the login form the index php?
The page is not a index.php but a php file with a random name. I used the code that zaher1988 provided but i can not get it to work. I can log in fine, but it shows the log in forum even though i am logged in.
This can't happen if you are including the correct global.php and you are loading the correct member.php and you are being redirected to the correct site which is not using a masked or forwarded domain and which has the correct cookie settings.
well my cookie domains is .MYDOMAINHERE.com and the cookie path is /mybbboardforumfolder/
Also, I transfered from IPB to myBB. Does that have anything to do with it? I also tired it on another server. Has anyone tested this mod with myBB 1.2.3?
It will be better if you provide me with the link to your forums so that i make sure of the cookie settings.
Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48