BBS(php & mysql)完整版(三)

//此页面为php3.php
<?
include "signup/mysql.inc";
switch($part){
   case "1" :$table="bbs_php";break;
   case "2" :$table="bbs_mysql";break;
   case "3" :$table="bbs_html";break;
   case "4" :$table="bbs_js";
   }
//echo $part;
?>

<html>
<head>
<title>xiaoyang</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<script language="JavaScript1.2" src="js/menu_comment.js"></script>
<script language="JavaScript1.2" src="js/fw_menu.js"></script>
<script language="JavaScript">
<!--
function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);
// -->
</script>
</head>

<body bgcolor="#FFFFFF" text="#000000">
<div id="Layer1" style="position:absolute; left:31px; top:1px; width:560px; height:46px; z-index:10">
<script language="JavaScript1.2">fwLoadMenus();</script></div>

<div id="Layer2" style="position:absolute; left:27px; top:41px; width:600px; height:15px; z-index:2">
  <hr color="#ff9999">
</div>
<div id="Layer3" style="position:absolute; left:73px; top:10px; width:2px; height:330px; z-index:3; background-color: #ff9999; layer-background-color: #ff9999; border: 1px none #000000"></div>
<div id="Layer4" style="position:absolute; left:560px; top:10px; width:2px; height:330px; z-index:4; background-color: #ff9999; layer-background-color: #ff9999; border: 1px none #000000"></div>
<div id="Layer5" style="position:absolute; left:86px; top:58px; width:464px; height:273px; z-index:5">  
  <table width="100%" border="0" cellspacing="1" cellpadding="0" height="20">
    <tr>  
      <td width="10%">  
        <div align="center"><font color="#CC33CC" size="2">人气</font></div>
      </td>
      <td width="38%">  
        <div align="center"><font color="#CC33CC" size="2">文章题目</font></div>
      </td>
      <td width="26%">  
        <div align="center"><font size="2" color="#CC33CC">作者</font></div>
      </td>
      <td width="26%">  
        <div align="center"><font color="#CC33CC" size="2">日期</font></div>
      </td>
    </tr>

<?

$sql="select * from ".$table." order by row DESC";
   $result=mysql_query($sql)or die(mysql_error());
   $row1=mysql_num_rows($result);

$row_max_page=12;                      //分页计算
   $page=ceil($row1/$row_max_page);
   $left_row=$row1-$p*$row_max_page;
   $pre_left_row=$left_row+12;
   $start_row=$left_row+$row_max_page+1;
   if($left_row<=0)
     {
     $start_row=$pre_left_row+1;
     $left_row=0;
     }

$sql="select * from ".$table." where row<'$start_row' and row>'$left_row' order by row DESC";
    $result=mysql_query($sql)or die(mysql_error());

while($row=mysql_fetch_array($result)){

static $i=0;
       $i++;
       if($i%2)
        $color="CCCCFF";
       else $color="FFCCFF";
    echo "<tr>";  
    echo "  <td width=10% bgcolor=#".$color."> ";
    echo "    <div align=center><font size=2 color=#3333FF>".$row["number"]."</font></div>";
    echo "  </td>";
    echo "  <td width=38% bgcolor=#".$color."> ";
    echo "    <div align=center><font size=2 color=#3333FF><a    href='look.php?id=".$row["id"]."&&table=".$table."'>".$row["title"]."</a></font></div>";
    echo "  </td>";
    echo "  <td width=26% bgcolor=#".$color."> ";
    echo "    <div align=center><font size=2 color=#3333FF>".$row["userid"]."</font></div>";
    echo "  </td>";
    echo "  <td width=26% bgcolor=#".$color."> ";
    echo "    <div align=center><font size=2 color=#3333FF>".$row["date1"]."</font></div>";
    echo "  </td>    </tr>";

}

echo"</table>";                
    echo "<BR><div align=center><table><tr><td><FONT SIZE=2 >";
   for($i=1;$i<=$page;$i++)
   {
   echo "<a href='".$PHP_SELF."?p=".$i."&&table=".$table."'>[".$i."]</a> ";
   }
   ?>
    </FONT></td></tr>
  </table></div>
