Community (Php&&mysql) Five

Source: Internet
Author: User
Tags date include insert setcookie strlen
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 (' Evil 糶 ぃч ');
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) {// Barbara 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 "
<script language=javascript>
Document.location= ' $PHP _self?proc=view&aid= $aid &sid= $sid &rid= $rid '
</script>
";

}
//======================================================================
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 '" $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 the 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 "<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= ' >";
echo "<form name=mtab enctype=multipart/form-data method=post action= $PHP _self?proc=search>";

echo "<tr><td>";

echo "<input type= ' hidden ' name=aid value= ' $aid ' > ';
echo "Service 碝 がくしゅくしゅしていて Beecher:";
echo "<input type= ' TEXT ' name= ' key ' value= ' $key ' size=25 class= ' Tablefont ' >";
echo "<input type= ' Submit ' value= ' Sehnzhen xing Energ high ' 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 the 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 "<table width=85% border=0 cellpadding=0 cellspacing=1 align=center ' #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 癬 </th>";
echo "<th Width=30> lai </th>";
echo "<th width=30></th>";
echo "<th width=70>ら 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 top five above are a page

Related Article

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.