社区(php&&mysql)五


Posted in PHP onOctober 09, 2006

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>
            alert('恶?ぃЧ俱');
            history.back();
          </script>
         ";
        return;
    }

    //$banner=AddSlashes($banner);
    //$body=AddSlashes($body);
    $rip=getenv('REMOTE_ADDR');

    $DROOT=getenv('DOCUMENT_ROOT');
    include("sql.php3");
    $db=mysql_connect($sql['host'], $sql['user'] , $sql['passwd']);  
    $now=date('Y')."-".date('m')."-".date('d')." ".date('H').":".date('i').":".date('s');

    if($CHAR_GB==1) {
        include("CCharset.php3");
        $code=new CCharset;
        $banner=$code->Gb_Big5($banner);
        $body=$code->Gb_Big5($body);
        $poster=$code->Gb_Big5($poster);             
    }

    if($type==1) {
        $qsql="INSERT INTO bbs_docs (aid,sid,banner,body,poster,email,pip,wdate)
           values('$aid','$sid','$banner','$body','$poster','$email','$rip','$now')";
    } else {
        $qsql="INSERT INTO bbs_subj (aid,banner,body,poster,email,pip,wdate)
           values('$aid','$banner','$body','$poster','$email','$rip','$now')";
    }     
    $rs=mysql_db_query($sql['db'],$qsql);
    $id=mysql_insert_id();

     

    if($type==0) { //?笆??mail_list
        $qsql="INSERT INTO  bbs_sml (sid,email) values('$id','$email')";
        $rs=mysql_db_query($sql['db'],$qsql);

    }
    if($type==0)  Send_the_doc_to_mail_list($aid,$id,$id);
    else           Send_the_doc_to_mail_list($aid,$sid,$id);     
    //incdocs($aid);
    if($type==0) { $sid=$rid=$id;}
    else         { $rid=$id;}
    echo "
          <script language=javascript>
          document.location='$PHP_SELF?proc=view&aid=$aid&sid=$sid&rid=$rid'
          </script>
         ";  

}
//======================================================================
function search_docs($aid,$skey) {
    $DROOT=getenv('DOCUMENT_ROOT');
    include("sql.php3");
    $db=mysql_connect($sql['host'], $sql['user'] , $sql['passwd']);  
    //$qsql="SELECT * from bbs_docs where sid='$id' and (banner like '$skey' or poster like '$skey' or body like '$skey') order by wdate DESC";
    if($aid) $qsql="SELECT * from bbs_docs where aid='$aid' and (banner like '$skey' or poster like '$skey' or body like '$skey') order by wdate DESC";
    else $qsql="SELECT * from bbs_docs where  (banner like '$skey' or poster like '$skey' or body like '$skey') order by wdate DESC";     
    $rs=mysql_db_query($sql['db'],$qsql);
        while($row=mysql_fetch_array($rs)) {
        $id=$row['id'];
            $banner=$row['banner'];
            $poster=$row['poster'];
            $views=$row['views'];
            $wdate=sdatetime($row['wdate']);
            $aid=$row['aid'];
            $sid=$row['sid'];

            echo "<tr bgcolor='#F0F0F0'>";
                echo "<td>";
                    echo "<a href=$PHP_SELF?proc=view&aid=$aid&sid=$sid&rid=$id>";
                    echo "  <font color=#836FFF>$banner</font>";
                    echo "</a>";

                echo "</td>";
                echo "<td>";
                    echo $poster;
                echo "</td>";
                echo "<td class='num'>";
                    echo " ";
                echo "</td>";
                echo "<td class='num'>";
                    echo $views;
                echo "</td>";
                echo "<td class='num'>";
                    echo $wdate;
                echo "</td>";

            echo "</tr>";
    }

}
//======================================================================
function search() {
    global $PHP_SELF;
    global $key,$aid;
    if(!strlen($key)) {
    echo "
          <script language=javascript>
            history.back();
          </script>
         ";
    }
    echo "<TABLE width=85% border=0 cellPadding=0 cellSpacing=1 align=center class='tablefont'>";
    echo "<FORM  name=mtab  ENCTYPE=multipart/form-data METHOD=POST ACTION=$PHP_SELF?proc=search>";

      echo "<tr><td>";

              echo "<input type='hidden' name=aid value='$aid'>";     
              echo "??ゅ彻:";
              echo "<INPUT TYPE='TEXT' NAME='key' value='$key' size=25 class='tablefont'>";
              echo "<INPUT TYPE='Submit'value='?高' class='tablefont'>";

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

     
    $skey="%$key%";
    $DROOT=getenv('DOCUMENT_ROOT');
    include("sql.php3");
    $db=mysql_connect($sql['host'], $sql['user'] , $sql['passwd']);  
    if($aid) $qsql="SELECT * from bbs_subj where aid='$aid' and (banner like '$skey' or poster like '$skey' or body like '$skey') order by wdate DESC";
    else $qsql="SELECT * from bbs_subj where  (banner like '$skey' or poster like '$skey' or body like '$skey') order by wdate DESC";     
    //echo $qsql;
    $rs=mysql_db_query($sql['db'],$qsql);

    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 bgcolor=white class='tablefont'>";
        echo "<tr bgcolor=#F1E1FF>";
            echo "<th >夹?</th>";
            echo "<th>???</th>";
            echo "<th width=30>?莱</th>";
            echo "<th width=30>??</th>";
            echo "<th width=70>ら戳</th>";
        echo "</tr>";
        while($row=mysql_fetch_array($rs)) {
            $id=$row['id'];
            $paid=$row['aid'];
            $banner=$row['banner'];
            $poster=$row['poster'];
            $views=$row['views'];
            $wdate=sdatetime($row['wdate']);
            $docs=reAnum($id);
            echo "<tr bgcolor='#F0F8FF'>";
                echo "<td>";
                    echo "<a href=$PHP_SELF?proc=view&aid=$paid&sid=$id&rid=$id>";
                        echo $banner;
                    echo "</a>";
                echo "</td>";
                echo "<td>";
                    echo $poster;
                echo "</td>";
                echo "<td class='num'>";
                    echo $docs;
                echo "</td>";
                echo "<td class='num'>";
                    echo $views;
                echo "</td>";
                echo "<td class='num'>";
                    echo $wdate;
                echo "</td>";
            echo "</tr>";

        }
        search_docs($aid,$skey);
      echo "</td></tr></table>";
    echo"</td></tr></table>";       

     

     
}
//======================================================================