</div>
<div id="Layer6" style="position:absolute; left:409px; top:29px; width:118px; height:17px; z-index:6"></div>
<div id="Layer7" style="position:absolute; left:451px; top:28px; width:65px; height:12px; z-index:8">  
  <a href="say.php?table=<?echo $table ;?>" target="_self" onMouseOver="window.status='';return true"><font size="2" color="#FF33FF">我要发言</font></a></div>
<p> </p>
<p> </p>
</body>
</html>

(0)

相关推荐

  • BBS(php & mysql)完整版(三)

    //此页面为php3.php <? include "signup/mysql.inc"; switch($part){    case "1" :$table="bbs_php";break;    case "2" :$table="bbs_mysql";break;    case "3" :$table="bbs_html";break;    case

  • BBS(php & mysql)完整版(一)

    //此页面为say.php <? include "signup/mysql.inc"; if($id1){        $sql="select * from $table where id='$id1'";    //显示回复题目        $result=mysql_query($sql)or die(mysql_error());        $row=mysql_fetch_array($result);        $title=&quo

  • BBS(php & mysql)完整版(五)

    //下面为menu_comment.js function fwLoadMenus() {   if (window.fw_menu_0) return;   window.fw_menu_0 = new Menu("root",92,20,"Verdana, Arial, Helvetica, sans-serif",12,"#6666ff","#ffffff","#FF9999","#6666

  • BBS(php & mysql)完整版(七)

    //下面是  top.js function KB_keepItInIE(theName,theWantTop,theWantLeft) { theRealTop=parseInt(document.body.scrollTop) theTrueTop=theWantTop+theRealTop document.all[theName].style.top=theTrueTop theRealLeft=parseInt(document.body.scrollLeft) theTrueLeft

  • BBS(php & mysql)完整版(二)

    //此页面为look.php <? include "signup/mysql.inc"; $sql="select * from ".$table." where id='$id'"; $result=mysql_query($sql)or die(mysql_error()); $row=mysql_fetch_array($result); $number=++$row["number"]; $sql="

  • BBS(php & mysql)完整版(八)

    //完毕 wish you sucess!! # phpMyAdmin MySQL-Dump # http://phpwizard.net/phpMyAdmin/ # # 主机: localhost:3306 数据库 : database # -------------------------------------------------------- # # 数据表的结构 'bbs_html' # CREATE TABLE bbs_html (    id int(15) DEFAULT '

  • BBS(php & mysql)完整版(六)

    +proto.menuBorder;             var focusItem = body.document.layers[n];             focusItem.clip.width = body.clip.width;             focusItem.Menu = l.Menu;             focusItem.top = -30;             focusItem.captureEvents(Event.MOUSEDOWN);   

  • BBS(php & mysql)完整版(四)

    //此页面为 top.php <html> <head> <title>Untitled Document</title> <meta http-equiv="Content-Type" content="text/html; charset=gb2312"> <script language="JavaScript1.2" src="js/fw_menu.js"

  • Mysql命令大全(完整版)

    一.连接数据库 格式:mysql -h主机地址 -u用户名 -p用户密码 1.1.连接到本机上的MYSQL. 首先打开DOS窗口,然后进入目录mysql\bin,再键入命令mysql -u root -p,回车后提示你输密码. 注意用户名前可以有空格也可以没有空格,但是密码前必须没有空格,否则让你重新输入密码. 如果刚安装好MYSQL,超级用户root是没有密码的,故直接回车即可进入到MYSQL中了,MYSQL的提示符是: mysql> 1.2连接到远程主机上的MYSQL. 假设远程主机的IP为

  • Java栈的三种实现方式(完整版)

    java什么是栈 系统中的堆.栈和数据结构堆.栈不是一个概念.可以说系统中的堆.栈是真实的内存物理区,数据结构中的堆.栈是抽象的数据存储结构. 栈:实际上就是满足后进先出的性质,是一种数据项按序排列的数据结构,只能在一端(称为栈顶(top))对数据项进行插入和删除. 栈区(stack)- 由编译器自动分配释放 ,存放函数的参数值,局部变量的值等.其操作方式类似于数据结构中的栈. 栈的优势是,存取速度比堆要快,仅次于直接位于CPU中的寄存器.但缺点是,存在栈中的数据大小与生存期必须是确定的,缺乏灵

随机推荐