社区(php&&mysql)三


Posted in PHP onOctober 09, 2006

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

         
待续........
         

PHP 相关文章推荐
使用Apache的rewrite技术
Jun 22 PHP
PHP防注入安全代码
Apr 09 PHP
php下删除字符串中HTML标签的函数
Aug 27 PHP
php 静态化实现代码
Mar 20 PHP
PHP文件操作实现代码分享
Sep 01 PHP
php用正则表达式匹配URL的简单方法
Nov 12 PHP
根据ip调用新浪api获取城市名并转成拼音
Mar 07 PHP
PHP程序员基本要求和必备技能
May 09 PHP
PHP开源开发框架ZendFramework使用中常见问题说明及解决方案
Jun 12 PHP
php获取客户端电脑屏幕参数的方法
Jan 09 PHP
PHP之正则表达式捕获组与非捕获组(详解)
Jul 29 PHP
PHP简单实现记录网站访问量功能示例
Jun 06 PHP
利用php来自动调用不同服务器上的flash
Oct 09 #PHP
如何做到多笔资料的同步
Oct 09 #PHP
社区(php&amp;&amp;mysql)二
Oct 09 #PHP
社区(php&amp;&amp;mysql)一
Oct 09 #PHP
如何在PHP中使用Oracle数据库(6)
Oct 09 #PHP
如何在PHP中使用Oracle数据库(5)
Oct 09 #PHP
如何在PHP中使用Oracle数据库(4)
Oct 09 #PHP
You might like
浅谈电磁辐射对健康的影响
2021/03/01 无线电
在php MYSQL中插入当前时间
2008/04/06 PHP
PHP数学运算与数据处理实例分析
2016/04/01 PHP
分享一个漂亮的php验证码类
2016/09/29 PHP
关于Curl在Swoole协程中的解决方案详析
2019/09/12 PHP
jquery 防止表单重复提交代码
2010/01/21 Javascript
JavaScript中清空数组的三种方法分享
2011/04/07 Javascript
js生成随机数之random函数随机示例
2013/12/20 Javascript
利用javascript数组长度循环数组内所有元素
2013/12/27 Javascript
js操作模态窗口及父子窗口间相互传值示例
2014/06/09 Javascript
JavaScript获取数组最小值和最大值的方法
2015/06/09 Javascript
jQuery搜索框效果实现代码(百度关键词联想)
2021/02/25 Javascript
JavaScript定义全局对象的方法示例
2017/01/12 Javascript
js学习心得_一个简单的动画库封装tween.js
2017/07/14 Javascript
vue.js如何更改默认端口号8080为指定端口的方法
2017/07/14 Javascript
基于iScroll实现下拉刷新和上滑加载效果
2017/07/18 Javascript
VueJs使用Amaze ui调整列表和内容页面
2017/11/30 Javascript
[01:03:33]Alliance vs TNC 2019国际邀请赛小组赛 BO2 第一场 8.16
2019/08/18 DOTA
使用grappelli为django admin后台添加模板
2014/11/18 Python
Python的Django框架中设置日期和字段可选的方法
2015/07/17 Python
如何将你的应用迁移到Python3的三个步骤
2019/12/22 Python
Pycharm及python安装详细教程(图解)
2020/07/31 Python
详解css3 object-fit属性
2018/07/27 HTML / CSS
机械制造与自动化应届生求职信
2013/11/16 职场文书
测试工程师岗位职责
2013/11/28 职场文书
电子商务网站的创业计划书
2014/01/05 职场文书
军训 自我鉴定
2014/02/03 职场文书
大学拉赞助协议书范文
2014/09/26 职场文书
英文邀请函
2015/02/02 职场文书
审美与表现自我评价
2015/03/09 职场文书
行政介绍信范文
2015/05/04 职场文书
学校计划生育责任书
2015/05/09 职场文书
初中英语教师个人工作总结2015
2015/07/21 职场文书
写好求职信的技巧解密
2019/05/14 职场文书
退休劳动合同怎么写?
2019/10/25 职场文书
Python测试框架pytest核心库pluggy详解
2022/08/05 Golang