2005-07-25, 06:20 AM
I am making a custom website for a friend, and want to integrate myBB with this site. Basically, I just need to make the user database work with my site. How would I go about doing something of the likes of that?
Yaggles Wrote:I haven't actually made the user database yet. Could I just send queries from the website to the forum user database? Or would that also be hard?
Thanks,
-yaggles
mysql_connect('yourhost', 'youruser', 'yourpassword');
mysql_select_db('yourdb');
$username = $_POST['username']; //Username from your login form
$password = md5($_POST['password']); //Password from your login form
$result = mysql_query('SELECT password FROM mybb_users WHERE username = "' . $username . '" LIMIT 1');
if (mysql_num_rows($result) > 0) {
// There is a user
$user = mysql_fetch_array($result);
if ($user['password'] == $password) {
// Password is correct, log the user in
}
else {
// Password is Incorrect. Punish the user!
}
}
else {
//User does not exist
}
Chris Boulton Wrote:Changing MyBB to work with your existing user database would be alot of work to incorporate everything. Stay turned for MyBB Gold which will allow you to create/use your own "authentication" modules for user authentication with another database or product..
Chris Boulton Wrote:In terms of user authentication such as checking the password, you'll be able to use your own custom modules to do so - these modules will allow you to check a third party database for a matching username/password and then return it to MyBB.