SMFNEW Support Forum

Your Forum => Tips & Resources => Outdated (Closed for posting) => Topic started by: Kamran Saleem on April 27, 2009, 02:49:18 am

Title: Integrating MyBB into your website. (Login Form)
Post by: Kamran Saleem on April 27, 2009, 02:49:18 am
Integrating MyBB into your website. (Login Form)
Hmmm... Let me guess.
You need to integrate your forum within your website?
Well, you came to the right place.

What you need
1. Basic Knowledge In HTML.
2. Basic Knowledge In PHP.
3. MyBB (Duh).
4. A website to integrate it with.

How To
First, Before ANYTHING, even the "" or "
Code: [Select]
<?php
chdir
('forums'); // path to MyBB
define(&quot;IN_MYBB&quot;, 1);
require 
'./global.php';
?>


Then, place this where you want the login form/welcome message to appear.
Code: [Select]

if($mybb->user['uid'])
{
��// The user is logged in, say Hi
echo "Hey, $mybbuser[username].

Thanks for logging in.";
}
else
{
��// The user is not logged in, Display the form
echo "

Username:

Password:



";
}
?>


Where 'index.php' from line 17 (or close):
Code: [Select]


Should be replaced with where you want to redirect after the login.

And Where 'forums/member.php' from line 12 (or close):
Code: [Select]


Is the Path to your forum's member.php. Generally "forums/member.php".

If you need to add anything under on line 7 (or close):
Code: [Select]
echo "Hey, $mybbuser[username].

Thanks for logging in.";


Make it like:
Code: [Select]
echo "Hey, $mybbuser[username].

Thanks for logging in.
Your text here.";


To Add a link, do not use.
Code: [Select]
Link
But
Code: [Select]
Link

In other words, Do NOT use double quotes inside
Code: [Select]
echo ""

Use 's instead of "s.

Also, save the file (Which has the login form) as "something.php" and not "something.html" or "something.htm".
SimplePortal 2.3.7 © 2008-2024, SimplePortal