Createtableguest (region, primarykey (id), titlevarchar (50), emailvarchar (30), homepagevarchar (30), namevarchar (30), texttext, relayint, r_timedate) createt --------------------------------- Forum --------------------------
Data table
Create table guest (id int not null auto_increment, primary key (id), title varchar (50), email varchar (30), homepage varchar (30), name varchar (30 ), text, relay int, r_time date)
Create table relay (id int not null auto_increment, primary key (id), title int, email varchar (30), name varchar (30), text)
------------------------- Index. php --------------------------
Website full manual
$ Db = mysql_connect ("localhost ","****","****");
Mysql_select_db ("*****", $ db );
@ $ Result = mysql_query ("SELECT * FROM guest order by id desc", $ db );
$ I = 0;
While ($ myrow = mysql_fetch_row ($ result )){
$ Guestbook [$ I] [0] = $ myrow [0];
$ Guestbook [$ I] [1] = $ myrow [1];
$ Guestbook [$ I] [2] = $ myrow [2];
$ Guestbook [$ I] [3] = $ myrow [4];
$ Guestbook [$ I] [4] = $ myrow [6];
$ Guestbook [$ I] [5] = $ myrow [7];
$ I;
} // Read the array
Mysql_close ($ db );
Echo [";
If ($ q! = ""){
$ Page = $ q;
} Else {
$ Page = 0;
}
$ I = count ($ guestbook );
$ Msgnum = 20; // 20 pens per page
$ Start = $ page * $ msgnum;
$ End = $ start $ msgnum;
If ($ end> $ I) $ end = $ I;
$ Totalpage = $ I/$ msgnum;
For ($ I = 0; $ I <$ totalpage; $ I ){
If ($ I! = $ Page ){
Echo "$ I ";
} Else {
Echo "$ I ";
}
}
Echo "] page -----------------------------
"; Printf ("
Add topic
");
Echo"
";
Echo"
";Echo"
"; Echo"
Topic | ";Echo"
Email | ";Echo"
Name | ";Echo"
Reply | ";Echo"
Last reply time | ";Echo"
";For ($ I = $ start; $ I <$ end; $ I ){$ Id = $ guestbook [$ I] [0];Echo"
"; Echo"
"; Echo ""; echo $ guestbook [$ I] [1]; echo ""; echo" | ";Echo"
"; Echo ""; echo $ guestbook [$ I] [2]; echo ""; echo" | ";Echo"
"; Echo $ guestbook [$ I] [3]; echo" | ";Echo"
"; Echo $ guestbook [$ I] [4]; echo" | ";Echo"
"; Echo $ guestbook [$ I] [5]; echo" | ";Echo"
";}Echo"
";
Echo"
";
Printf ("add a topic ");
?>
------------------------------ 444. php --------------------------------
$ Db = mysql_connect ("localhost ","****","****");
Mysql_select_db ("*****", $ db );
@ $ Result = mysql_query ("SELECT * FROM guest where id = '$ ID'", $ db );
Echo"
";$ Myrow = mysql_fetch_row ($ result );Echo"
"; Echo"
Topic: "; echo $ myrow [1]; echo" | "; Echo"
";$ Msg = base64_decode ($ myrow [5]);$ Msg = ereg_replace ("", "", $ msg); // space processing$ Msg = nl2br ($ msg); // Line Feed ProcessingIf ($ myrow [3]! = "") {$ Myrow [3] = "$ myrow [3]";}Else{$ Myrow [3] = "I have not settled on the internet ";}Echo"
"; Echo"
"; Echo $ msg; echo" | "; Echo"
";Echo"
"; Echo"
Home page: "; echo $ myrow [3]; echo" |
";Echo"
"; Echo"
"; Echo" reply list "; echo" | "; Echo"
";$ Num = $ myrow [6];@ $ Result1 = mysql_query ("SELECT * FROM relay where title = '$ ID' order by id desc", $ db );$ I = 0;While ($ myrow1 = mysql_fetch_row ($ result1 )){$ Guestbook [$ I] [0] = $ myrow1 [1];$ Guestbook [$ I] [1] = $ myrow1 [2];$ Guestbook [$ I] [2] = $ myrow1 [3];$ Guestbook [$ I] [3] = $ myrow1 [4];$ I;}Mysql_close ($ db );If ($ q! = ""){$ Page = $ q;} Else {$ Page = 0;}$ I = count ($ guestbook );$ Msgnum = 5; // 5 entries per page$ Start = $ page * $ msgnum;$ End = $ start $ msgnum;If ($ end> $ I) $ end = $ I;$ Totalpage = $ I/$ msgnum;For ($ I = $ start; $ I <$ end; $ I ){$ T = $ guestbook [$ I] [0];Echo"
"; Echo"
"; Echo "Re:"; echo $ myrow [1]; echo" | "; Echo"
";Echo"
"; Echo"
"; Echo $ guestbook [$ I] [2]; echo" | "; Echo"
";Echo"
"; Echo"
Email :"; Echo ""; echo $ guestbook [$ I] [1]; echo ""; echo" | "; Echo"
";$ Msg = base64_decode ($ guestbook [$ I] [3]);$ Msg = ereg_replace ("", "", $ msg );$ Msg = nl2br ($ msg );Echo"
"; Echo"
"; Echo $ msg; echo" | "; Echo"
";}Echo"
"; Echo"
"; Echo"
"; Echo [";
For ($ I = 0; $ I <$ totalpage; $ I ){
If ($ I! = $ Page ){
Echo "$ I ";
} Else {
Echo $ I;
}
} Echo "] page ---------------------------------"; echo"
";
Echo "reply"; echo"
";
Echo "browsing themes ";
?>
-------------------------------- 333. php -----------------------------
If (! $ T ){
If ($ text = "" & $ email = "" & $ name = "") {echo "* required"; echo "return ";}
Else {if (eregi ("^ [_. 0-9a-z-] @ ([0-9a-z] [0-9a-z-].) [a-z] {2, 3} $ ", $ email )){
$ Text = base64_encode ($ text); // check whether the email address is valid
$ Db = mysql_connect ("localhost ","****","****");
$ Time = date ("y-m-d ");
Mysql_select_db ("*****", $ db );
$ SQL = "insert into relay values ('', '$ title',' $ email ',' $ name', '$ text ')";
$ Result = mysql_query ($ SQL );
$ Num = $ num 1;
$ SQL = "update guest set relay = '$ num', r_time =' $ time' where id = '$ title '";
$ Result = mysql_query ($ SQL );
Mysql_close ();
Echo" ";
}
Else {echo "invalid email address"; echo "back ";}
}}
Else
{?>
?>
----------------------------------- Www. php --------------------------
If ($ title! = "" & $ Email! = "" & $ Name! = ""){
If (eregi ("^ [_. 0-9a-z-] @ ([0-9a-z] [0-9a-z-].) [a-z] {2, 3} $", $ email )){
$ Text = base64_encode ($ text); // check whether the email address is valid
$ Db = mysql_connect ("localhost ","****","****");
$ Time = date ("y-m-d ");
Mysql_select_db ("*****", $ db );
$ SQL = "insert into guest values ('', '$ title',' $ email ',' $ homepage', '$ name',' $ text ','', '$ time ')";
$ Result = mysql_query ($ SQL); mysql_close ();
Echo" ";
}
Else
{Echo "invalid email address"; echo "back ";}}
Else {echo "* required"; echo "back ";}
// Mysql_close ($ db)
// Printf ("If the message is successfully sent, return this message ");
?>
-------------------------------- 111. php ---------------------------
[This article is copyrighted by the author and osuo. if you need to reprint it, please indicate the author and its source]