Integrating user login systems of 2 apps into one

software development

#1

I have a little PHP/MySQL app with a basic signup and login system. It’s nearly ready to go online so I just signed up for hosting with DH. My problem is I want to set up an accompanying blog (blog.mydomain.com) where only my users are able to comment (without having to re-login, of course).

I need a way to have a common login for my app and whatever blogging software I choose (haven’t decided yet). Your kind suggestions are appreciated and btw this is my first hosting account so consider me a total newb to hosting.


#2

It seems you are quite familiar with PHP ad MySQL. Usually I purposely separate the users of the main site and blog or forum because your main site won’t be affected if anything is wrong with your blog or forum (or you want to remove them some day).

If you want to put them together, I think you can try to modify your signup page and insert the data to blog’s database instead of yours. You can export the entire blog’s database and find user table. Then you should know the rest.

$50 off and 3 free domains with code: [color=#CC0000]DH3[/color] Sign Up NOW or More Codes Here


#3

Thanks patricktan. Actually I’m not that comfortable with PHP/MySQL as there’s only so much you can learn from books :wink:

After reading your suggestion I tried a few CMS and blogging apps on my localhost (Habari, b2evolution, Joomla… also phpBB!). I looked at the db tables and code for clear-cut hooks. Honestly the code was too much for li’l inexperienced me it made me dizzy. When I popped in the support forums there’s so much queries about integration you’d think the developers would’ve made it a lot easier by now. Guess not.

I’ll give a shot at hacking Habari to show different comment forms to logged-in users than visitors as I need to accomplish 2 things:

  1. Logged-in users should not have to input anything besides their comment.
  2. Checks to differentiate user-submitted comments from visitor-submitted ones so I can display them distinctly with a link to their profile page within my app.

If you have a minute please share some thoughts or point me to a resource.


#4

This gonna be difficult for you. I haven’t tried it yet but I hope you can get some thing from my suggestions.

Usually there is a user table in blog’s database. It stores user’s particulars and password. You will need to link your registration and login page to blog’s user table. You will also need to check the login page of the blog. See what sessions it creates for logged in user. You will need to create the same ones in order for your logged in users to access blog.

You will need to check the database again. You will need a user_id (something like this) in your comment table. If the comment is submitted by a logged in user, store the user_id for the comment. If not, store a null value. When you display the comment, retrieve and display the user_id as well. Once you have the user id, you will be able to link to user’s profile page.

This is not detailed enough but to give a rough idea. It will be too much to explain everything in one post.

Good luck!

$50 off and 3 free domains with code: [color=#CC0000]DH3[/color] Sign Up NOW or More Codes Here


#5

If I can pull that off it would definitely be worth the time. Thanks again.