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
works fine in 1.4 for me Smile
(2008-08-06, 05:01 PM)DraconisCombine Wrote: [ -> ]Works perfectly for me in 1.4 as is actually. What error are you getting?

Not really getting an error, per say. But it isn't working correctly. It won't "remember" that I'm logged in on the Main Page, but when I go to the forums I am logged in okay.

Using this code before anything:
<?php
    define("IN_MYBB",1);
    chdir('forum'); // path to MyBB
    require './global.php';
?>

and this where i want the box to appear:
<?php

if($mybb->user['uid'] > 0) { // The user is logged in, say Hi
    echo "Hey, ". $mybb->user['username'] .".<br>Thanks for logging in.<br><br>";

} else {

     // The user is not logged in, Display the form
    echo "<form action='http://lorddonk.890m.com/forums/member.php' method='post'>
    <input type=\"hidden\" name=\"my_post_key\" value=\"$mybb->post_code\" />
    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://lorddonk.890m.com/index.php' />
    <input type='submit' class='submit' name='submit' value='Login' /></form><br>";
}

?>

Basically, the problem is it keeps prompting you to log-in with the text boxes on the main page, even though you already are...
Are your cookie domain and path set properly? [wiki]Cookies#Cookie_Settings[/wiki]
(2008-08-07, 05:11 PM)Michael83 Wrote: [ -> ]Are your cookie domain and path set properly? [wiki]Cookies#Cookie_Settings[/wiki]

I have set them according to this http://www.dennistt.net/mybb/cookiesettings.php

But should I maybe change the cookie path so its not just in MyBB? Trying that now...

EDIT: Didn't work...Sad
I have been attempting to integrate my site pages with MyBB 1.4, the way it worked on 1.2, but with no luck.

It seems that
$mybb->user[]
no longer works outside of global.php and a select other few of MyBB's pages, all $mybb->user array bits return 0 or "" (null string).

Can someone please shed some light on what can now be used to get MyBB user information on pages outside of MyBB?
Did anyone figure this out!? Can anyone post the code that is supposed to work in 1.4?
i got it worked on my site it works pretty well even with myBB 1.4
I have an existing website with several users. Does anyone know how to integrate MyBB with your existing login. What I want to do is have my users login to my website and when they click the forum link be automatically logged in to MyBB. I've tried passing the params through the session and redirecting but its not working.

Any help....please.
Thanks I really needed that Smile
hello I have one little problem with this code
when I logout from my website it doesn't log me out from my forum ... it stay logged in.

i use this code before anything:
<?php
    define("IN_MYBB",1);
    chdir('forum'); // path to MyBB
    require './global.php';
?>

and this where the login box appear:
<?php

if($mybb->user['uid'] > 0) { // The user is logged in, say Hi
    echo "Hey, ". $mybb->user['username'] .".<br>Thanks for logging in.<br><br>";

} else {

     // The user is not logged in, Display the form
    echo "<form action='forum/member.php' method='post'>
    <input type=\"hidden\" name=\"my_post_key\" value=\"$mybb->post_code\" />
    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='index.php' />
    <input type='submit' class='submit' name='submit' value='Login' /></form><br>";
}

?>

any idea?

ps
sorry for my english.
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