社区(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 相关文章推荐
我的论坛源代码(四)
Oct 09 PHP
PHP文件上传原理简单分析
May 29 PHP
微博短链接算法php版本实现代码
Sep 15 PHP
PHP基础教程(php入门基础教程)一些code代码
Jan 06 PHP
解析如何用php screw加密php源代码
Jun 20 PHP
PHP网页游戏学习之Xnova(ogame)源码解读(九)
Jun 24 PHP
php中base_convert()进制数字转换函数实例
Nov 20 PHP
PHP使用PHPExcel删除Excel单元格指定列的方法
Jul 06 PHP
windows下的WAMP环境搭建图文教程(推荐)
Jul 27 PHP
PHP里的$_GET数组介绍
Mar 22 PHP
详解Laravel设置多态关系模型别名的方式
Oct 17 PHP
PHP Swoole异步MySQL客户端实现方法示例
Oct 24 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随机生成唯一HASH值自定义函数
2015/04/20 PHP
php实现图片上传、剪切功能
2016/05/07 PHP
zeroclipboard复制到剪切板的flash
2010/08/04 Javascript
JavaScript中对循环语句的优化技巧深入探讨
2014/06/06 Javascript
jquery解决客户端跨域访问问题
2015/01/06 Javascript
JS实现浏览器状态栏文字闪烁效果的方法
2015/10/27 Javascript
javascript html5移动端轻松实现文件上传
2020/03/27 Javascript
js获取iframe中的window对象的实现方法
2016/05/20 Javascript
JavaScript手机振动API
2016/06/11 Javascript
jQuery中的一些常见方法小结(推荐)
2016/06/13 Javascript
微信QQ的二维码登录原理js代码解析
2016/06/23 Javascript
ASP.NET jquery ajax传递参数的实例
2016/11/02 Javascript
Node.js 的模块知识汇总
2017/08/16 Javascript
浅谈Express异步进化史
2017/09/09 Javascript
Vue组件教程之Toast(Vue.extend 方式)详解
2019/01/27 Javascript
ES6顶层对象、global对象实例分析
2019/06/14 Javascript
python中的列表推导浅析
2014/04/26 Python
利用 python 对目录下的文件进行过滤删除
2017/12/27 Python
Pyqt实现无边框窗口拖动以及窗口大小改变
2018/04/19 Python
Python错误处理操作示例
2018/07/18 Python
5款Python程序员高频使用开发工具推荐
2019/04/10 Python
python实现连连看辅助(图像识别)
2020/03/25 Python
Python之Numpy的超实用基础详细教程
2019/10/23 Python
python爬虫模拟浏览器的两种方法实例分析
2019/12/09 Python
python爬虫开发之selenium模块详细使用方法与实例全解
2020/03/09 Python
泰国王权免税店官方网站:KingPower
2019/03/11 全球购物
this关键字的作用
2016/01/30 面试题
Servlet都有哪些方法?主要作用是什么?
2014/03/04 面试题
总经理助理工作职责
2014/02/06 职场文书
《问银河》教学反思
2014/02/19 职场文书
社区食品安全实施方案
2014/03/28 职场文书
教育系统干部作风整顿心得体会
2014/09/09 职场文书
县政府领导班子四风问题对照检查材料思想汇报
2014/09/26 职场文书
教师群众路线教育实践活动学习笔记
2014/11/05 职场文书
花田少年史观后感
2015/06/16 职场文书
迎新年主持词
2015/07/06 职场文书