Home  >  Article  >  Backend Development  >  How to implement points system in PHP forum

How to implement points system in PHP forum

Guanhui
GuanhuiOriginal
2020-05-20 17:07:353895browse

How to implement points system in PHP forum

How to implement the points system in PHP forum

First define a points field in the user table; then create a rating table whose main fields are Level name, upper limit points and lower limit points; then accumulate points according to the user's behavior; and finally determine which level range the user's points are in, thereby obtaining the user level.

User Table

CREATE TABLE `bbs`.`user` (
    `id` INT(10) UNSIGNED NOT NULL COMMENT 'UID' ,
    `avatar` VARCHAR(255) NOT NULL COMMENT '头像' ,
    `nickname` VARCHAR(60) NOT NULL COMMENT '昵称' ,
    `username` VARCHAR(16) NOT NULL COMMENT '用户名' ,
    `password` CHAR(32) NOT NULL COMMENT '密码' ,
    `points` INT(10) NOT NULL DEFAULT '0' COMMENT '积分' ,
    PRIMARY KEY (`id`)
) ENGINE = MyISAM;

Level Table

CREATE TABLE `bbs`.`level` (
    `id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT 'ID'
    , `name` VARCHAR(60) NOT NULL COMMENT '等级名' ,
    `top_points` INT(10) UNSIGNED NOT NULL COMMENT '上限积分' ,
    `down_points` INT(10) UNSIGNED NOT NULL COMMENT '下限积分' ,
    PRIMARY KEY (`id`)
) ENGINE = MyISAM;

Recommended tutorial: "PHP Tutorial"

The above is the detailed content of How to implement points system in PHP forum. For more information, please follow other related articles on the PHP Chinese website!

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