MyBB Community Forums

Full Version: What is the code...
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
to create a login on my main website? I wnat it to use the username and passwords from my forum. How do i do that?Oh - and i am new to code so include instructions.
You could just set up a regular html form that sends $_POST content to your MyBB installation, and then set the redirector back to your site (send a hidden input, check the hidden input, redirect based on it, etc).

There might be an easier solution, however.
I repeat - i am new to code so include instructions.
What you're asking for is really custom-work, as not many people have custom login forms on their websites that go to their forums.

Did you code your main website? Is it using PHP? Is it a CMS system?

HTML-wise (make sure to replace all the http:// references with your real URL as I did this locally.
<span id="quick_login">
	<form action="member.php" method="post">
		<input value="do_login" name="action" type="hidden">
		<input value="http://127.0.0.1/forums/mybb_1/" name="url" type="hidden">
		<input value="1" name="quick_login" type="hidden">
		<input id="quick_login_username" onblur="if(this.value == '') { this.value='Username'; }" onfocus="if(this.value == 'Username') { this.value=''; }" class="textbox" value="Username" name="quick_username" type="text">
		<input onblur="if(this.value == '') { this.value='Password'; }" onfocus="if(this.value == 'Password') { this.value=''; }" class="textbox" value="Password" name="quick_password" type="password">
		<input class="button" value="Login" name="submit" type="submit"> — <a href="http://127.0.0.1/forums/mybb_1/member.php?action=lostpw">Lost Password?</a> — <a href="http://127.0.0.1/forums/mybb_1/member.php?action=register">Register</a>
	</form>
</span>

Nonetheless, you could try my above method. Though another method would be to use PHP and include the form itself...

I'm fairly new myself to MyBB so I'm not familiar with how to include the files to cast which functions to run, but this in theory should work. If you look at /portal.php you can see a login block being created by calling down certain included files. Emulating it could do the same for you.