您的位置:首页网页设计PHP实例 → 社区php&&mysql二

社区php&&mysql二

时间:2004/11/7 3:27:00来源:本站整理作者:蓝点我要评论(0)

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

                echo "";

                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 "

";

    echo "

";

                    echo "";

                    echo "&nbsp;&nbsp;$banner";

                    echo "";

                    //echo "banner is $banner";

                echo "
";

                    echo $poster;

                echo "
";

                    echo "&nbsp;";

                echo "
";

                    echo $views;

                echo "
";

                    echo $wdate;

                echo "

";

      echo "

";

           

              echo "";     

              echo "穓碝ゅ彻:";

              echo "";

              echo "";

           

      echo "";

    echo "";  

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

        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 "";          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);

}

待续........ 

相关阅读 Windows错误代码大全 Windows错误代码查询激活windows有什么用Mac QQ和Windows QQ聊天记录怎么合并 Mac QQ和Windows QQ聊天记录Windows 10自动更新怎么关闭 如何关闭Windows 10自动更新windows 10 rs4快速预览版17017下载错误问题Win10秋季创意者更新16291更新了什么 win10 16291更新内容windows10秋季创意者更新时间 windows10秋季创意者更新内容kb3150513补丁更新了什么 Windows 10补丁kb3150513是什么

文章评论
发表评论

热门文章 没有查询到任何记录。

最新文章 我的php文件怎么打开_php运算符怎么写 php 如何生成静态页面的函数PHP生成图片缩略图PHP session常见问题集锦及解决办法PHP实现同步远程Mysql

人气排行 DEDE在文章列表文章没有缩略图的不显示图片php+mysq修改用户密码我的php文件怎么打开_如何打开php文件的办法FCKeditor的配置和使用方法使用dedecms建站教程PHP+Ajax实现分页技术图片存储与浏览一例Linux+Apache+PHP+MySQLPHP生成图片缩略图