If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > ASP > how to make an asp forum

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 07-09-04, 16:32
yellowbleep yellowbleep is offline
Registered User
 
Join Date: Jul 2004
Posts: 3
how to make an asp forum

hi! if i want to make a forum using asp, how to make relation between tables? in access or with dreamweaver coding or else? Can u help me find tutorials to make a forum? thanks a lot
Reply With Quote
  #2 (permalink)  
Old 07-09-04, 20:46
MrWizard MrWizard is offline
Registered User
 
Join Date: Mar 2003
Location: Atlanta, GA
Posts: 191
Your desire to write an ASP forum is curious... given the complexity of such a chore and the obvious newbie questions about how to start.

Why not just use one of the many totally FREE ASP Forum applications out there. MegaBBS, Snitz, WebWiz... all offer their code for free. Since they've been around for a while, they're also fairly bug free. There are many more out there also.

So, unless you're just looking to torture yourself....?

Tim
__________________
Tim
Reply With Quote
  #3 (permalink)  
Old 07-11-04, 00:00
Seppuku Seppuku is offline
Useless...
 
Join Date: Jul 2003
Location: SoCal
Posts: 721
Relationships are managed at the database level.

If you have a table of users, and a table of messages, your user table will have an ID number, and the messages table will have a field that relates to the users table.

tblUsers
ID - primary key field, Integer, Indentity seed starting at 1, incrementing 1
LoginID - nvarchar
Name - nvarchar

tblForums
ID - primary key field, Integer, Indentity seed starting at 1, incrementing 1
Forum - nvarchar
Description - nvarchar

tblMessages
ID - primary key field, Integer, Indentity seed starting at 1, incrementing 1
ForumID - key field, integer
UserID - key field, integer
TimeStamp - smalldatetime

Now when you want get the messages for a forum, you use an SQL JOIN.

SELECT * FROM tblMessages m INNER JOIN tblUsers u ON m.UserID = u.UserID INNER JOIN tblForums f ON m.ForumID = f.ForumID WHERE f.ForumID = <forum number>

You can set up constraints on the tables that ensure that a User and Forum exists for every message in the table. You could even set up a cascading delete that would automatically remove rows from the messages table if the user was removed... but use that with care.. you can create data integrity issues doing so.
__________________
That which does not kill me postpones the inevitable.
Reply With Quote
  #4 (permalink)  
Old 07-13-04, 01:32
yellowbleep yellowbleep is offline
Registered User
 
Join Date: Jul 2004
Posts: 3
Mr. wizard, actually i'm really a newbie in asp, i want to know how it works. I know i'll torture myself... hahaha, it's inevitable, right?

Seppuku, Thanks for the tips on sql. It really helps.
Reply With Quote
  #5 (permalink)  
Old 07-13-04, 01:39
Seppuku Seppuku is offline
Useless...
 
Join Date: Jul 2003
Location: SoCal
Posts: 721
Half of your work will be DB and SQL design. If you have the option, go with a database server such as Microsoft SQL Server or mySQL. Avoid Microsoft Access if at all possible. Then research Stored Procedures, and develop your forum around them. They provide enhanced security, and increased performance.

Let SQL handle the logic of what rows to retrieve, then use ASP to simply display that information returned. The fewer number of rows and columns transfered from database server to web server, the better.
__________________
That which does not kill me postpones the inevitable.
Reply With Quote
  #6 (permalink)  
Old 07-13-04, 01:57
Seppuku Seppuku is offline
Useless...
 
Join Date: Jul 2003
Location: SoCal
Posts: 721
Oh, and you'll need a user registration page that allows you to register new users by adding a new row to the tblUsers table. Make sure you encrypt the password. Look up MD5. There are several scripts out there that will convert a string into a MD5 hash that is unidirectional. If you can't find one, let me know, I have one here somewhere.

So your new user will provide a loginID, password (and confirmed password) and email address as a minimum amount of information. When submit, first check to make sure the loginID isn't already taken. Use SQL to do this check (don't get all the rows in tblUsers and then use ASP to loop through the recordset, instead, use a WHERE clause in your SQL ...WHERE LoginID LIKE 'bob', don't forget to use stored procedures). If the ID doesn't already exist, do a SQL INSERT (again, through a Stored Procedure) to add the row, but make sure you have a flag that says that they are probationary. Either use CDONTS, ASPMail, or other email component to send an email to the user with a link to an ASP page that changes that flag to an active status.

Then when you log the user on, check to make sure that the loginID and MD5'ed ENTERED password match a loginID and MD5'ed STORED password in the DB. If so, create a cookie which validates their authentication for the duration of their visit, then redirect them back to the forum. When you're working with cookies, you have to write them before anything else is written to the browser (but cookies can be *read* at any time in the ASP script), and secondly, redirects have to be called before any text is written to the browser. Redirects and new/update cookies are sent as Headers, which cannot be sent after text is written because the rest of the Headers are automatically sent with the first bit of HTML (unless you manually remove them all).

When I do logins, I have an ASP page that does not write any HTML. It simply takes form inputs, does the validation from the DB, writes an authentication cookie if necessary, and does a redirect.
__________________
That which does not kill me postpones the inevitable.
Reply With Quote
  #7 (permalink)  
Old 07-18-04, 11:31
yellowbleep yellowbleep is offline
Registered User
 
Join Date: Jul 2004
Posts: 3
wow... thanks a lot seppuku, your explanation is very clear. but, unfortunately right now i only know microsoft access. but i understand the logic.

what about the table? do i make 1 table for each topic and 1 table for user?
(i inted to make a very simple asp which has basic function of forum like add thread, add user, view details, admin add topic, etc.)
Reply With Quote
  #8 (permalink)  
Old 07-18-04, 13:08
Seppuku Seppuku is offline
Useless...
 
Join Date: Jul 2003
Location: SoCal
Posts: 721
In a very basic forum, you'd need at least three forums. Check out post #3 in this thread.
__________________
That which does not kill me postpones the inevitable.
Reply With Quote
Reply

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

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