The problem may come from the comparison of $_SERVER['HTTP_REFERER'] with the $main_url you have specified in settings.
The most common mistake when setting up the forums (or any other domain) is to keep both 'www' and non-www versions of the same domain pointing to the same website.
If you have set up $main_url for miniBB having 'www' in it, then you might enter your domain without 'www' which is obviously a very different thing, but it will give you an impression you are entering the same site, at the time it is not.
You need to set up .htaccess to redirect from non-www to www-version, if 'www' is set up under $main_url. Or otherwise, if you would like to run the forums from www version, .htaccess must redirect from www to non-www.
As you might know, it's also useful for search engines - they all prefer to avoid duplicate content on different domains.
This is also related to cookies - www and non-www domains are very different things in terms of security.
So, for the forums, you must have only one domain set up. If you don't know what kind of code to put under .htaccess, just reply and I will try to find the proper piece on my HDD.