Php code for implementing the message board function

Source: Internet
Author: User
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, 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:

 

2. after the logon page is complete, enter the logon processing page, that is, the chuli. php file submitted above.

 Query ($ SQL); if ($ arr [0] [0] ==$ pwd &&! Empty ($ pwd) {$ _ SESSION ["username"] = $ user; header ("location: main. php ") ;}else {echo" logon failed ";}?>

Is the logon page

Release information to exit the system



Message: Query ($ SQL); foreach ($ arr as $ v) {$ fjr = uname ($ v [1]); $ jsr = uname ($ v [2]); echo" // The sender and recipient must use the name. Therefore, a method is called here. ";} Function uname ($ user) // use the uname method {global $ db; // you can use the $ db global variable if ($ user = "all") {return "all";} in the method ";} else {$ sql1 = "select name from yuangong where username = '{$ user}'"; $ att = $ db-> Query ($ sql1 ); return $ att [0] [0] ;}}?>
Sender Recipient Sending time Information content
{$ Fjr}{$ Jsr} {$ V [3]} {$ V [4]}


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.

Publish information homepage

Query ($ shaoyou);?> Query ($ sql1); return $ att [0] [0] ;}}?>// This is the code for publishing the page. it is similar to the code for adding the page. Query ($ SQL, 0) {header ("location: main. php") ;}else {echo "publishing failed" ;}?>?> A simple message board has been completed. when you exit, you need to clear the session and return to the logon page // exit page code.

The above is a detailed description of the code for implementing the message board function in php. For more information, see PHP Chinese website (www.php1.cn )!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.