A Concise multi-level forum

Source: Internet
Author: User
Tags php mysql
In this forum, less than 200 lines of code are used, and the execution speed is quite fast. The running example is http://www.hnpts.ha.cn/forummysqldata database :yxforum repository | Field | Type | Null | Key | Default | less than 200 lines of code are used in this forum, and the execution speed is quite fast. Run the example in: http://www.hnpts.ha.cn/forum
MYSQL database: yxforum
---------------------------------------------------------
| Field | Type | Null | Key | Default | Extra |
---------------------------------------------------------
| Id | int (11) | PRI | 0 | auto_increment |
| Dt | datetime | YES | NULL |
| Tp | varchar (255) | YES | NULL |
| Ct | text | YES | NULL |
| Fl | int (11) | YES | NULL |
| Ip | varchar (20) | YES | NULL |
| Un | varchar (50) | YES | NULL |
| Em | varchar (60) | YES | NULL |
| Num | int (11) | YES | NULL |
---------------------------------------------------------

Index. php:






Mysql_select_db ("××××", $ m );
?>

$ Hf_fl = $ fl;
$ Q = "select * from yxforum where id =". $ fl;
$ Mr = mysql_query ($ q, $ m );
$ Ra = mysql_fetch_row ($ mr );
?>



?>


$ Lastid = $ ra [4];
Print ("
". $ Ra [3]."
");
Print ("
Subject:");
}

$ Q = "select * from yxforum where fl =". $ fl. "order by dt desc ";
If ($ p = "") $ p = 0;
$ Mr = mysql_query ($ q, $ m );
$ F = mysql_num_fields ($ mr );

$ Ra = mysql_fetch_row ($ mr );
$ I = 0; $ p1 = $ p * 15;/* skip the row corresponding to the specified page number */
While ($ I <$ p1)
{$ I;
$ Ra = mysql_fetch_row ($ mr );
If (! $ Ra) break ;}


?>














$ X [0] = "ffffcc"; $ x [1] = "DEEFFF"; $ I = 1;While ($ ra)/* Display the current topic */{$ Ys_c = $ I % 2;Print (" ");$ Ra = mysql_fetch_row ($ mr );$ I;If ($ I> 15) break;}?>
Latest response time
Publisher
Topic
Response count
". $ Ra [1]);
Print ("
". $ Ra [6]." ");
Print ("
");
Printf ("% s", $ ra [0], $ ra [2]);
Print ("
". $ Ra [8]);
Print ("







Design Tool for Forum program version 0.25: PHP MYSQL

Old Yi Qingjian production
Xiaoyao Feihu Multimedia Workshop 2000






Addnew. php:

Mysql_select_db ("×××××", $ m );
$ Zw = ereg_replace ("<", "<", $ zw );
$ Zw = ereg_replace (">", ">", $ zw );
$ Zw = ereg_replace ("n ","
", $ Zw );
$ Zw = ereg_replace ("", "", $ zw );
$ Tt = ereg_replace ("<", "<", $ tt );
$ Tt = ereg_replace (">", ">", $ tt );
If ($ nm = "") $ nm = "";
If ($ em = "") {$ nm. = "<-- is a newbie without MAIL"; $ em = "No ";}
$ Err = strlen ($ tt) * strlen ($ zw );
If ($ err = 0)
$ Msg = "Don't be lazy! It is not too late to enter the form and submit it again. ";
Else {$ q = "insert into yxforum (dt, tp, ct, fl, ip, un, em, num) values"
. "(Now (),"". $ tt. "","". $ zw. "",". $ fl. ","". $ REMOTE_ADDR. "","". $ nm. "","". $ em. "", 0 )";
Mysql_query ($ q, $ m );

$ Q = "select num, fl from yxforum where id =". $ fl;
$ Fl_a = $ fl;
Do {$ mr = mysql_query ($ q, $ m );
$ Ra = mysql_fetch_row ($ mr );
$ Num = $ ra [0] 1;
$ Q = "update yxforum set dt = now (), num =". $ num. "where id =". $ fl;
$ Fl = $ ra [1];
Mysql_query ($ q, $ m );
$ Q = "select num, fl from yxforum where id =". $ fl;
} While ($ fl> 0 );


$ Msg = "your comments have been submitted successfully! ";
}
?>


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.