search
HomeBackend DevelopmentPHP TutorialCommunity (php&&mysql) 2_PHP Tutorial
Community (php&&mysql) 2_PHP TutorialJul 21, 2016 pm 04:05 PM
ampfunctionmysqlphpreplacestrtwoCommunity

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        $pd=$pgno+1;
        echo "[]";         
    }     
    for($i=0;$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 "
";
    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 "";
            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);
}
待续........ 

www.bkjia.comtruehttp://www.bkjia.com/PHPjc/315621.htmlTechArticlefunction sdatetime($str){ $str=ereg_replace(-,/,$str); $str=substr($str,5,strlen($str)-8); return $str; } function reAnum($sid){ //羆莱絞计 $DROOT=getenv('DOCUMENT_ROOT'); in...
Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
php怎么把负数转为正整数php怎么把负数转为正整数Apr 19, 2022 pm 08:59 PM

php把负数转为正整数的方法:1、使用abs()函数将负数转为正数,使用intval()函数对正数取整,转为正整数,语法“intval(abs($number))”;2、利用“~”位运算符将负数取反加一,语法“~$number + 1”。

php怎么设置implode没有分隔符php怎么设置implode没有分隔符Apr 18, 2022 pm 05:39 PM

在PHP中,可以利用implode()函数的第一个参数来设置没有分隔符,该函数的第一个参数用于规定数组元素之间放置的内容,默认是空字符串,也可将第一个参数设置为空,语法为“implode(数组)”或者“implode("",数组)”。

php怎么给数组增加一个数组元素php怎么给数组增加一个数组元素Apr 19, 2022 pm 08:45 PM

增加元素的方法:1、使用“array_unshift(数组,数组元素)”语句,在数组的开头添加元素;2、使用“array_push(数组,数组元素)”语句,在数组的末尾添加元素;3、用“array_pad(数组,数组长度+1,元素)”语句。

php怎么统计数组里同一个值有几个php怎么统计数组里同一个值有几个Apr 19, 2022 pm 08:26 PM

在php中,可以使用array_count_values()函数来统计数组里同一个值有几个,语法为“array_count_values($array)”;该函数会返回一个关联数组,其元素的键名是原数组的值,键值是该值在原数组中出现的次数。

开源软件的利与弊:深度解析开源模式开源软件的利与弊:深度解析开源模式Feb 24, 2024 pm 02:51 PM

开源软件的优点与弱点:解析开源模式的利与弊,需要具体代码示例在当今数字化信息时代,开源软件正逐渐成为软件开发的主流趋势。开源软件指的是其源代码可被公开查看、使用、修改和分发的软件。相比于传统的闭源软件,开源软件具有诸多优点,但同时也存在一些弱点。本文将从开源软件的优点和弱点两个方面展开讨论,同时结合具体代码示例,深入探究开源模式的利与弊。首先,让我们从开源软

实探“AI鬼城”:这个社区禁止人类发言,只能围观AI社交实探“AI鬼城”:这个社区禁止人类发言,只能围观AI社交May 30, 2023 pm 11:41 PM

有这样一个AI专属的社交平台,近日正在悄悄扩张。它名为“Chirper”,中文意为动物昆虫叫声的拟声词,官方翻译为“奇鸟”。网站域名在4月20日注册,上线不到一个月,平台中的AI就已经产生上亿条包含文字、图片、转评赞等社交行为的推文信息。——是的,支撑着这一社交平台运转的,无一例外全是AI。与此同时,平台对全体人类“禁言”,使其无法发言或进行任何社交行为,人们只能不断刷新首页,围观AI们的社交行为。那么,这个号称“禁止人类入内”的平台中真的只有AI吗?这些AI如何诞生?又如何进行争吵、互赞、甚至

PHP开发技术:打造一个网络问答社区PHP开发技术:打造一个网络问答社区Oct 27, 2023 am 11:05 AM

PHP开发技术:打造一个网络问答社区随着互联网的快速发展和信息的爆炸式增长,网络问答社区逐渐成为人们获取知识和解决问题的主要方式。在这样的背景下,利用PHP开发技术来打造一个高效、稳定的网络问答社区成为了一个具有吸引力的项目。一.社区特点及需求分析在开始开发之前,我们首先要明确社区的特点和用户需求,以确保开发的方向和目标清晰明确。1.用户黏性高:一个好的问答

Java框架社区对开发者个人的影响Java框架社区对开发者个人的影响Jun 03, 2024 pm 03:53 PM

Java框架社区对个人开发者有重大影响,通过以下方式:职业发展:提升就业机会,专业化和认证,网络和指导关系提升技术技能:持续学习,了解新技术,解决复杂问题参与开源项目:贡献代码,分享知识,接受挑战

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

Hot Tools

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Dreamweaver Mac version

Dreamweaver Mac version

Visual web development tools

WebStorm Mac version

WebStorm Mac version

Useful JavaScript development tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SecLists

SecLists

SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.