// Display all messages
$ Conn = mysql_connect ("hostname", "username", "password"); $ db = mysql_select_db ("dbname", $ conn); $ numcolumns = 8; // number of records displayed on each page
$ Query = "select * from guestbook"; $ result = mysql_query ($ query); $ allnums = mysql_num_rows ($ result ); // calculate the total number of records $ numpage = ceil ($ allnums/$ numcolumns); // There are $ numpage pages in the message book
$ Prev = ($ pagenum-1) * $ numcolumns; $ next = $ prev + $ numcolumns;
If ($ next> = $ allnums)
{$ Next = $ allnums; $ numcolumns = $ next-$ prev;} // process the last page $ prev, $ next
$ Query = "select * from guestbook order by time desc limit $ prev, $ next ";
$ Result = mysql_query ($ query); // The message book page
For ($ I = 1; $ I <= $ numcolumns; $ I ++)
{$ Row = mysql_fetch_array ($ result );
// Display all message pages
----------
-Bamboo reply:-according to the id of the respondent $ id = $ row ['id']; $ queryback = "select * from gback where id = $ id "; $ resultback = mysql_query ($ queryback); $ rowback = mysql_fetch_array ($ resultback); // return the page echo $ rowback ['noteback']; // review content echo $ rowback ['timeback']; // response time} // MCM
-----------
Process reply Information
$ Conn = mysql_connect ("hostname", "username", "password"); $ db = mysql_select_db ("dbname", $ conn ); $ query = "select * from phpempire"; $ result = mysql_query ($ query); $ row = mysql_fetch_array ($ result );
If ($ password = $ row ['Password'])
{$ Timeback = date ("Y-m-d-H: I: s"); $ query = "insert into gback values ('$ noteback',' $ timeback ', '$ id') "; $ result = mysql_query ($ query );
$ Message = "Please wait... check all the messages";} else {$ message = "Sorry, you can reply only to bamboo! ";}
Echo $ message; The Empire is wonderful because of you.
If the browser does not respond for a long time, click connection here
Process the message:
$ Conn = mysql_connect ("hostname", "username", "password"); $ db = mysql_select_db ("dbname", $ conn ); $ time = date ("Y-m-d-H: I: s"); $ ip = $ REMOTE_ADDR; $ query = "select * from guestbook "; $ result = mysql_query ($ query); $ id = mysql_num_rows ($ result); $ id ++; $ query = "insert into guestbook values ('$ username ', '$ city',' $ email ',' $ homepage ',' $ note', '$ ip',' $ time', $ id )"; $ result = mysql_query ($ query );
Note: Empire message book
Function Description: it can implement the reply and authentication of bamboo.
Features: simple structure and scalable Functions
Disadvantage: slow speed
This Guestbook can be viewed at Http: // phpempire.net. If you are confused about some processes in this guestbook, please send me an email!
[This article is copyrighted by the author and osuo. If you need to reprint it, please indicate the author and its source]