社区(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 相关文章推荐
一个自定义位数的php多用户计数器代码
Mar 11 PHP
由php if 想到的些问题
Mar 22 PHP
使用PHP 5.0创建图形的巧妙方法
Oct 12 PHP
php上传图片到指定位置路径保存到数据库的具体实现
Dec 30 PHP
一个严格的PHP Session会话超时时间设置方法
Jun 10 PHP
destoon设置自定义搜索的方法
Jun 21 PHP
推荐5款跨平台的PHP编辑器
Dec 25 PHP
codeigniter实现get分页的方法
Jul 10 PHP
PHP基于反射机制实现插件的可插拔设计详解
Nov 10 PHP
PHP使用preg_split()分割特殊字符(元字符等)的方法分析
Feb 04 PHP
Yii框架实现多数据库配置和操作的方法
May 25 PHP
laravel ORM 只开启created_at的几种方法总结
Jan 29 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
PHP初学者头疼问题总结
2006/10/09 PHP
php join函数应用
2011/05/04 PHP
教你如何开启shopnc b2b2c 伪静态
2014/10/21 PHP
PHP实现将几张照片拼接到一起的合成图片功能【便于整体打印输出】
2017/11/14 PHP
php日志函数error_log用法实例分析
2019/09/23 PHP
一些mootools的学习资源
2010/02/07 Javascript
caller和callee的区别介绍及演示结果
2013/03/10 Javascript
基于jquery的文章中所有图片width大小批量设置方法
2013/08/01 Javascript
JS扩展方法实例分析
2015/04/15 Javascript
javascript实现点击后变换按钮显示文字的方法
2015/05/13 Javascript
跟我学习javascript的基本类型和引用类型
2015/11/16 Javascript
JavaScript 身份证号有效验证详解及实例代码
2016/10/20 Javascript
jQuery模拟窗口抖动效果
2017/03/15 Javascript
Vue v2.4中新增的$attrs及$listeners属性使用教程
2018/01/08 Javascript
使用koa2创建web项目的方法步骤
2019/03/12 Javascript
简单谈谈javascript高级特性
2019/09/04 Javascript
vue-cli3单页构建大型项目方案
2020/04/07 Javascript
PHP读取远程txt文档到数组并实现遍历
2020/08/25 Javascript
JavaScript获取时区实现过程解析
2020/09/24 Javascript
[01:11]回顾历届DOTA2国际邀请赛中国区预选赛
2017/06/26 DOTA
python实现多进程代码示例
2018/10/31 Python
python实现从pdf文件中提取文本,并自动翻译的方法
2018/11/28 Python
在python tkinter中Canvas实现进度条显示的方法
2019/06/14 Python
通过 Python 和 OpenCV 实现目标数量监控
2020/01/05 Python
jupyter lab文件导出/下载方式
2020/04/22 Python
Django 解决阿里云部署同步数据库报错的问题
2020/05/14 Python
CSS3 box-sizing属性
2009/04/17 HTML / CSS
html5配合css3实现带提示文字的输入框(摆脱js)
2013/03/08 HTML / CSS
美国休闲服装品牌:Express
2016/09/24 全球购物
英国莱斯特松木橡木家具网上商店:Choice Furniture Superstore
2019/07/05 全球购物
高中三年学习生活的自我评价
2013/10/10 职场文书
总会计师岗位职责
2014/02/19 职场文书
大学毕业生管理学求职信
2014/09/01 职场文书
毕业赠语大全
2015/06/23 职场文书
休假证明书
2015/06/24 职场文书
为什么MySQL选择Repeatable Read作为默认隔离级别
2021/07/26 MySQL