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:
Sender |
Recipient |
Sending time |
Information content |
Query ($ SQL); foreach ($ arr as $ v) {$ fjr = uname ($ v [1]); $ jsr = uname ($ v [2]); echo"
{$ Fjr} | // The sender and recipient must use the name. Therefore, a method is called here.
{$ Jsr} |
{$ V [3]} |
{$ V [4]} |
";} 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] ;}}?>
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 )!