Community (Php&&mysql) Five _php tutorials

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 "

";
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) {//Mail_list
$qsql = "INSERT into BBS_SML (sid,email) VALUES (' $id ', ' $email ')";
$rs =mysql_db_query ($sql [' db '], $qsql);

}
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;}
echo "

";

}
//======================================================================
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 ') Orde R by Wdate DESC ";
if ($aid) $qsql = "SELECT * from Bbs_docs where aid= ' $aid ' and [banner like ' $skey ' or poster like ' $skey ' or body like ' $ske Y ') 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 [' views '];
$wdate =sdatetime ($row [' wdate ']);
$aid = $row [' Aid '];
$sid = $row [' Sid '];

echo "";
echo "";
echo "";
echo "$banner";
echo "";

echo "";
echo "";
Echo $poster;
echo "";
echo "";
echo "";
echo "";
echo "";
Echo $views;
echo "";
echo "";
Echo $wdate;
echo "";

echo "";
}

}
//======================================================================
function Search () {
Global $PHP _self;
Global $key, $aid;
if (!strlen ($key)) {
echo "

";
}
echo "

"; echo ""; echo "
";


$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 ' $ske Y ') 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 "
";echo "
";
echo "

























"; echo " "; echo " "; echo "Only "; echo " "; echo " "; echo " "; echo " "; 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 " "; echo " "; echo " "; echo " "; echo " "; echo " "; echo " "; } search_docs ($aid, $skey); echo "
clamp 肈archivelai ら stamp
";
echo "";
Echo $banner;
echo "";
echo "
";
Echo $poster;
echo "
";
Echo $docs;
echo "
";
Echo $views;
echo "
";
Echo $wdate;
echo "
";
Echo
";




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

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 of the above is a page

http://www.bkjia.com/PHPjc/315600.html www.bkjia.com true http://www.bkjia.com/PHPjc/315600.html techarticle 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) = ...

  • 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.