My forum source code (1)_PHP tutorial

WBOY
Release: 2016-07-21 16:03:57
Original
920 people have browsed it

In fact, it only took me three days to write these codes. There was no detailed thinking or planning beforehand (it can be said that there was no plan at all). That day I thought of trying to make a forum, so I started to do it, and I just got in touch with it. I have been using PHP for nearly a month, and I have never really written anything like a program before. During the two and a half days of writing this code, I encountered difficulties several times and wanted to give up, but I still wrote it. And I didn't expect it to work, so there may be many hidden dangers that I can't explain, even though it is said to be usable.
In two days, I will go to work, and I won’t have time to carefully check these codes from beginning to end. This is one of the reasons why I put it up. Another reason is because I want everyone to see it. Let's take a look at these characters. I'm just a novice. There may be many shortcuts that I haven't taken, and there may be many things that are wrong. In the past two days, I have changed the code of some pages, but other related codes have not been removed, so there are some places. A bit repetitive. But it can run normally, that's for sure (at least it looks normal on the surface. I have no problem using it under WIN98/APACHE/PHP/MYSQL, and it has no problem when testing online. I don't know about other environments. I just hope it will work with me. What can newbies like me, or novices who are better than me, get from it, and if veterans and seniors can write or leave messages to point out the shortcomings or shortcomings, I will be more happy, because in that case, I will also be happy. I can learn a lot from it. My email address is: hllinyu@netease.com, OICQ: 2289230, and the homepage address is: http://lfox.oso.com.cn
Okay, too much nonsense. , I hope everyone can invest in modifying the source code of this forum, so that it can become a free forum developed by the Chinese themselves, and let the forum code become the source of many friends like me who are very interested in PHP but feel unable to start. The reference materials we have are enough. Let’s take a look at my forum!
First of all, I will introduce the two tables to be used: foxbbs to store post information and useinfo to store user information. Because the data space is not very large at first. So I chose the MYSQL+TXT method. All topics except the content are stored in MYSQL, and the topic content and reply content with relatively large data volume are stored separately in TXT format with extensions of .FOX and .BBS. In the file, just add a field to store the file name in the table. In order to avoid duplication of file names, use the current system time as the file name. For example, a post was posted at 11:20:30 on January 2, 2001. , the file name is 20010102112030.txt. I think this can meet most of the requirements, because there may not be many forums that are so popular that two or more new posts appear every second! Haha...
The specific information of this forum can be found at http://lfox.oso.com.cn/foxbbs/foxbbs.php. In addition, the source code package download is provided on the main page http://lfox.oso.com.cn/index.php. See Don't mess with it if you have the source code.

useinfo user information table
0 usename varchar(8) not null Username
1 usepass varchar(8) not null Password
2 useni varchar(30) not null Nickname
3 useoicq varchar(12) not null
4 usesex int(1) not null User gender
5 useage int(2) not null User age
6 usezy(4) Not null Career
7 useaddr varchar(20) not null address
8 usemail varchar(40) not null email
9 useweb varchar(50) not null home page
10 useqm varchar(240) not null signature
11 useattr int (1) Not null Attribute 1 User 2 Moderator 3 Administrator 4 Webmaster
12 useinf int(1) Not null Whether the information is public 1 No 2 Yes
13 useid int(5) not auto_increment Primary key User ID Number
14 usebq int(1) not null expression
15 regdate datetime; registration time
16 enddate varchar(22) not null last arrival time
17 ftnum int(4) not null post Number
18 usety char(1) not null


foxbbs forum topic table
0 id int(5) not auto_increment primary key
1 usename varchar(20) NOT posting user Name
2 ftbq int(1) not Expression
3 title varchar(40) not Topic
4 ftdate varchar(22) not Posting time
5 mesname varchar(15) not Content file name 20010102055635 me Leave one extra person in case of accidents. In fact, fourteen people are enough.
6 djnum int(4) not number of clicks
7 hfnum int(3) not number of replies
8 hfdate varchar(24) not last reply time
9 hfname varchar(20) not reply file name
10 hfusename varchar(20) not Last reply name
11 ip varchar(15)
12 lockes int 1

linkfox.inc.php connects to the database using
$dbhostname = "lfox";
$dbusername = "root";
$dbpassword = "root";
$dbName = "flyfox";
MYSQL_CONNECT($dbhostname, $dbusername, $dbpassword) OR DIE("Unable to connect to database");
@mysql_select_db( "$dbName") or die( "Unable to select database");
?>

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/316077.htmlTechArticleIn fact, it took only nearly three days to write these codes, without detailed thinking and planning in advance (it can He said he had no plan at all) I thought of setting up a forum that day, so I started...
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template