My Forum source code (II) _ PHP Tutorial

Source: Internet
Author: User
Source code of my forum (2 ). This page displays the topic list. Foxbbs. php function: Display the topic of the Forum HTMLHEADTITLE Fox Network Forum TITLESTYLEtypetextcssP {FONT-FAMILY: normal; FONT-SI main interface, that is, display the topic list of this page.
// Foxbbs. php: displays the topic of the Forum.



Fox Network Forum


Include "linkfox. inc. php ";
Include "info. inc. php ";

?>


$ Tem = $ HTTP_COOKIE_VARS [FlyFoxNet]; // obtain the information in the COOKIE.
$ Temp = explode ("|", $ tem); // because the user name and password are separated by "|" and recorded in the COOKIE
$ Cookiem = $ temp [0]; // obtain the user name
$ Useinfo = cuser ($ cookiem, $ action); // The CUSER function is used to determine whether information is retrieved from the COOKIE.
$ Query = "select usename from useinfo where usename = '". $ useinfo [0]. "'"; // check whether a user is registered
$ Req = mysql_query ($ query );
If ($ req)
{
$ Usename = mysql_fetch_array ($ req );
If ($ usename [0] = $ useinfo [0]) $ useinfo [0] = $ usename [0];
Else {
$ Usename = 1;
$ Useinfo [0] = "tourist ";
}
}
Else $ usename = 1; $ useinfo [0] = "tourist ";
?>





























Current location: Fox Network> Fox Network Forum> Topic List











";
Echo"




































































";?> $ Imgnum = 20; // number of clicks, ready to change the status chartIf (! $ User) $ user = "all ";$ Query = "select count (*) from foxbbs"; // calculate the total number of topics$ Req = mysql_query ($ query );If ($ req){$ Row = mysql_fetch_array ($ req );$ Num = $ row [0];If (! $ Rows) $ rows = 10; // control the number of entries displayed on each pageIf (! $ L) $ l = 1; // sets the sorting method.If ($ num/$ rows <1) $ page = 1; // calculates the total number of pages.Else if ($ num/$ rows = floor ($ num/$ rows) $ page = $ num/$ rows;Else $ page = floor ($ num/$ rows) + 1;If (! $ Dpage) $ dpage = 1; // The number of currently displayed pagesIf ($ dpage> $ page) $ dpage = $ page; // The maximum number of pages cannot be exceeded.If ($ dpage = 1) $ tem = 0; // control the information displayed on the current pageElse $ tem = ($ dpage-1) * $ rows;If ($ l = 2) $ s = "hfnum ";Else if ($ l = 3) $ s = "djnum ";Else $ s = "id ";For ($ I = 0; $ I <$ rows; $ I ++) // retrieve records based on the number of rows per page.{$ Tem1 = $ tem + 1;If ($ action = find) $ query = "select * from foxbbs where usename = '". $ user. "'Order by $ s desc limit $ tem, $ tem1 ";Else $ query = "select * from foxbbs order by $ s desc limit $ tem, $ tem1 ";$ Req = mysql_query ($ query );If ($ req){$ Bbs = mysql_fetch_array ($ req); // Check whether there is any reply time. if not, take the posting time instead of the reply time.If ($ bbs [3]){If (! $ Bbs [8]) $ bbs [8] = $ bbs [4]. "". $ bbs [1];Else $ bbs [8] = $ bbs [8]. "". $ bbs [10];If (substr ($ bbs [4], 0,-8) = date (Y, n, j) & $ bbs [6] <$ imgnum & $ bbs [12]! = 1) // if it is the post of the current day$ Img = "images/newfolder.gif ";Else if (substr ($ bbs [4], 0,-8) = date (Y, n, j) & $ bbs ["djnum"] >=$ imgnum & $ bbs [12]! = 1) // if it is the current day, and the number of clicks is 10$ Img = "images/newhotfolder.gif ";Else if (substr ($ bbs [4], 0,-8 )! = Date (Y-n-j) & $ bbs [6] >=$ imgnum & $ bbs [12]! = 1) // if it is not the current day, click 20$ Img = "images/hotfolder.gif ";Else if ($ bbs [12] = 1) $ img = "images/lock.gif"; // lockedElse $ img = "images/folder.gif ";Echo" ";Echo" ";Echo" ";Echo" ";Else echo "". $ bbs [3]."";Echo" ";Echo" ";Echo" ";Echo" ";}}$ Tem ++;}}Echo"

Status



Emotion



Subject



Author



Reply



Popularity



Last reply time


";
If ($ bbs [12] = 1) echo $ bbs [3]."

". $ Bbs [1]."

". $ Bbs [7]."

". $ Bbs [6]."

". $ Bbs [8]."

";
Echo"


";Echo" ";Echo" ";Echo"

| ==> ";
If ($ page = 1)
{
Echo "[Previous Page] [Next Page]";
}

Else if ($ dpage = 1) // if it is currently on the first page
{
$ U = $ dpage + 1;
Echo "[Previous Page] [Next Page]";
}
Else if ($ dpage> 1 & $ dpage <$ page) // if the current page is in the middle
{
$ U = $ dpage + 1;
$ D = $ dpage-1;
Echo "[Previous Page] [Next Page]";
}
Else if ($ dpage = $ page) // if it is currently on the last page
{
$ D = $ dpage-1;
Echo "[Previous Page] [Next Page]";
}
Echo"

";
Echo"

Number of topics: ". $ num." current number ". $ dpage." page/total ". $ page." page";For ($ I = 1; $ I <= $ page; $ I ++){If ($ I = $ dpage) echo"Page ". $ I ."";Else echo"Page ". $ I ."";}Echo"";
Echo"";Echo"Select sorting method";Echo"ANFA post time sorting";Echo"Ranking by security clicks";Echo"Multiple-digit anchor sorting";Echo"";
Echo"";Echo"Select lines on each page";Echo"Five lines per page";Echo"10 lines per page";Echo"15 lines per page";Echo"20 rows per page";Echo"25 lines per page";Echo"Thirty lines per page";Echo"35 lines per page";Echo"Forty lines per page";Echo"Forty-five lines per page";Echo"50 lines per page";Echo"";
$ Query = "select count (*) from useinfo"; // count the number of registered users
$ Req = mysql_query ($ query );
$ Usenum = mysql_fetch_array ($ req );
$ Query = "select usename from useinfo order by useid desc limit"; // you can find the newly registered user. because the ID is auto-incrementing, you can judge it based on the ID, the biggest one is the latest.
$ Req = mysql_query ($ query );
$ Newuse = mysql_fetch_array ($ req );
Echo "currently a total of members [". $ usenum [0]. "] name/latest join [". $ newuse [0]. "]";

?>









Bytes. // Foxbbs. php function: Display forum topic html head title Fox Network Forum/title style type = text/css P {FONT-FAMILY: normal; FONT-SI...































Status description:






New topics generated on the day




The topic with the highest reply on the day




A topic a day ago




Reply to more than 50 topics in total




Closed topic







★Forum description★



1. only registered users can post the forum. if you are not registered, you can view and reply to the post as a visitor, but cannot post the post.

2. Post users will be fully responsible for the comments posted in the forum. they will focus on emotional aspects (before the technical forum is launched, you can discuss technical issues as appropriate). If the webmaster finds that a user has used this forum to discuss other irrelevant topics, it will immediately lock it. (This site will launch other forums one after another)

3. I did not expect it. Haha ......


<Contact me |-| FlyFox @ Net>




Production and development of Feihu Studio



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.