MyBB Community Forums

Full Version: Login Integration to Website
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
So we have our website www.fortifiedgaming.com and we use mybb as the subdomain at www.fortifiedgaming.com/forum

What we are trying to do, is integrate the login/registration used for mybb to the website. So that users can login/register on our main page without having to necessarily navigate to the forum. I hope that makes sense. Any help would be appreciated and if any more information is needed i will do my best to provide that. Thank you
I haven't done the register part but I can show you what I have done to log in on the website:

<?php
chdir('.'); // path to MyBB
define("IN_MYBB", 1);
require '../global.php';
?>
<html>
<head>
<title>Login</title>
<link type="text/css" rel="stylesheet" href="style.css" />
</head>
<body>
<div class="main">
<?php

if($mybb->user['uid'])
{
// The user is logged in, say Hi
echo "Hallo ".$mybb->user['username']."!<br /><a href='main.php'>Weiter...</a>";
$url='main.php';
echo '<META HTTP-EQUIV=REFRESH CONTENT="1; '.$url.'">';
}
else
{
// The user is not logged in, Display the form
echo "<form action='http://http://www.fortifiedgaming.com/forum/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.fortifiedgaming.com/main.php' />
<input type='submit' class='submit' name='submit' value='Login' /></form><br>";
}
?>
</div>
</body>
</html>

You'll probably have to edit the whole PHP-part at the top as in my case the forum is set up on the root and the website is on a subdomain. Hope this still helps out.

NOTE: I'm not sure if this is completely safe and everything so if anyone has any security issues with this please post them. All I know is that it works for me Big Grin