Home  >  Article  >  Backend Development  >  BBS design based on mysql (1)_PHP tutorial

BBS design based on mysql (1)_PHP tutorial

WBOY
WBOYOriginal
2016-07-21 16:03:291151browse

1. System architecture:
Adopts modular thinking and is divided into 3 layers:
a. Data storage layer: use mysql to store all data of bbs, including user information,
article data, user letters, user messages, system data (?), key questions:
whether to use files to assist database planning .
b. System functional layer: completes the basic functions of bbs, composed of multiple parallel modules, downward
calling mysql functions to access the database, upward, accepting processing requests, and returning the processed
results to the upper layer. According to the request type, return Success or failure results and other data. Moreover,
the module is highly flexible and can be easily modified and added. Including:
** User module, handles user registration, modification of basic data, changes in permissions,
​ Query of netizen information.
** The layout module completes article publishing, article reading, article deletion, article marking
, and read, modify, and delete permission checks. This module has the highest requirements for the database.
** The essence area module includes articles in the essence area, adding, deleting, and moving up and down directories.
(?) Read, modify, and delete permission checks. The directory structure is one of the difficulties.
** Letter module, including sending new letters, reading and deleting letters, letter mark, notification of new letters
Notification
** Message module, including sending messages, receiving messages, new message notifications, message review,
Messages are stored in letters.
** System dynamic module, including the current number of people on the site, current dynamics, due to frequent changes,
​ It may be better to use shared memory to implement this type of data.
** In the chat module, can the two-person chat learn from the practice of icq, with both parties talking directly?
But it may be troublesome to save the chat results. At the same time, in order to be compatible with the telnet function, when
the upper service layer is telnet When, add special modules for processing.
** Chat room module, use shared memory or database? Opening a room, permissions inside
problem.
New functions can be added as needed. For example: activity signage module, but for non-
Telnet terminals, it seems to have little meaning. . . . .
c. Service layer: Talk directly to the client. According to the client's request, call the function module to obtain
data, and then send the data back to the client. According to the type of client, develop different
service modules respectively, and try our best to Properly abstract so that different service layers can share
modules of the system function layer. Specifically include:
++ cq66 server, adopt the original cq66 method, and re-plan the protocol to support all functions of the system function
, but use a special client program (cq66), if it can be done It would be better to be compatible with
downwards. The client program needs to be upgraded with the upgrade of the server. Users may have
some inconvenience. If necessary, encryption function can be added during the transmission process, similar to ssh.
++ Telnet server uses the old bbs method. Some functions are not supported. The client does not need to be upgraded. The server needs to save the client's status and judge the status transfer according to the client's keys. , and obtain the required data (such as reading an article), and then request the data from the system functional layer, and then process the data (such as adding the top row,
the last row) and then Returning data can be modified on the existing bbsd. It can save the design of the io module
but it is more difficult. Except for the article, it is more difficult to modify, but it is too laborious to write from scratch
.
++ The httpd server requires fewer functions and is relatively simple. Originally, calling mysql directly
The database is also fine. You can directly use PHP, but considering the principle of layering, it is recommended to still use C to compile
🎜> I wonder if it can be modified based on the original implementation using cgi? Probably not.
Key points and difficulties of the system:
a. Database design, does mysql support a large number of tables? For example, tens of thousands? Each
user has at least one table, and then each version has one table. The table structure in the essence area may be more complex.
But it should always be clearer and more efficient than the current bbs file structure. You can trust mysql for sorting
and cache functions.
b. The size limit of text fields in mysql is to limit an article to no larger than 64k.
And from an efficiency point of view, it may be better to store an article in blocks of up to 2k.
In this way, when When a telnet user reads an article, the telnet server does not need to query the database every time
Read dozens of kilobytes of data, and then pass 2k of them to the user, which can partially compensate for the database fields
which cannot be read from the middle like a file Take a portion. However, the management of article field data
is more complicated.
2. System development plan:
Consider the user module and layout module first, and plan the data structure. It should be easy to
combine with the existing bbsd. And then consider other modules? . . . . . . .
(//I will write the following when I have time... Go to bed first...hmm......)
3. Database design
4. User module design
5. Layout module design
6. bbsd and cq66 server-side modification
7. Preliminary test plan.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/316248.htmlTechArticle1. System architecture: Adopts modular thinking and is divided into 3 layers: a. Data storage layer: use mysql to store all data of bbs, including user information, article data, user letters, user messages...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn