社区(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新手上路(五)
Oct 09 PHP
分页详解 从此分页无忧(PHP+mysql)
Nov 23 PHP
php FPDF类库应用实现代码
Mar 20 PHP
PHP基础之运算符的使用方法
Apr 28 PHP
浅析php中三个等号(===)和两个等号(==)的区别
Aug 06 PHP
显示youtube视频缩略图和Vimeo视频缩略图代码分享
Feb 13 PHP
Laravel 5框架学习之Laravel入门和新建项目
Apr 07 PHP
大家须知简单的php性能优化注意点
Jan 04 PHP
PHP生成可点击刷新的验证码简单示例
May 13 PHP
ThinkPHP打水印及设置水印位置的方法
Oct 14 PHP
php 删除指定文件夹的实例讲解
Jul 25 PHP
PHP经典设计模式之依赖注入定义与用法详解
May 21 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 木马攻击防御技巧
2009/06/13 PHP
跟我学Laravel之视图 &amp; Response
2014/10/15 PHP
php异步:在php中使用fsockopen curl实现类似异步处理的功能方法
2016/12/10 PHP
PHP实现文件下载【实例分享】
2017/04/28 PHP
利用JQuery+EasyDrag 实现弹出可拖动的Div,同时向Div传值,然后返回Div选中的值
2009/10/24 Javascript
javascript判断是否按回车键并解决浏览器之间的差异
2014/05/13 Javascript
JS简单验证上传文件类型的方法
2017/04/17 Javascript
vue 权限认证token的实现方法
2018/07/17 Javascript
angularJs提交文本框数据到后台的方法
2018/10/08 Javascript
JS基于开关思想实现的数组去重功能【案例】
2019/02/18 Javascript
webpack项目使用eslint建立代码规范实现
2019/05/16 Javascript
nodejs简单抓包工具使用详解
2019/08/23 NodeJs
如何在vue项目中嵌入jsp页面的方法(2种)
2020/02/06 Javascript
Vue2.4+新增属性.sync、$attrs、$listeners的具体使用
2020/03/08 Javascript
HTML+JS实现“代码雨”效果源码(黑客帝国文字下落效果)
2020/03/17 Javascript
JS实现网页时钟特效
2020/03/25 Javascript
vue项目启动出现cannot GET /服务错误的解决方法
2020/04/26 Javascript
三步搞定:Vue.js调用Android原生操作
2020/09/07 Javascript
进一步了解Python中的XML 工具
2015/04/13 Python
深度定制Python的Flask框架开发环境的一些技巧总结
2016/07/12 Python
Python实现调用另一个路径下py文件中的函数方法总结
2018/06/07 Python
Python编程深度学习绘图库之matplotlib
2018/12/28 Python
我用Python抓取了7000 多本电子书案例详解
2019/03/25 Python
pandas 强制类型转换 df.astype实例
2020/04/09 Python
Python如何将函数值赋给变量
2020/04/28 Python
pandas数据处理之绘图的实现
2020/06/15 Python
Python文件夹批处理操作代码实例
2020/07/21 Python
爬虫代理的cookie如何生成运行
2020/09/22 Python
python利用后缀表达式实现计算器功能
2021/02/22 Python
HTML5中的Scoped属性使用实例
2014/04/23 HTML / CSS
HTML 5 input placeholder 属性如何完美兼任ie
2014/05/12 HTML / CSS
Senreve官网:美国旧金山的奢侈手袋品牌
2019/03/21 全球购物
阿联酋手表和配饰购物网站:Rivolishop
2019/11/25 全球购物
后勤服务中心总经理工作职责
2014/03/03 职场文书
幼儿教师年度个人总结
2015/02/05 职场文书
Golang 实现WebSockets
2022/04/24 Golang