Php simple multi-user chat interface design code below to briefly introduce the design of the most simple login multi-user chat system, there are only four files, respectively login page login. php, multi-user chat interface chat. php: SQL for designing database operations. php file and registration page regester. php, where the registration page and login page code are % 9 php simple multiplayer chat interface design code
The following is a brief introduction to the design of the simplest logon multi-user chat system. there are only four files, login. php, multi-user chat interface chat. php: SQL for designing database operations. php file and registration page regester. php, where the registration page and login page code % 98 are the same. Both adopt the same structure. The difficulty is actually in the SQL. php file. because this is a file involving database operations, many problems are basically caused by this page. of course, there is also a chat interface that is prone to problems. In general, it is nothing more than extracting the corresponding conversation content from the database based on the user name and receiver name. This shortcoming is quite big. it is almost useless in practical applications. it is only for the sake of learning that we will think of this. the conversation content is stored in the database, which is also a very system resource-consuming behavior. However, it is still possible to save a small amount of conversation information. I will not talk much about it, as long as I can understand SQL. the PHP file code basically understands the entire multiplayer chat system. Note that all four of my files are under one file, so when you want to copy this system, make sure that these four files are all in the same folder, and it is best to make sure again that these four files are UTF-8 encoded, if not, change to UTF-8 encoding. Otherwise, Chinese characters may be garbled. A Chinese character occupies 2 Characters in GBK encoding and 3 characters in UTF-8 encoding, which can be verified by strlen () function. Here we need to create two tables. The two data tables are as follows:
The table name is comm, which is used to store user conversation information:
The following table is called rege, which is used to store user registration information:
Below is the login page login. php
Welcom to login pageClick to register
"; Echo" document. getElementById ('Show '). innerHTML = 'Enter the verification code' "; echo" script "; exit () ;}if ($ chars! = Trim ($ _ POST ['check']) {echo"