Community (php & amp; mysql) 3

Source: Internet
Author: User

Function prev_subj ($ id ){
$ DROOT = getenv ('document _ root ');
Include ("SQL. php3 ");
$ Db = mysql_connect ($ SQL ['host'], $ SQL ['user'], $ SQL ['passwd']);
$ Qstr = "select id, aid from bbs_subj where id = '$ id '";
$ Rs = mysql_db_query ($ SQL ['db'], $ qstr );
$ Row = mysql_fetch_array ($ rs );
$ Aid = $ row ['aid '];

$ Qstr = "select id from bbs_subj where aid = '$ aid' order by wdate DESC ";
$ Rs = mysql_db_query ($ SQL ['db'], $ qstr );
$ Pid = $ id;
While ($ row = mysql_fetch_array ($ rs )){
$ Tid = $ row ['id'];
If ($ id = $ tid) break;
$ Pid = $ tid;
}

Return $ pid;
}
// Configure
Function next_subj ($ id ){
$ DROOT = getenv ('document _ root ');
Include ("SQL. php3 ");
$ Db = mysql_connect ($ SQL ['host'], $ SQL ['user'], $ SQL ['passwd']);
$ Qstr = "select id, aid from bbs_subj where id = '$ id '";
$ Rs = mysql_db_query ($ SQL ['db'], $ qstr );
$ Row = mysql_fetch_array ($ rs );
$ Aid = $ row ['aid '];

$ Qstr = "select id from bbs_subj where aid = '$ aid' order by wdate DESC ";
$ Rs = mysql_db_query ($ SQL ['db'], $ qstr );
$ Pid = $ id;
While ($ row = mysql_fetch_array ($ rs )){
$ Pid = $ row ['id'];
If ($ id = $ pid) break;
}
If ($ row = mysql_fetch_array ($ rs )){
$ Pid = $ row ['id'];
}
Return $ pid;
}

