MyBB Community Forums

Full Version: Call up forum db table based on requested url?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello,

I have been struggling with something and I wanted to see if anyone has any ideas if what I want to do is even possible.

I have set up an install of MyBB at http://www.studyany.com/mybb . By using .htaccess I have managed to get it so when a user types in http://www.studyany.com/mybb/tester1/index.php they also can view the same MyBB forum. The two forums, mybb and tester1 are actually running off of the same set of files. Notice that if you visit http://www.studyany.com/mybb/tester1/ you get a dir listing. Also, *most* of the links on the tester1 forum appear in the browser as leading to tester1/file rather than the actual location, mybb/file.

What I want to do is have MyBB pull up the appropriate database tables for a forum based on the URL that an individual requests via the browser. IE, typing http://www.studyany.com/mybb/tester1/index.php ideally would pull up the mydatabase_tester1 table, whereas typing http://www.studyany.com/mybb/tester2/index.php would pull up the mydatabase_tester2 table, ect, regardless of whether or not the table exists.

Another possible option I see is requesting a config.php and Settings.php from the requested directory name, instead of where the files are actually located, IE I could have no actual files in http://www.studyany.com/mybb/tester1/ but I could have an inc folder with Settings.php and config.php inside of the tester1 folder.

I've already tried messing with Mod_Alias to redirect file system requests for config.php and Settings.php but that always gives 500 server errors. I also tried messing with some other code and the MYBB_ROOT and TABLE_PREFIX defintions with no luck. If anyone has any ideas on how to accomplish I would really appreciate the input.

BMR777
An attempt at a multi-forum script?

I could tell you what to do, but I think it'd be better if you studied how MyBB works underneath, otherwise, you're just going to get hit by more problems.







Okay - how about actually modifying config.php to detect which URL was sent? Use appropriate functions to determine the requested URL, and feed the information into the $config variable.
Oh, and I presume you're proficient in input sanitizing, or else you could get some nasty surprises.
Thanks. I am actually nowhere near releasing such a script, but I wanted to see if I could even figure out how to do something like this. Thanks for the starting points.
Reference URL's