模仿OSO的论坛_PHP
相信每一个到过OSO的人都会对OSO的论坛留下极深的印象,这个论坛无论从那一方面来说都是比较出色的。你想不想你的主页也有这么一个漂亮的论坛呢,其实并不太复杂的,下面我们仅从一些基本的部分来实现对OSO论坛的模仿。
由于我仅仅是使用这个论坛作为我的留言板,所以我的论坛可以算是OSO论坛的简配。1、在我的论坛中只有在用户登录后才能发言,用户的ID是存在一个叫“cookie_user”的cookie变量中的,2、我的论坛没有子论坛,3、我没有统计一个主题的点击数,4、在OSO论坛中每一个主题前面的表示有没有新贴子的图标我也没设计,5、对于OSO论坛所提供的可选择的主题排列方式以及显示时间段我也没考虑,6、没有会员发贴积分的统计,7、没有版主管理论坛的功能,8、没有贴子编辑的功能。我们将在最后提到如何在我的程序基础上扩充这八项功能。
首先是一个数据库的设计,事实上一个论坛牵涉到两个数据表,我们暂且将其命名为user、guestbook,在user表中存储的是注册用户的信息。其创建语句如下:
create table my_user(
user_id char(12) not null,/*用户名*/
user_password varchar(8) not null,/*用户密码*/
PRIMARY KEY (user_id)
)
guestbook中储存的是贴子内容。其创建内容如下:
CREATE TABLE guestbook (
id bigint DEFAULT '0' NOT NULL auto_increment,/*发言id,自增字段*/
name varchar(12) NOT NULL,/*主题创建人*/
type tinyint NOT NULL,/*类型0-回复;1-主贴*/
theme varchar(50) NULL,/*主题*/
content blob NOT NULL,/*内容*/
icon tinyint NOT NULL,/*表情图标*/
time_open datetime not NULL,/*主题创建时间*/
time_close datetime not NULL,/*最后回复时间*/
answer_count int not null,/*回复数*/
answer_name varchar(12) not null,/*最后回复人*/
main_id bigint null,/*主贴id*/
PRIMARY KEY (id)/**/
);
程序包含五个php源代码:分别是connect.inc.php,faq.php,read.php,post.php,reply.php,post_end.php
connect.inc.php:(用来连接数据库)
$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:(用来显示主题列表)
只有会员才能在此发言
分页: $page1=$page-1; $page2=$page 1; if ($page==1) echo "首页 前页 "; else echo "首页 前页 "; if ($page==$totalpage) echo "后页 尾页 "; else echo "后页 尾页 "; ?> |

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

The discuz forum is an online forum software, also known as BBS. It is a program system used to establish forum communities on the Internet. Zhiyo's powerful forum software can help users build a professional and complete forum community, and can implement a variety of functions, such as building user registration, logging in, viewing topics, publishing posts, making comments, setting up moderators, etc. Allow users to easily manage and maintain the forum community.

Usually, the main function of a robot is to complete some simple operating tasks. We hope that the robot can imitate people and make its capabilities as close as possible to human levels. Whether it is Xiaomi's CyberOne or Tesla's Optimus, people are mainly concerned about its number of mechanical joints, control algorithm and walking speed. However, in this field, some people are exploring more imaginative directions: Now, there is a robot that can imitate real human expressions to the extreme: try taking a selfie first. From "disgust" to "surprise", everything can be completely synchronized: This robot is called Ameca, and it is a weird expression. In addition to imitating, it can also make many small expressions when looking in the mirror, making it look very much like a real person. Ameca "pretends" to see the mirror for the first time,

Discuz forum permission management: Read the permission setting guide In Discuz forum management, permission setting is a crucial part. Among them, the setting of reading permissions is particularly important, as it determines the scope of content that different users can see in the forum. This article will introduce in detail the reading permission settings of the Discuz forum and how to flexibly configure it for different needs. 1. Basic concepts of reading permissions In the Discuz forum, reading permissions mainly include the following concepts that need to be understood: Default reading permissions: Default after new user registration

In today's era of rapid technological development, programming languages are springing up like mushrooms after a rain. One of the languages that has attracted much attention is the Go language, which is loved by many developers for its simplicity, efficiency, concurrency safety and other features. The Go language is known for its strong ecosystem with many excellent open source projects. This article will introduce five selected Go language open source projects and lead readers to explore the world of Go language open source projects. KubernetesKubernetes is an open source container orchestration engine for automated

PHP forums include: 1. PHP Forum, the forum section of the PHP official website, which is an important platform for communication among PHP developers; 2. phphub, a well-known PHP technology community in China and one of the largest PHP technology forums in China; 3. Laracasts, an online learning platform for the Laravel framework; 4. Reddit PHP, a world-renowned social news aggregation website; 5. SitePoint, a comprehensive technology community that provides everything from web design to development.

Laravel is a popular PHP framework that is highly scalable and efficient. It provides many powerful tools and libraries that allow developers to quickly build high-quality web applications. Among them, LaravelEcho and Pusher are two very important tools through which WebSockets communication can be easily implemented. This article will detail how to use these two tools in Laravel applications. What are WebSockets? WebSockets

"Go Language Development Essentials: 5 Popular Framework Recommendations" As a fast and efficient programming language, Go language is favored by more and more developers. In order to improve development efficiency and optimize code structure, many developers choose to use frameworks to quickly build applications. In the world of Go language, there are many excellent frameworks to choose from. This article will introduce 5 popular Go language frameworks and provide specific code examples to help readers better understand and use these frameworks. 1.GinGin is a lightweight web framework with fast

Lin Feng Social Forum Mini Program | H5 Forum | App Forum is a front-end and back-end separated social forum Q&A post/BBS project developed by java+vue+uniapp, including forum graphic posts, videos, circles, IM private chat, WeChat payment, and paid posts. , points check-in, wallet recharge and other forum mini-program forum app complete functions.
