Php implements the message board function, and php implements the message board function.
This small message board function is suitable for class or internal discussions, conversations, and messages. It is very convenient, and more importantly, it does not require the Internet. It is very common for the company's management,
The message board is written as follows:
1 first, the login page:
<Form action = "chuli. php "method =" post "> <div style =" margin-left: 500px; margin-top: 200px; height: 250px; width: 250px ">/* to place the login table in the middle of the page, it is more beautiful */
2. After the logon page is complete, enter the logon processing page, that is, the chuli. php file submitted above.
<? Phpsession_start (); // After logging on, You must connect the included logon page and enable sessioninclude ("DADB. class. php "); $ db = new DADB (); $ user = $ _ POST [" username "]; $ pwd = $ _ POST [" password "]; $ SQL = "select password from yuangong where username = '{$ user}'"; $ arr = $ db-> Query ($ SQL ); if ($ arr [0] [0] ==$ pwd &&! Empty ($ pwd) {$ _ SESSION ["username"] = $ user; header ("location: main. php ") ;}else {echo" Logon Failed ";}?>
Is the logon page
3. After logging on to the console, you can view the dialog content you have received. The following figure shows the table and Page code of the database:
<Body> <div>
4. The code is written here, and the important part is completed. The following is the release information page, which is equivalent to the previously added page, the processing page is no different from the previous one. The difference is that the current processing page is operated upon user login, and the session needs to be used to connect all the login pages.
<H1> Publish information
A simple message board has been completed. When you exit, you need to clear the session and return to the logon page.
// Exit the page Code <? Phpsession_start (); unset ($ _ SESSION ["username"]); header ("location: login. php");?>
The above is all the content of this article. I hope this article will help you in your study or work. I also hope to provide more support to the customer's home!