Community (PHP&&MYSQL) II

Source: Internet
Author: User
function Sdatetime ($STR) {
$str =ereg_replace ("-", "/", $STR);
$str =substr ($str, 5,strlen ($STR)-8);
return $str;
}

function Reanum ($SID) {//羆  lai 絞 meter
$DROOT =getenv (' document_root ');
Include ("sql.php3");
$db =mysql_connect ($sql [' Host '], $sql [' User '], $sql [' passwd ']);
$qsql = "SELECT id from Bbs_docs where sid= ' $sid '";
$rs =mysql_db_query ($sql [' db '], $qsql);
Return mysql_num_rows ($RS);
}

function Pagebar ($pages) {
Global $pgno;
Global $pages;
Global $PHP _self;
Global $aid;
Global $OPEN _list;
echo "<table width=85% border=0 cellpadding=0 cellspacing=1 align=center ' #6CA6CD ' bgcolor= ' num ' >";
echo "<tr><td>";
if ($pgno!=0) {
$pu = $pgno-1;
echo "<a href= $PHP _self?aid= $aid &pgno= $pu >[]</a>";
}
if ($pgno < $pages) {
$PD = $pgno +1;
echo "<a href= $PHP _self?aid= $aid &pgno= $pd >[]</a>";
}
for ($i =0; $i <= $pages; $i + +) {
if ($pgno = = $i) {
echo "<b>";
echo "[". ( $i + 1). "]";
echo "</b>";
} else {
echo "<a href= $PHP _self?aid= $aid &pgno= $i >";
echo "[". ( $i + 1). "]";
echo "</a>";
}
}
echo "</td>";
echo "<td align=right>";
echo "<a href= $PHP _self?proc=view&aid= $aid >";
echo "[Only ゅ Beecher]";
echo "</a>";
echo "</TD>";
echo "<td align=right>";
if ($OPEN _list) {
echo "<a href= $PHP _self?proc=colloff&aid= $aid &pgno= $pgno >";
echo "[ぃ 甶 秨 bar 肈]";
echo "</a>";
}else {
echo "<a href= $PHP _self?proc=collon&aid= $aid &&pgno= $pgno >";
echo "[甶 秨 bar 肈]";
echo "</a>";
}
echo "</TD>";
echo "</tr></table>";

}
//===============================================================================
function Openlist ($SID) {
Global $aid;
Global $PHP _self;

$DROOT =getenv (' document_root ');
Include ("sql.php3");
$db =mysql_connect ($sql [' Host '], $sql [' User '], $sql [' passwd ']);
$qsql = "SELECT * from Bbs_docs where sid= ' $sid ' ORDER by wdate";
$rs =mysql_db_query ($sql [' db '], $qsql);
if (mysql_num_rows ($RS) ==0) return;
echo mysql_num_rows ($RS);
while ($row =mysql_fetch_array ($rs)) {
$id = $row [' id '];
$banner = $row [' banner '];
$poster = $row [' poster '];
$views = $row [' views '];
$wdate =sdatetime ($row [' wdate ']);

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 "banner is $banner";
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 Area () {
Global $PHP _self;
Global $aid, $sid, $pgno;
Global $OPEN _list;
$showitems = 20;
$DROOT =getenv (' document_root ');
Include ("sql.php3");
$db =mysql_connect ($sql [' Host '], $sql [' User '], $sql [' passwd ']);
//============================================================
if (! $aid) {
$qsql = "SELECT id from Bbs_area";
$rs =mysql_db_query ($sql [' db '], $qsql);
$row =mysql_fetch_array ($RS);
$aid = $row [' id '];
}
if (! $sid) {
$qsql = "SELECT id from BBS_SUBJ where aid= $aid order by wdate DESC";
$rs =mysql_db_query ($sql [' db '], $qsql);
$row =mysql_fetch_array ($RS);
$sid = $row [' id '];
}

if (! $pgno) {//Wheel ﹚ meter
$pgno = 0;
$items = 0;
$qsql = "SELECT id from BBS_SUBJ where aid= $aid order by wdate DESC";
$rs =mysql_db_query ($sql [' db '], $qsql);
while ($row =mysql_fetch_array ($rs)) {
$id = $row [' id '];
if ($id = = $sid) break;
$items + +;
}
$pgno = (INT) ($items/$showitems);
}

//============================================================
$qsql = "SELECT * from Bbs_area where id= $aid";
$rs =mysql_db_query ($sql [' db '], $qsql);
$row =mysql_fetch_array ($RS);
$banner = $row [' banner '];
$body = $row [' body '];
$master = $row [' master '];
echo "<center><font color=green size=5><b> $banner </b></font></center>";

echo "<form name=mtab enctype=multipart/form-data method=post action= $PHP _self?proc=search>";
echo "<table width=85% border=0 cellpadding=0 cellspacing=1 align=center ' class= ' >";
echo "<tr><td>";

echo "<input type= ' hidden ' name=aid value= ' $aid ' > ';
echo "Service 碝 がくしゅくしゅしていて Beecher:";
echo "<input type= ' TEXT ' name= ' key ' size=25 class= ' Tablefont ' >";
echo "<input type= ' Submit ' value= ' Sehnzhen xing Energ high ' class= ' Tablefont ' >";

echo "</td></tr>";
echo "</table>";
echo "</FORM>";

$qsql = "SELECT * from BBS_SUBJ where aid= $aid order by wdate DESC";
$rs =mysql_db_query ($sql [' db '], $qsql);
$all =mysql_num_rows ($RS); how Rows
$pages = (INT) ($all/$showitems); How pages
$pgcount = $pgno * $SHOWITEMS;
if ($pgcount > $all) {
$pgno = $pages-1; Page Point on all pages
$pgcount = $pgno * $SHOWITEMS;
}
Mysql_data_seek ($rs, $pgcount);
$cnt = 0;
Pagebar ($pages);
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)) {
if (+ + $cnt > $showitems) break;
$id = $row [' id '];
$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= $aid &sid= $id &rid= $id >";
if ($sid = = $id) echo "<font color=red>〈 $banner </font>";
else 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>";
if ($OPEN _list) openlist ($id);
}
echo "</td></tr></table>";
echo "</td></tr></table>";

Pagebar ($pages);
}
Cond........

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.