社区(php&&mysql)三

function prev_subj($id){
    $DROOT=getenv('DOCUMENT_ROOT');
    include("sql.php3");
    $db=mysql_connect($sql['host'], $sql['user'] , $sql['passwd']);  
    $qstr="select id,aid from bbs_subj where id='$id'";
    $rs=mysql_db_query($sql['db'],$qstr);     
    $row=mysql_fetch_array($rs);
    $aid=$row['aid'];

$qstr="select id from bbs_subj where aid='$aid' order by wdate DESC";
    $rs=mysql_db_query($sql['db'],$qstr);
    $pid=$id;     
    while($row=mysql_fetch_array($rs)){
        $tid=$row['id'];     
        if($id==$tid) break;
        $pid=$tid;
    }

return $pid;
}
// 絞
function next_subj($id){
    $DROOT=getenv('DOCUMENT_ROOT');
    include("sql.php3");
    $db=mysql_connect($sql['host'], $sql['user'] , $sql['passwd']);  
    $qstr="select id,aid from bbs_subj where id='$id'";
    $rs=mysql_db_query($sql['db'],$qstr);     
    $row=mysql_fetch_array($rs);
    $aid=$row['aid'];

$qstr="select id from bbs_subj where aid='$aid' order by wdate DESC";
    $rs=mysql_db_query($sql['db'],$qstr);
    $pid=$id;     
    while($row=mysql_fetch_array($rs)){
        $pid=$row['id'];     
        if($id==$pid) break;
    }
    if($row=mysql_fetch_array($rs)) {
        $pid=$row['id'];
    }
    return $pid;
}

