MyBB Community Forums

Full Version: Website Integration
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
Hey guys,

How can I integrate my copy of MyBB with my website? Like I want to put a little "User Login" deal on the side of my site, so that people can enter in their username and password for my forum and they can login and be logged into the site and my forum at the same time.

I'm pretty sure Chris said something like that would come with MyBB Gold (as a developer's tool or something like that) but I can't find anything like that.

Does anyone know if I can integrate my MyBB forum with my website?

Thank you, Smile
Andy
Eh? Custom pages? How will the help integrate a forum login system onto my website?
yea i'm kinda interested in this too, before gold i just figured out the cookie stuff. But it seems you're using somekind of encryption now (which is good ofcourse!)

But since i'm writing a nice portal, it would be nice to have a loginbox in the portal itself...
all you need is a form that points to the login page

<form action="[color=red]put the url to your forum's member.php here[/color]" 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="[color=red]the url here will be redirected to after login[/color]" />
<input type="submit" class="submit" name="submit" value="Login" />
</form>

just change the parts in red to whatever you need.
Big Grin unanimous applause
What he probably wants is integrating the WHOLE system to the website, something like what IPB SDK did for IPB users. It gave you a library of custom-made php functions that will retrieve DB data from the board. Probably a mod request would be nice. You could request for a library of functions for retrieving MyBB DB data. Smile
I've been wondering about this for a while to.
leejeffery Wrote:all you need is a form that points to the login page

<form action="[color=red]put the url to your forum's member.php here[/color]" 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="[color=red]the url here will be redirected to after login[/color]" />
<input type="submit" class="submit" name="submit" value="Login" />
</form>

just change the parts in red to whatever you need.

thatone works great,
another small question if you don't mind. How do i check if a user is logged in?

I've compared cookies and see that
the following stuff is being set/changed:
mybb[lastactive]
sid
mybb[lastvisit]
and mybbuser

that lastone seems to be most important, if it exist than the user has logged in. BUT how do I know if it's really him. Perhaps some mysql table stores that same session id?
$info = explode("_", $_COOKIE['mybbuser']);
$result = mysql_query("SELECT loginkey FROM mybb_users WHERE uid=".intval($info[0]));
$user = mysql_fetch_array($result);
if($user[1] == $user['loginkey'])
{
  //logged in
}
else
{
  // not logged in
}

If you include the MyBB core files, it's easier to integrate

chdir("forum"); // path to MyBB
require "./global.php";

if($mybb->user['uid'])
{
  // logged in
}
else
{
  // logged out
}
Pages: 1 2 3 4 5 6 7