TalkPHP
 
 
Account Login
Latest Articles
» The basic usage of PHPTAL, a XML/XHTML template library for PHP
» Vulnerable methods and the areas they are commonly trusted in.
» Simple way to protect a form from bot
» The Basics On: How Session Stealing Works
» How to keep your forms from double posting data
IRC Channel
IRC Speech Bubble Join the friendly bunch on IRC...
(#TalkPHP on Freenode)

...Also available via a web interface.

See this thread for information on the TalkPHP Free Hugs Initiative™. Subject to availability.
Associates
Associates
CSS Tutorials
Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old 07-02-2008, 12:48 PM   #1 (permalink)
The Prestige
Upcoming Programmer Inquisitive 
 
Tanax's Avatar
 
Join Date: Sep 2007
Location: Sweden, Stockholm
Posts: 1,080
Thanks: 115
Tanax is on a distinguished road
Default 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?
Tanax is offline  
Reply With Quote
Old 07-02-2008, 01:37 PM   #2 (permalink)
The Acquainted
 
drewbee's Avatar
 
Join Date: May 2008
Posts: 175
Thanks: 9
drewbee is on a distinguished road
Default

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.
__________________
There are No Stupid Questions. But there a LOT of Inquisitive Idiots.
Send a message via AIM to drewbee
drewbee is offline  
Reply With Quote
Old 07-02-2008, 02:31 PM   #3 (permalink)
The Prestige
Upcoming Programmer Inquisitive 
 
Tanax's Avatar
 
Join Date: Sep 2007
Location: Sweden, Stockholm
Posts: 1,080
Thanks: 115
Tanax is on a distinguished road
Default

Yea, but I meant like.. how about columns? And stuff.. ?
Tanax is offline  
Reply With Quote
Old 07-02-2008, 02:36 PM   #4 (permalink)
The Acquainted
 
drewbee's Avatar
 
Join Date: May 2008
Posts: 175
Thanks: 9
drewbee is on a distinguished road
Default

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
__________________
There are No Stupid Questions. But there a LOT of Inquisitive Idiots.
Send a message via AIM to drewbee
drewbee is offline  
Reply With Quote
Old 07-02-2008, 05:11 PM   #5 (permalink)
The Prestige
Upcoming Programmer Inquisitive 
 
Tanax's Avatar
 
Join Date: Sep 2007
Location: Sweden, Stockholm
Posts: 1,080
Thanks: 115
Tanax is on a distinguished road
Default

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...
Tanax is offline  
Reply With Quote
Old 07-02-2008, 05:16 PM   #6 (permalink)
The Acquainted
 
drewbee's Avatar
 
Join Date: May 2008
Posts: 175
Thanks: 9
drewbee is on a distinguished road
Default

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.
__________________
There are No Stupid Questions. But there a LOT of Inquisitive Idiots.
Send a message via AIM to drewbee
drewbee is offline  
Reply With Quote
The Following User Says Thank You to drewbee For This Useful Post:
Tanax (07-02-2008)
Old 07-02-2008, 05:22 PM   #7 (permalink)
The Prestige
Upcoming Programmer Inquisitive 
 
Tanax's Avatar
 
Join Date: Sep 2007
Location: Sweden, Stockholm
Posts: 1,080
Thanks: 115
Tanax is on a distinguished road
Default

Quote:
Originally Posted by drewbee View Post
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!!
Tanax is offline  
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


All times are GMT. The time now is 11:33 PM.

 
     

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Inactive Reminders By Icora Web Design