//======================================================================
function viewbar() {
    global $pgno;
    global $PHP_SELF;
    global $aid,$sid;
    //global $OPEN_LIST;
    echo "<TABLE width=85% border=0 cellPadding=0 cellSpacing=1 align=center align=center class='num'>";
    echo "<tr><td align=center>";
        $nextid=next_subj($sid);
        $previd=prev_subj($sid);
        echo "<a href=$PHP_SELF?aid=$aid&sid=$sid>[夹肈跋]</a>";
        echo "<a href=#re>[莱セ絞]</a>";
        echo "<a href=$PHP_SELF?proc=view&aid=$aid>[祇穝ゅ彻]</a>";
        echo "<a href=$PHP_SELF?proc=view&aid=$aid&sid=$nextid&rid=$nextid>[絞]</a>";
        echo "<a href=$PHP_SELF?proc=view&aid=$aid&sid=$previd&rid=$previd>[絞]</a>";
        //echo "<a href=$PHP_SELF?proc=view&pgno=$pgno&aid=$aid&sid=$previd&rid=$previd>[程絞]</a>";

echo "</td>";

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

}
//======================================================================
function view() {
    global $PHP_SELF,$aid,$sid,$rid;
    global $c_poster,$c_email;
    //echo "$PHP_SELF,$aid,$sid,$rid,$pgno";
    $type=0; //秨穝杠肈
  if($sid && $rid) {
      addhitviews($sid,$rid);
    $type=1; //莱
    $db_table="bbs_subj";
    if($sid!=$rid)    $db_table="bbs_docs";
    $DROOT=getenv('DOCUMENT_ROOT');
    include("sql.php3");
    $db=mysql_connect($sql['host'], $sql['user'] , $sql['passwd']);  
    $qstr="select banner from bbs_area where id='$aid'";
    $rs=mysql_db_query($sql['db'],$qstr);
    echo mysql_error();
    $row=mysql_fetch_array($rs);
    $abanner=$row['banner'];

$qsql="SELECT * from $db_table where id='$rid' ";
    $rs=mysql_db_query($sql['db'],$qsql);
    $row=mysql_fetch_array($rs);
    $poster=$row['poster'];
    $pip=$row['pip'];
    $wdate=$row['wdate'];
    $rebanner=$banner=$row['banner'];
    $body=$row['body'];
    $body=htmlspecialchars($body);
    $pbody=ereg_replace("n","<br>",$body);
    $pbody =preg_replace( "/[www *]([\x0-\xff]*?)[/www *]/", '<a href="\1"  target="_blank">\1</a>', $pbody );  
    $pbody =preg_replace( "/[www +([a-zA-Z0-9.:/_-]+)]([\x0-\xff]*?)[/www *]/", '<a href="\1"  target="_blank">\2</a>', $pbody );

echo "<center>";
    echo "<font color=GREEN size=5><b>[$abanner]<br>";
    echo "$banner</b></font></center>";
    echo "<TABLE BORDER=0 width=95%  align=center cellPadding=1 cellSpacing=0 class='tablefont'>";
            echo "<TR><TD >";
                viewbar();
            echo "</td></tr>";
            echo "<TR><TD>";
            //====ゅ彻==============
            echo "<TABLE BORDER=0 width=100%  align=center cellPadding=1 cellSpacing=0 class='tablefont'>";
            echo "<TR>";
                echo "<TD  width='120' align='right'>";
                    echo ":";
                echo "</TD>";
                echo "<TD align='left'>";
                    echo $poster;
                echo "</TD>";
            echo "</TR>";
            echo "<TR>";
                echo "<TD width='120' align='right'>";
                    echo "ㄓ:";
                echo "</TD>";
                echo "<TD align='left'>";
                    echo $pip;
                echo "</TD>";
            echo "</TR>";
            echo "<TR>";
                echo "<TD width='120' align='right' valign='top'>";
                    echo "ゅ彻ず甧:";
                echo "</TD>";
                echo "<TD valign='top' class='bodycolor' align='left'>";
                            echo $pbody;
                            echo "<hr size=1>";
                echo "</TD>";
            echo "</TR>";
            echo "</TD></TR>";
            echo "</TABLE>";
            echo "<TR><TD >";

//=======籔狟ねだㄉ===============
                echo "<TABLE BORDER=0 width=100%   align=center cellPadding=3 cellSpacing=0 class='menufont'>";     
                echo "<FORM  name=mtab ENCTYPE=multipart/form-data METHOD=POST ACTION=$PHP_SELF?proc=mail_friend>";
                echo "<input type='hidden' name=sid value='$sid'>";
                echo "<input type='hidden' name=aid value='$aid'>";
                echo "<input type='hidden' name=rid value='$rid'>";
                echo "<input type='hidden' name=poster value='$c_poster'>";
                echo "<input type='hidden' name=email value='$c_email'>";
                    echo "<TR>";
                       echo "<TD align='right' width=250>";
                        echo "籔狟ねだㄉ硂絞ゅ彻:";
                       echo "</TD>";
                       echo "<TD>";
                        echo "<INPUT TYPE='TEXT' NAME='frmail' size=25 value='ねE-mail'>";

echo "<INPUT TYPE='Submit'value='癳'>";
                       echo "</TD>";
                    echo "</TR>";
                echo "</FORM>";     
                echo "</TABLE>";                 
            echo "</td></tr>";
            echo "<TR><TD >";
                //=======mail List===============
            echo "<TABLE BORDER=0 width=100%   align=center cellPadding=3 cellSpacing=0 class='menufont'>";     
            echo "<FORM  name=mtab ENCTYPE=multipart/form-data METHOD=POST ACTION=$PHP_SELF?proc=mail_list>";
                echo "<input type='hidden' name=sid value='$sid'>";
                echo "<input type='hidden' name=aid value='$aid'>";
                echo "<input type='hidden' name=rid value='$rid'>";
                echo "<input type='hidden' name=poster value='$c_poster'>";
                echo "<input type='hidden' name=email value='$c_email'>";

echo "<TR >";
               echo "<TD align='right' width=250>";
                echo "璹境o肈尿癚阶:";
               echo "</TD>";
               echo "<TD>";
                if(strlen($c_email)) $addmail=$c_email;
                else $addmail="E-mail";
                echo "<INPUT TYPE='TEXT' NAME='email' size=25 value='$addmail'>";
                echo "<INPUT TYPE='Submit' name='way1' value='璹?>";
                echo "<INPUT TYPE='Submit' name='way2' value='璹?>";
                $qsql="SELECT id from bbs_sml where sid='$sid'";
                $rs=mysql_db_query($sql['db'],$qsql);
                $nums=mysql_num_rows($rs);
                echo "<br>硂肈ヘ玡璹兢H计:$nums";
               echo "</TD>";
            echo "</TR>";     
            echo "</FORM>";
            echo "</TABLE>";

echo "</td></tr>";
            echo "<TR><TD >";
                viewbar();
            echo "</td></tr>";
        echo "</TABLE>";

待续........

(0)

相关推荐

  • 社区(php&&mysql)三

    function prev_subj($id){     $DROOT=getenv('DOCUMENT_ROOT');     include("sql.php3");     $db=mysql_connect($sql['host'], $sql['user'] , $sql['passwd']);      $qstr="select id,aid from bbs_subj where id='$id'";     $rs=mysql_db_query($

  • win10 下安装mysql服务器社区版本mysql 5.7.22 winx64的图文教程

    下载: http://dev.mysql.com/downloads/mysql/ 解压到C盘 添加环境变量path 添加环境变量 右击我的电脑->属性->高级系统设置->高级->环境变量-> 在系统变量中找到变量Path,点击编辑,在变量值最后面添加解压路径,路径要到bin文件夹下的路径,如: 以管理员权限运行cmd 安装MySQL服务 在cmd 命令窗口下 输入 mysqld install 初始化mysql数据库,这时会创建刚刚配置的data目录和一些数据库系统用的基本

  • 聊天室php&mysql(三)

    第三个页面 name="frame3.php" <? include "../signup/mysql.php"; //echo $userid; //echo $private; if($p)$p=1; else $p=0; if(($action="ok")and($p)){ $sql="select userid,id from chat_user_list where userid='$userid'"; $re

  • MySql三种避免重复插入数据的方法

    前言 MySql 在存在主键冲突或唯一键冲突的情况下,根据插入方式,一般有以下三种插入方式避免错误. insert ignore. replace into insert on duplicate key update insert ignore insert ignore 会忽视数据库中已经存在的数据,根据主键或者唯一索引判断,如果数据库没有数据,就会插入新的数据,如果有数据的话就跳过这条数据 小case 表结构 root:test> show create table t3G *******

  • mysql三种批量增加的性能分析

    下面把代码写出来,希望大家批评指正. 首先domain对象.在这里使用的注解的方式,都是比较新的版本. User.java 复制代码 代码如下: package com.bao.sample.s3h4.domain; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.Generatio

  • mysql三张表连接建立视图

    三张表连接·· A表的a字段 对应 B表的b字段 ,B表的b1字段对应C 表的c字段 现在 建立 一个视图,可以同时 看到三张表的 所有信息·~ create or replace view v_name as select t1.*,t2.*,t3.* from A表 t1, B表 t2, C表 t3 where t1.a=t2.b and t2.b1=t3.c 两表链接创建视图 CREATE TABLE `aa_user` ( `id` int(10) NOT NULL, `name` va

  • 社区(php&&mysql)一

    function cook_cooloff(){     global $PHP_SELF,$aid,$pgno;     setcookie("OPEN_LIST",0,time()+ 31536000);     Header("Location:$PHP_SELF?aid=$aid&pgno=$pgno");     exit; } //==========================================================

  • 社区(php&&mysql)五

    function post2() {     global $sid,$aid,$PHP_SELF;     global $banner,$body,$poster,$email,$type,$CHAR_GB; if(strlen($banner)==0 || strlen($body)==0 || strlen($poster)==0 || strlen($email)==0) {         echo "           <script language=javascript

  • 社区(php&&mysql)四

    echo "<br>";     echo "<TABLE width=85% border=0 cellPadding=0 cellSpacing=1 align=center bgcolor='#6CA6CD'>";       echo "<tr><td>";       echo "<TABLE width=100% cellPadding=1 cellSpacing=1 b

  • 社区(php&&mysql)六

    //此为bbs.sql CREATE TABLE bbs_area (    id int(10) unsigned DEFAULT '0' NOT NULL auto_increment,    master varchar(150) NOT NULL,    banner varchar(150) NOT NULL,    body text NOT NULL,    email varchar(50),    login varchar(20),    passwd varchar(20)

随机推荐