Here is how you can use your own login authorization script to set a cookie that MiniBB will recognize and use to automatically authorize the user within the forums as well:
First, check out this article:http://www.minibb.com/synchronizing_minibb.html
You are specifically looking for how to set up your users database so that it can be shared between your own system and MiniBB. If you are building your own database and authorization, not all of the information in that article will be relevant, only the part about including the appropriate MiniBB fields in your database and storing passwords as MD5 hashes.
Assuming you have your database set up correctly, here are the steps to set a cookie that MiniBB will recognize.
Towards the top of your custom php login script, require the setup_options.php file:require_once("forums/setup_options.php");
That allows you to access the various cookie parameters you should have set in the setup_options.php file when you installed MiniBB.
Next, you will need to include this function, which converts the password submitted by the user via your login form to an MD5 hash:
Don't forget to actually pass the posted password to the function, and save the hash in a variable:
$hashed_pass = writeUserPwd($password);
Now, set the cookie expiration time:
Note that $cookie_expires is a variable set in the setup_options.php file.
Finally, (assuming that you have verified the user in whatever manner you choose for your own purposes,) set the cookie:
setcookie($cookiename, $username.'|'.$hashed_pass.'|'.$cookieexptime, $cookieexptime, $cookiepath, $cookiedomain, $cookiesecure);
Note that $cookiename, $cookiepath, $cookiedomain, and $cookiesecure are all variables set in setup_options.php. I suggest that the value for $cookiepath be set to "/", which allows all scripts at the root level in the html directory on the server to access the cookie.
If you use variable names other than $username or $password in your script to hold the username and password values, you will need to change the variable names in these lines of code.
It is also a wise idea to include a couple of lines in your logout script that deletes the cookie:
setcookie($cookiename, "", time()-3600);
You may also want to dissable the login/logout stuff in MiniBB, since you are using your own authorization system. Look elsewhere in these forums for info about that.
Hope this helps someone.