社區(php&&mysql)二

來源:互聯網
上載者:User
關鍵字 社區(php&&mysql)二
function sdatetime($str){
  $str=ereg_replace("-","/",$str);
  $str=substr($str,5,strlen($str)-8);
  return $str;
}

function reAnum($sid){ //羆萊絞計
  $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 "



";   echo " ";   echo " ";   //echo " ";       echo "
";
  if($pgno!=0) {
    $pu=$pgno-1;
    echo "[]";    
  }  
  if($pgno<$pages) {
    $pd=$pgno+1;
    echo "[]";    
  }  
  for($i=0;$i<=$pages;$i++) {
    if($pgno==$i) {
      echo "";
      echo "[".($i+1)."]";
      echo "
";  
    } else {
      echo "";
      echo "[".($i+1)."]";
      echo "";  
    }
  }
  echo "
";
    echo "";
        echo "[祇ゅ徹]";
        echo "";
  //echo "
";
      if($OPEN_LIST) {
        echo "";
        echo "[ぃ甶秨杠肈]";
        echo "";
      }else {
        echo "";
        echo "[甶秨杠肈]";
        echo "";
      }
  echo "
";  
  
}
//===============================================================================
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 "";
        echo "";
          echo "";
          echo " $banner";
          echo "";
          //echo "banner is $banner";
        echo "";
        echo "";
          echo $poster;
        echo "";
        echo "";
          echo " ";
        echo "";
        echo "";
          echo $views;
        echo "";
        echo "";
          echo $wdate;
        echo "";
      
      echo "";
  }
  
}

//========================================================================
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) {//礚﹚計
    //$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 " $banner";
  
  echo ""; 
  
  $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 over all pages
    $pgcount=$pgno*$showitems;
   }
  mysql_data_seek($rs, $pgcount);
  $cnt=0;
  pagebar($pages);
  echo "
";    echo "
";
   echo "
























";     echo " ";       echo " ";       echo " ";       echo " ";       echo " ";       echo " ";     echo " ";     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 " ";         echo " ";         echo " ";         echo " ";         echo " ";         echo " ";       echo " ";       if($OPEN_LIST) openlist($id);     }    echo "
夾肈祇癬ら戳
";
          echo "";
            if($sid==$id) echo "〈$banner";
            else echo $banner;
          echo "";
        echo "
";
          echo $poster;
        echo "
";
          echo $docs;
        echo "
";
          echo $views;
        echo "
";
          echo $wdate;
        echo "
";
  echo"
";   
  
  pagebar($pages);
}
待續........
  • 相關文章

    聯繫我們

    該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

    如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

    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.