// ================================================ ======================================
Function viewbar (){
Global $ pgno;
Global $ PHP_SELF;
Global $ aid, $ sid;
// Global $ OPEN_LIST;
Echo "<TABLE width = 85% border = 0 cellPadding = 0 cellSpacing = 1 align = center class = 'num'> ";
Echo "<tr> <td align = center> ";
$ Nextid = next_subj ($ sid );
$ Previd = prev_subj ($ sid );
Echo "<a href = $ PHP_SELF? Aid = $ aid & sid = $ sid> [Folder comment] </a> ";
Echo "<a href = # re> [Lai Yun] </a> ";
Echo "<a href = $ PHP_SELF? Proc = view & aid = $ aid> [just pull away] </a> ";
Echo "<a href = $ PHP_SELF? Proc = view & aid = $ aid & sid = $ nextid & rid = $ nextid> [partition] </a> ";
Echo "<a href = $ PHP_SELF? Proc = view & aid = $ aid & sid = $ previd & rid = $ previd> [region] </a> ";
// Echo "<a href = $ PHP_SELF? Proc = view & pgno = $ pgno & aid = $ aid & sid = $ previd & rid = $ previd> [Cheng Jing] </a> ";

Echo "</td> ";

Echo "</tr> </table> ";

}
// ================================================ ======================================
Function view (){
Global $ PHP_SELF, $ aid, $ sid, $ rid;
Global $ c_poster, $ c_email;
// Echo "$ PHP_SELF, $ aid, $ sid, $ rid, $ pgno ";
$ Type = 0; // adjust parallel bars
If ($ sid & $ rid ){
Addhitviews ($ sid, $ rid );
$ Type = 1; // click
$ Db_table = "bbs_subj ";
If ($ sid! = $ Rid) $ db_table = "bbs_docs ";
$ DROOT = getenv ('document _ root ');
Include ("SQL. php3 ");
$ Db = mysql_connect ($ SQL ['host'], $ SQL ['user'], $ SQL ['passwd']);
$ Qstr = "select banner from bbs_area where id = '$ aid '";
$ Rs = mysql_db_query ($ SQL ['db'], $ qstr );
Echo mysql_error ();
$ Row = mysql_fetch_array ($ rs );
$ Abanner = $ row ['banner '];

$ Qsql = "SELECT * from $ db_table where id = '$ rid '";
$ Rs = mysql_db_query ($ SQL ['db'], $ qsql );
$ Row = mysql_fetch_array ($ rs );
$ Poster = $ row ['poster'];
$ Pip = $ row ['pip '];
$ Wdate = $ row ['wdate'];
$ Rebanner = $ banner = $ row ['banner '];
$ Body = $ row ['body'];
$ Body = htmlspecialchars ($ body );
$ Pbody = ereg_replace ("n", "<br>", $ body );
$ Pbody = preg_replace ("/[www *] ([\ x0-\ xff] *?) [/Www *]/", '<a href =" \ 1 "target =" _ blank "> \ 1 </a>', $ pbody );
$ Pbody = preg_replace ("/[www + ([a-zA-Z0-9.: // _-] +)] ([\ x0-\ xff] *?) [/Www *]/", '<a href =" \ 1 "target =" _ blank "> \ 2 </a>', $ pbody );

Echo "<center> ";
Echo "<font color = GREEN size = 5> <B> [$ abanner] <br> ";
Echo "$ banner </B> </font> </center> ";
Echo "<table border = 0 width = 95% align = center cellPadding = 1 cellSpacing = 0 class = 'tablefont'> ";
Echo "<TR> <TD> ";
Viewbar ();
Echo "</td> </tr> ";
Echo "<TR> <TD> ";
// ===== Chanchefile ======================
Echo "<table border = 0 width = 100% align = center cellPadding = 1 cellSpacing = 0 class = 'tablefont'> ";
Echo "<TR> ";
Echo "<TD width = '000000' align = 'right'> ";
Echo ":";
Echo "</TD> ";
Echo "<TD align = 'left'> ";
Echo $ poster;
Echo "</TD> ";
Echo "</TR> ";
Echo "<TR> ";
Echo "<TD width = '000000' align = 'right'> ";
Echo "success :";
Echo "</TD> ";
Echo "<TD align = 'left'> ";
Echo $ pip;
Echo "</TD> ";
Echo "</TR> ";
Echo "<TR> ";
Echo "<TD width = '000000' align = 'right' valign = 'top'> ";
Echo "Success success :";
Echo "</TD> ";
Echo "<TD valign = 'top' class = 'bodycolor' align = 'left'> ";
Echo $ pbody;
Echo "Echo "</TD> ";
Echo "</TR> ";
Echo "</TD> </TR> ";
Echo "</TABLE> ";
Echo "<TR> <TD> ";

// ======== Commandid already exist ======================
Echo "<table border = 0 width = 100% align = center cellPadding = 3 cellSpacing = 0 class = 'menufont'> ";
Echo "<FORM name = mtab ENCTYPE = multipart/form-data METHOD = post action = $ PHP_SELF? Proc = mail_friend> ";
Echo "<input type = 'ddn' name = sid value = '$ Sid'> ";
Echo "<input type = 'ddn' name = aid value = '$ aid'> ";
Echo "<input type = 'ddn' name = rid value = '$ rid'> ";
Echo "<input type = 'ddn' name = poster value = '$ c_poster'> ";
Echo "<input type = 'siden' name = email value = '$ c_email'> ";
Echo "<TR> ";
Echo "<TD align = 'right' width = 250> ";
Echo "too many threads have been too wide :";
Echo "</TD> ";
Echo "<TD> ";
Echo "<input type = 'text' NAME = 'frmail' size = 25 value = 'your email '> ";

Echo "<input type = 'submit 'value = 'authorization'> ";
Echo "</TD> ";
Echo "</TR> ";
Echo "</FORM> ";
Echo "</TABLE> ";
Echo "</td> </tr> ";
Echo "<TR> <TD> ";
// ======= Mail List ==========================
Echo "<table border = 0 width = 100% align = center cellPadding = 3 cellSpacing = 0 class = 'menufont'> ";
Echo "<FORM name = mtab ENCTYPE = multipart/form-data METHOD = post action = $ PHP_SELF? Proc = mail_list> ";
Echo "<input type = 'ddn' name = sid value = '$ Sid'> ";
Echo "<input type = 'ddn' name = aid value = '$ aid'> ";
Echo "<input type = 'ddn' name = rid value = '$ rid'> ";
Echo "<input type = 'ddn' name = poster value = '$ c_poster'> ";
Echo "<input type = 'siden' name = email value = '$ c_email'> ";

Echo "<TR> ";
Echo "<TD align = 'right' width = 250> ";
Echo "stage o urgency order :";
Echo "</TD> ";
Echo "<TD> ";
If (strlen ($ c_email) $ addmail = $ c_email;
Else $ addmail = "E-mail ";
Echo "<input type = 'text' NAME = 'email 'size = 25 value =' $ addmail'> ";
Echo "<input type = 'submit 'name = 'way1' value = 'submit?> ";
Echo "<input type = 'submit 'name = 'way2' value = 'submit?> ";
$ Qsql = "SELECT id from bbs_sml where sid = '$ sid '";
$ Rs = mysql_db_query ($ SQL ['db'], $ qsql );
$ Nums = mysql_num_rows ($ rs );
Echo "<br> when there are too many milliseconds between H: $ nums ";
Echo "</TD> ";
Echo "</TR> ";
Echo "</FORM> ";
Echo "</TABLE> ";

Echo "</td> </tr> ";
Echo "<TR> <TD> ";
Viewbar ();
Echo "</td> </tr> ";
Echo "</TABLE> ";


To be continued ........

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.