Community (phpmysql) 5

Source: Internet
Author: User
Tags setcookie

Function post2 (){
Global $ Sid, $ aid, $ php_self;
Global $ banner, $ body, $ poster, $ email, $ type, $ char_gb;

If (strlen ($ banner) = 0 | strlen ($ body) = 0 | strlen ($ poster) = 0 | strlen ($ email) = 0 ){
Echo"
<Script language = JavaScript>
Alert ');
History. Back ();
</SCRIPT>
";
Return;
}

// $ Banner = addslashes ($ banner );
// $ Body = addslashes ($ body );
$ Rip = getenv ('remote _ ADDR ');

$ Droot = getenv ('document _ root ');
Include ("SQL. php3 ");
$ Db = mysql_connect ($ SQL ['host'], $ SQL ['user'], $ SQL ['passwd']);
$ Now = Date ('y '). "-". date ('M '). "-". date ('D '). "". date ('H '). ":". date ('I '). ":". date ('s ');

If ($ char_gb = 1 ){
Include ("ccharset. php3 ");
$ Code = new ccharset;
$ Banner = $ code-> gb_big5 ($ banner );
$ Body = $ code-> gb_big5 ($ body );
$ Poster = $ code-> gb_big5 ($ poster );
}

If ($ type = 1 ){
$ Qsql = "insert into bbs_docs (aid, Sid, banner, body, poster, email, Pip, wdate)
Values ('$ aid', '$ Sid', '$ banner', '$ body',' $ poster', '$ email', '$ rip ', '$ now ')";
} Else {
$ Qsql = "insert into bbs_subj (aid, banner, body, poster, email, Pip, wdate)
Values ('$ aid', '$ banner', '$ body',' $ poster', '$ email', '$ rip', '$ now ')";
}
$ Rs = mysql_db_query ($ SQL ['db'], $ qsql );
$ Id = mysql_insert_id ();

If ($ type = 0) {// export mail_list
$ Qsql = "insert into bbs_sml (SID, email) values ('$ id',' $ email ')";
$ Rs = mysql_db_query ($ SQL ['db'], $ qsql );

}< br> if ($ type = 0) send_the_doc_to_mail_list ($ aid, $ id, $ id);
else send_the_doc_to_mail_list ($ aid, $ Sid, $ id);
// incdocs ($ aid);
if ($ type = 0) {$ SID = $ rid = $ ID ;}
else {$ rid = $ id ;}< br> echo "

";

}< BR >//================================== =====================================================< BR> function search_docs ($ aid, $ skey) {
$ droot = getenv ('document _ root');
include ("SQL. php3 ");
$ db = mysql_connect ($ SQL ['host'], $ SQL ['user'], $ SQL ['passwd']);
// $ qsql = "select * From bbs_docs where Sid = '$ id' and (banner like' $ skey 'or poster like' $ skey 'or body like' $ skey ') order by wdate DESC ";
if ($ aid) $ qsql = "select * From bbs_docs where aid = '$ aid' and (banner like '$ skey' or poster like '$ skey' or body like '$ skey ') order by wdate DESC ";
else $ qsql = "select * From bbs_docs where (banner like '$ skey' or poster like '$ skey' or body like '$ skey ') order by wdate DESC ";
$ rs = mysql_db_query ($ SQL ['db'], $ qsql);
while ($ ROW = mysql_fetch_array ($ RS )) {
$ id = $ row ['id'];
$ banner = $ row ['banner '];
$ poster = $ row ['poster'];
$ views = $ row ['view'];
$ wdate = sdatetime ($ row ['wdate']);
$ aid = $ row ['aid '];
$ SID = $ row ['sid '];

Echo "<tr bgcolor = '# f0f0f0'> ";
Echo "<TD> ";
Echo "<a href = $ php_self? Proc = view & Aid = $ Aid & SID = $ Sid & rid = $ id> ";
Echo "<font color = # 836fff> $ banner </font> ";
Echo "</a> ";

Echo "</TD> ";
Echo "<TD> ";
Echo $ poster;
Echo "</TD> ";
Echo "<TD class = 'num'> ";
Echo "";
Echo "</TD> ";
Echo "<TD class = 'num'> ";
Echo $ views;
Echo "</TD> ";
Echo "<TD class = 'num'> ";
Echo $ wdate;
Echo "</TD> ";

Echo "</tr> ";
}

}
// ================================================ ======================================
Function search (){
Global $ php_self;
Global $ key, $ aid;
If (! Strlen ($ key )){
Echo"
<Script language = JavaScript>
History. Back ();
</SCRIPT>
";
}
Echo "<Table width = 85% border = 0 cellpadding = 0 cellspacing = 1 align = center class = 'tablefont'> ";
Echo "<form name = mtab enctype = multipart/form-data method = post action = $ php_self? Proc = Search> ";

Echo "<tr> <TD> ";

Echo "<input type = 'ddn' name = aid value = '$ aid'> ";
Echo "too many referers :";
Echo "<input type = 'text' name = 'key' value = '$ key' size = 25 class = 'tablefont'> ";
Echo "<input type = 'submit 'value = 'partition height' class = 'tablefont'> ";

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

$ Skey = "% $ key % ";
$ Droot = getenv ('document _ root ');
Include ("SQL. php3 ");
$ Db = mysql_connect ($ SQL ['host'], $ SQL ['user'], $ SQL ['passwd']);
If ($ aid) $ qsql = "select * From bbs_subj where aid = '$ aid' and (banner like '$ skey' or poster like '$ skey' or body like '$ skey ') order by wdate DESC ";
Else $ qsql = "select * From bbs_subj where (banner like '$ skey' or poster like '$ skey' or body like '$ skey') order by wdate DESC ";
// Echo $ qsql;
$ Rs = mysql_db_query ($ SQL ['db'], $ qsql );

Echo "<Table width = 85% border = 0 cellpadding = 0 cellspacing = 1 align = center bgcolor = '# 6ca6cd'> ";
Echo "<tr> <TD> ";
Echo "<Table width = 100% cellpadding = 1 cellspacing = 1 bgcolor = white class = 'tablefont'> ";
Echo "<tr bgcolor = # f1e1ff> ";
Echo "<TH> clip </Th> ";
Echo "<TH> only exist </Th> ";
Echo "<TH width = 30> Lai </Th> ";
Echo "<TH width = 30> </Th> ";
Echo "<TH width = 70> signature stamp </Th> ";
Echo "</tr> ";
While ($ ROW = mysql_fetch_array ($ RS )){
$ Id = $ row ['id'];
$ Paid = $ row ['aid '];
$ Banner = $ row ['banner '];
$ Poster = $ row ['poster'];
$ Views = $ row ['views'];
$ Wdate = sdatetime ($ row ['wdate']);
$ Docs = reanum ($ id );
Echo "<tr bgcolor = '# f0f8ff'> ";
Echo "<TD> ";
Echo "<a href = $ php_self? Proc = view & Aid = $ paid & SID = $ ID & rid = $ id> ";
Echo $ banner;
Echo "</a> ";
Echo "</TD> ";
Echo "<TD> ";
Echo $ poster;
Echo "</TD> ";
Echo "<TD class = 'num'> ";
Echo $ docs;
Echo "</TD> ";
Echo "<TD class = 'num'> ";
Echo $ views;
Echo "</TD> ";
Echo "<TD class = 'num'> ";
Echo $ wdate;
Echo "</TD> ";
Echo "</tr> ";

}
Search_docs ($ aid, $ skey );
Echo "</TD> </tr> </table> ";
Echo "</TD> </tr> </table> ";

}
// ================================================ ======================================

If ($ proc = "post2 "){
Setcookie ("c_poster", $ poster, time () + 31536000 );
Setcookie ("c_email", $ email, time () + 31536000 );
}

// If ($ proc! = "Do_sel" & $ proc! = "Post2" & $ proc! = "Colloff" & $ proc! = "Collon") include ("frame_top.php3 ");
Switch ($ proc ){
Case search:
Search ();
Break;
Case mail_list:
Mail_list ();
Break;
Case mail_friend:
Mail_friend ();
Break;
Case post2:
Post2 ();
Break;
Case colloff:
Cook_cooloff ();
Break;
Case Collon:
Cook_coolon ();
Break;
Case view;
View ();
Break;
Default:
Area ();
Break;
}
// If ($ proc! = "Do_sel" & $ proc! = "Post2" & $ proc! = "Colloff" & $ proc! = "Collon") include ("frame_bottom.php3 ");
?>

The first five are a page.

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.