Imitating OSO's Forum (1) _ PHP Tutorial

Source: Internet
Author: User
Imitating OSO forums (1 ). I believe that everyone who has been to OSO will leave a deep impression on the OSO Forum, which is both outstanding in that aspect. If you don't want this on your homepage, I believe that everyone who has been to OSO will be very impressed with the OSO Forum. This Forum is excellent in both aspects. If you don't want your homepage to have such a beautiful forum, it is not very complicated. below we will only imitate the OSO Forum from some basic aspects.
Since I only use this forum as my message board, my forum can be regarded as a simple configuration of the OSO Forum. 1. in my forum, the user can only speak after login. the user ID is included in a cookie variable named "cookie_user". 2. my forum has no sub-forum, 3. I did not count the clicks on a topic. 4. I have not designed any icons for new posts in front of each topic in the OSO Forum, 5. I did not consider the optional topic arrangement methods and display time periods provided by the OSO Forum. 6. no member posting points statistics. 7. no moderator management forum function, 8. no sub-editing function is available. We will talk about how to expand these eight functions based on my program.
The first is the design of a database. In fact, a forum involves two data tables. now we name them user and guestbook, and the user table stores the information of registered users. The creation statement is as follows:
Create table my_user (
User_id char (12) not null,/* User name */
User_password varchar (8) not null,/* User password */
Primary key (user_id)
)
The post content is stored in the guestbook. The created content is as follows:
Create table guestbook (
Id bigint DEFAULT '0' not null auto_increment,/* speech id, auto-increment field */
Name varchar (12) not null,/* topic creator */
Type tinyint not null,/* type 0-reply; 1-primary sticker */
Theme varchar (50) NULL,/* topic */
Content blob not null,/* content */
Icon tinyint not null,/* emoticon icon */
Time_open datetime not NULL,/* topic creation time */
Time_close datetime not NULL,/* last reply time */
Answer_count int not null,/* number of replies */
Answer_name varchar (12) not null,/* last responder */
Main_id bigint null,/* primary id */
Primary key (id )/**/
);
The program contains five php source codes: connect. inc. php, faq. php, read. php, post. php, reply. php, and post_end.php.
Connect. inc. php :( used to connect to the database)
$ Dbhostname = "localhost ";
$ Dbusername = "";
$ Dbpassword = "";
$ DbName = "";
MYSQL_CONNECT ($ dbhostname, $ dbusername, $ dbpassword) or die ("Unable to connect to database ");
@ Mysql_select_db ("$ dbName") or die ("Unable to select database ");
?>


Faq. php: (used to display the topic list)
Problem




Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.