Just thought I'd try and see if anyone knows the answer to this here.
I know it's possible for TWO different sites to use the same database.
Let me explain.
I have siteA and it runs a forum. Through the site, users of the forum can login using their forum ID. I now create siteB on a different domain, but on the same hosting service. I want users from siteA to be able to login with their name from that site on siteB.
How would I do this? I'm using myBB as my forum software.
maxymizer
12-10-2006, 11:04 PM
Your problem is how to maintain users from your forum on your (custom) built website using forums' database?
Uh, my problem is I want users to be able to login on both sites through the one forum's database of users.
Users can login on my main site: www.twistedportal.com with their forum ID's.
I hope that answers your question. I also hope you can help. ;)
maxymizer
12-10-2006, 11:12 PM
You need to pick with myBBs authentication code. In phpBB there was a simple solution - you needed to include only one file and you have an array available containing user info. Also, on the site you could put a login form, and the forms target would be phpBBs php file for logging users in. There was also an option for redirect in case of a successful login. Maybe myBB has similar functionality already. I have never used it, and I could play with its code but frankly, I don't have time nor will to do something like that. :)
I honestly think it has something to do with the SQL, not really any php.
I have login forms on the sites, they run fine.
maxymizer
12-10-2006, 11:56 PM
You store data to a database. PHP pulls it out, initiates sessions, sets cookies and thus maintains user logins across your forums' pages and domain(s).
I don't really see why you think it's SQL-related. You can use the same queries on your website that's on the other domain, but you still need php to set session data and that's what I'm talking about. So what's required - to tamper with your forums' authentication code and to use the same thing on your website (or a rewrite of the same thing).
What I suggested is to see if that forum software has the feature to allow you to avoid custom coding, as most of free forums already have mentioned feature.
I also assumed you're using the same MySQL connection info on your website as on the forum.
Having the mentioned in mind, the problem boils down to:
1) looking if your forum has an option to provide other scripts with (logged) users info
2) if not, create a script that sets the same sessions/cookies as your forum, bearing in mind that the cookie should be set so that it can be read by your other domain(s) since cookies are readable only by domains that set them.
azizny
12-11-2006, 08:03 AM
Open your configuration file (that contains mysql connection info) on site A, and copy it on to SiteB.
Since they are on the same server, server:localhost should work on both.
Peace,
Open your configuration file (that contains mysql connection info) on site A, and copy it on to SiteB.
Since they are on the same server, server:localhost should work on both.
Peace,
Turns out my host seperated my two sites onto two different servers.
All is well now.
Zimdale
12-12-2006, 08:16 PM
If I understand what your asking yes it is very possible and not to dificult if you have a basic understanding on database work.
Basically you want another forum on a different site to use part of a totally different forums database rite?
Pretty much what you would have to do is go into the coding of the second site(The site you want connected to the first sites database) and change the login to the first sites database. Then in the cpanel of the first sites database you would have to allow that servers IP onto the forum database and wala.
Sounds easyer then it is I left out the hours upon hours of testing and bug fixing.
I did something like that to a forum just a little while ago. It wasn't really another forum using the database but it was building a phpchat into a phpbb forum which is basically the same concept.