if($proc=="post2") {
    setcookie("c_poster",$poster,time()+ 31536000);
    setcookie("c_email",$email,time()+ 31536000);
}

//if($proc!="do_sel" &&  $proc!="post2" && $proc!="colloff" && $proc!="collon") include("frame_top.php3");
switch($proc) {
        case search:
             search();
             break;
        case mail_list:
             mail_list();
             break;
        case mail_friend:
             mail_friend();
             break;
        case post2:
             post2();
             break;
        case colloff:
             cook_cooloff();
             break;
        case collon:
             cook_coolon();
             break;
        case view;
             view();
             break;      
        default:
            area();
            break;
    }
//if($proc!="do_sel" && $proc!="post2" && $proc!="colloff" && $proc!="collon") include("frame_bottom.php3");     
?>

以上前五篇为一个页面 

PHP 相关文章推荐
PHP中for循环语句的几种变型
Mar 16 PHP
php递归删除目录下的文件但保留的实例分享
May 10 PHP
ThinkPHP实现将本地文件打包成zip下载
Jun 26 PHP
php连接odbc数据源并保存与查询数据的方法
Dec 24 PHP
ecshop后台编辑器替换成ueditor编辑器
Mar 03 PHP
jQuery+Ajax+PHP“喜欢”评级功能实现代码
Oct 08 PHP
PHP实现搜索地理位置及计算两点地理位置间距离的实例
Jan 08 PHP
PHP操作FTP类 (上传、下载、移动、创建等)
Mar 31 PHP
php常用数组array函数实例总结【赋值,拆分,合并,计算,添加,删除,查询,判断,排序】
Dec 07 PHP
PHP实现类似题库抽题效果
Aug 16 PHP
laravel 字段格式化 modle 字段类型转换方法
Sep 30 PHP
php 下 html5 XHR2 + FormData + File API 上传文件操作实例分析
Feb 28 PHP
社区(php&amp;&amp;mysql)四
Oct 09 #PHP
社区(php&amp;&amp;mysql)三
Oct 09 #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
You might like
php-accelerator网站加速PHP缓冲的方法
2008/07/30 PHP
Codeigniter实现处理用户登录验证后的URL跳转
2014/06/12 PHP
destoon整合UCenter图文教程
2014/06/21 PHP
php的闭包(Closure)匿名函数详解
2015/02/22 PHP
一个完整的php文件上传类实例讲解
2015/10/27 PHP
js动态控制table的tr、td增加及删除的具体实现
2014/04/30 Javascript
Bootstrap学习笔记之js组件(4)
2016/06/12 Javascript
用nodejs的实现原理和搭建服务器(动态)
2016/08/10 NodeJs
canvas绘制万花筒效果(代码分享)
2017/01/20 Javascript
详解angular中通过$location获取路径(参数)的写法
2017/03/21 Javascript
JavaScript反弹动画效果的实现代码
2017/07/13 Javascript
jQuery中each遍历的三种方法实例分析
2018/09/07 jQuery
vue代码分割的实现(codesplit)
2018/11/13 Javascript
Angular8路由守卫原理和使用方法
2019/08/29 Javascript
手把手15分钟搭一个企业级脚手架
2019/09/16 Javascript
[33:28]完美世界DOTA2联赛PWL S3 PXG vs GXR 第三场 12.19
2020/12/24 DOTA
Python实现windows下模拟按键和鼠标点击的方法
2015/03/13 Python
Python操作SQLite数据库的方法详解【导入,创建,游标,增删改查等】
2017/07/11 Python
Python实现mysql数据库更新表数据接口的功能
2017/11/19 Python
快速了解Python中的装饰器
2018/01/11 Python
使用python和pygame绘制繁花曲线的方法
2018/02/24 Python
python实现雨滴下落到地面效果
2018/06/21 Python
python自动化生成IOS的图标
2018/11/13 Python
python解压TAR文件至指定文件夹的实例
2019/06/10 Python
十行代码使用Python写一个USB病毒
2019/06/21 Python
对Django 转发和重定向的实例详解
2019/08/06 Python
python numpy生成等差数列、等比数列的实例
2020/02/25 Python
python跨文件使用全局变量的实现
2020/11/17 Python
Jogun Shop中文官网:韩国知名时尚男装网站
2016/10/12 全球购物
舒适的豪华鞋:Taryn Rose
2018/05/03 全球购物
奥利奥广告词
2014/03/20 职场文书
节电标语大全
2014/06/23 职场文书
2014年办公室个人工作总结
2014/11/12 职场文书
无婚姻登记记录证明
2015/06/18 职场文书
sass 常用备忘案例详解
2021/09/15 HTML / CSS
js面向对象编程OOP及函数式编程FP区别
2022/07/07 Javascript