您现在的位置: 军旅同心-旅游自驾-军旅文学 >> 读书赏析 >> 学习园地 >> 电脑网络 >> 技术文章 >> 正文
社区(php&&mysql)三
作者:采集员 文章来源:来源于网络 点击数: 更新时间:2005-9-10 14:35:48
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>";
     

[1] [2] [3] 下一页


更多
免责声明:作品版权归所属媒体与作者所有!!本站刊载此文不代表同意其说法或描述,仅为提供更多信息。如果您认为我们侵犯了您的版权,请告知!本站立即删除。有异议请联系我们。
文章录入:烟灰缸    责任编辑:烟灰缸 
  • 上一篇文章:
  • 下一篇文章:
  • 网友评论:(只显示最新10条。评论内容只代表网友观点,与本站立场无关!)
    | 设为首页 | 加入收藏 | 联系站长 | 友情链接 | 网站地图 | 版权申明 | 网站公告 | 管理登录 |