TalkPHP

TalkPHP (http://www.talkphp.com/forums.php)
-   Advanced PHP Programming (http://www.talkphp.com/advanced-php-programming/)
-   -   Another dbstructuring help.. (http://www.talkphp.com/advanced-php-programming/3051-another-dbstructuring-help.html)

Tanax 07-02-2008 12:48 PM

Another dbstructuring help..
 
Hi!

I tried like.. some months ago and code my first forum. Turned out pretty well. Very.. newbish, but nevertheless it worked.

I'm about to create a more advanced now, like a version 2.
And I'm wondering how you guys would set up your db to maintain an easy way of accessing categories(and noticing the difference between a regular forum and a category), threads, posts, and ofcourse users.

I'm looking for some basic functionality here, but still kindof advanced. So.. any suggestions?

drewbee 07-02-2008 01:37 PM

A forum system is a very huge thing.

You would need several tables:

as a very basic setup, you would need the following tables

accounts
forums
forum_posts

Forums is your categories, forum_posts contains the data or text posted by the users.

It really depends on what you are trying to do. You can make these extremly advanced or extremly small.

Tanax 07-02-2008 02:31 PM

Yea, but I meant like.. how about columns? And stuff.. ?

drewbee 07-02-2008 02:36 PM

lol. Well, we need to know what you want to do. If i were to put an extremly basic setup on my site for a forum system, I would have it like the following:

forums:
forum_id, forum_name, forum_description, forum_lastpost, forum_lastpost_author_id, forum_order, forum_active

forum_posts
post_id, forum_id, post_title, post_content, post_created, post_updated, post_author_id

Tanax 07-02-2008 05:11 PM

Mmm, I was thinking something like this:

Code:

-forums
--forum_id
--forum_iscat
--forum_parent
--forum_name
--forum_desc
--forum_order
--forum_isactive

-threads
--thread_id
--thread_forumid
--thread_authorid
--thread_topic
--thread_content

-posts
--post_id
--post_threadid
--post_authorid
--post_title
--post_content

-users
--user_id
--user_name
--user_password
--user_groupid
--user_isbanned

-groups
--group_id
--group_name
--group_desc


Just wondering how I could add permissions to each usergroup though...

drewbee 07-02-2008 05:16 PM

Ah see, now were getting somewhere. You even made a seperate table for the threads, nice!

One thing that I point out is that if you are going to make a ACL, you wouldn't have is_banned in the user table. You would simply have them assigned to the 'banned' usergroup, which would restrict access to everything.

Trying to make an ACL (Access control list)? Good luck with that! I have made but very little, highly unflexiable ACL's before.

Try googleing around for ACL tutorials though, there are several tutorials out there for storing and managing ACL's. This is something I need to do myself... I've always used a pretty basic ACL (incremental), but for a forum system you need something far more complicated then that.

Tanax 07-02-2008 05:22 PM

Quote:

Originally Posted by drewbee (Post 16443)
Ah see, now were getting somewhere. You even made a seperate table for the threads, nice!

One thing that I point out is that if you are going to make a ACL, you wouldn't have is_banned in the user table. You would simply have them assigned to the 'banned' usergroup, which would restrict access to everything.

Trying to make an ACL (Access control list)? Good luck with that! I have made but very little, highly unflexiable ACL's before.

Try googleing around for ACL tutorials though, there are several tutorials out there for storing and managing ACL's. This is something I need to do myself... I've always used a pretty basic ACL (incremental), but for a forum system you need something far more complicated then that.

Yea, I was thinking about that.. but since I didn't have a permission thing.. I thought I'd add it anyways.

Okay :O I'll search for it, thanks!!


All times are GMT. The time now is 08:53 PM.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0