社区(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下载远程文件类(支持断点续传)
Nov 14 PHP
PHP+Mysql日期时间如何转换(UNIX时间戳和格式化日期)
Jul 15 PHP
解析二进制流接口应用实例 pack、unpack、ord 函数使用方法
Jun 18 PHP
php取整函数ceil,floo,round的用法及介绍
Aug 31 PHP
举例详解PHP脚本的测试方法
Aug 05 PHP
php实现的单一入口应用程序实例分析
Sep 23 PHP
10个对初学者非常有用的PHP技巧
Apr 06 PHP
PHP使用strrev翻转中文乱码问题的解决方法
Jan 13 PHP
CentOS系统中PHP安装扩展的方式汇总
Apr 09 PHP
在Laravel中实现使用AJAX动态刷新部分页面
Oct 15 PHP
PHP常用函数之格式化时间操作示例
Oct 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
sqlyog 中文乱码问题的设置方法
2008/10/19 PHP
纯真IP数据库的应用 IP地址转化成十进制
2009/06/14 PHP
常见php数据文件缓存类汇总
2014/12/05 PHP
PHP获取表单数据与HTML嵌入PHP脚本的实现
2017/02/09 PHP
PHP使用gearman进行异步的邮件或短信发送操作详解
2020/02/27 PHP
ExtJS 2.2.1的grid控件在ie6中的显示问题
2009/05/04 Javascript
js中判断文本框是否为空的两种方法
2011/07/31 Javascript
jQuery EasyUI API 中文文档 DateTimeBox日期时间框
2011/10/16 Javascript
ie8 不支持new Date(2012-11-10)问题的解决方法
2013/07/31 Javascript
使用jquery hover事件实现表格的隔行换色功能示例
2013/09/03 Javascript
让JavaScript的Alert弹出框失效的方法禁止弹出警告框
2014/09/03 Javascript
微信小程序 wxapp导航 navigator详解
2016/10/31 Javascript
Vue.js 单页面多路由区域操作的实例详解
2017/07/17 Javascript
微信小程序 select 下拉框组件功能
2019/09/09 Javascript
python 生成不重复的随机数的代码
2011/05/15 Python
编写同时兼容Python2.x与Python3.x版本的代码的几个示例
2015/03/30 Python
神经网络python源码分享
2017/12/15 Python
利用python 更新ssh 远程代码 操作远程服务器的实现代码
2018/02/08 Python
python 删除字符串中连续多个空格并保留一个的方法
2018/12/22 Python
Python中常用的内置方法
2019/01/28 Python
解决Python中回文数和质数的问题
2019/11/24 Python
使用AJAX和Django获取数据的方法实例
2020/10/25 Python
基于Python的图像阈值化分割(迭代法)
2020/11/20 Python
使用豆瓣源来安装python中的第三方库方法
2021/01/26 Python
携程英文网站:Trip.com
2017/02/07 全球购物
高二美术教学反思
2014/01/14 职场文书
珠宝店促销方案
2014/03/21 职场文书
工作保证书范文
2014/04/29 职场文书
明星员工获奖感言
2014/08/14 职场文书
学生党员检讨书范文
2014/12/27 职场文书
活动宣传稿范文
2015/07/23 职场文书
小区物业管理2015年度工作总结
2015/10/22 职场文书
创新创业项目计划书该怎样写?
2019/08/13 职场文书
两行代码解决Jupyter Notebook中文不能显示的问题
2021/04/24 Python
POST提交数据常见的四种方式
2022/01/18 HTML / CSS
Elasticsearch 配置详解
2022/04/19 Java/Android