当前位置:  编程技术>php
本页文章导读:
    ▪社区(php&&mysql)五       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 "   .........
    ▪社区(php&&mysql)四       echo "<br>";     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 .........
    ▪社区(php&&mysql)三       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.........

[1]社区(php&&mysql)五
    来源: 互联网  发布时间: 2013-11-30
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=/blog_article/$PHP_SELF/proc/view/amp;aid/$aid/amp;sid/$sid/amp;rid/$id/gt;.html";
                    echo "  <font color=#836FFF>$banner</font>";
                    echo "</a>";

                echo "</td>";
                echo "<td>";
                    echo $poster;
                echo "</td>";
                echo "<td >";
                    echo " ";
                echo "</td>";
                echo "<td >";
                    echo $views;
                echo "</td>";
                echo "<td >";
                    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 >";
    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 >";
              echo "<INPUT TYPE='Submit'value='琩高' >";

      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 >";
        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=/blog_article/$PHP_SELF/proc/view/amp;aid/$paid/amp;sid/$id/amp;rid/$id/gt;.html";
                        echo $banner;
                    echo "</a>";
                echo "</td>";
                echo "<td>";
                    echo $poster;
                echo "</td>";
                echo "<td >";
                    echo $docs;
                echo "</td>";
                echo "<td >";
                    echo $views;
                echo "</td>";
                echo "<td >";
                    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");     
?>

以上前五篇为一个页面 

    
[2]社区(php&&mysql)四
    来源: 互联网  发布时间: 2013-11-30
echo "<br>";
    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 >";
        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>";
        $qsql="SELECT * from bbs_subj where id='$sid' ";
        $rs=mysql_db_query($sql['db'],$qsql);
        $row=mysql_fetch_array($rs);
            $id=$row['id'];
            $banner=$row['banner'];
            $poster=$row['poster'];
            $views=$row['views'];
            $wdate=sdatetime($row['wdate']);
            $docs=reAnum($id);
            echo "<tr bgcolor='#F0F8FF'>";
                echo "<td>";
                    if($sid!=$rid) {
                    echo "<a href=/blog_article/$PHP_SELF/proc/view/amp;aid/$aid/amp;sid/$id/amp;rid/$id/gt;.html";
                    echo $banner;
                    echo "</a>";
                    } else echo "<font color=red><b>$banner</B></font>";
                echo "</td>";
                echo "<td>";
                    echo $poster;
                echo "</td>";
                echo "<td >";
                    echo $docs;
                echo "</td>";
                echo "<td >";
                    echo $views;
                echo "</td>";
                echo "<td >";
                    echo $wdate;
                echo "</td>";
            echo "</tr>";
        $qsql="SELECT * from bbs_docs where sid='$sid' order by wdate";
        $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']);
            $docs=reAnum($id);
            echo "<tr bgcolor='#F0F0F0'>";
                echo "<td>";
                    if($sid!=$rid && $rid==$id) {
                        echo "<font color=red><b>  $banner</B></font>";
                    } else {
                        echo "<a href=/blog_article/$PHP_SELF/proc/view/amp;aid/$aid/amp;sid/$sid/amp;rid/$id/gt;.html";
                        echo "  $banner";
                        echo "</a>";
                    }
                echo "</td>";
                echo "<td>";
                    echo $poster;
                echo "</td>";
                echo "<td >";
                    echo " ";
                echo "</td>";
                echo "<td >";
                    echo $views;
                echo "</td>";
                echo "<td >";
                    echo $wdate;
                echo "</td>";
            echo "</tr>";

        }
      echo "</td></tr></table>";
    echo"</td></tr></table>";
  } // ====

    echo "<a name='re'></a>";
    if($type==1) {
        if(substr($rebanner,0,3)!="Re:")
            $rbanner="Re:".$rebanner;
        else $rbanner=$rebanner;
    }     
    echo "<FORM  name=mtab ENCTYPE=multipart/form-data METHOD=POST ACTION=$PHP_SELF?proc=post2>";
    echo "<input type='hidden' name=aid value='$aid'>";
    echo "<input type='hidden' name=sid value='$sid'>";
    echo "<input type='hidden' name=type value='$type'>";
    echo "<TABLE width=95% BORDER=0  align=center cellPadding=3 cellSpacing=0 >";
        if($sid) {
            echo "<TR bgcolor='white'>";
            echo "<TH colspan=2 >";
                echo "癚阶硂杠肈";
            echo "</TH>";

            echo "</TR>";
        }

        echo "<TR>";
            echo "<TD width=100 align=right>";
                echo "肈:";
            echo "</TD>";
            echo "<TD>";
                echo "<INPUT TYPE='text' NAME='banner' size=60 value='$rbanner'>";
            echo "</TD>";
        echo "</TR>";
        echo "<TR>";
            echo "<TD width=100 align=right>";
                echo "祇ē:";
            echo "</TD>";
            echo "<TD>";
                echo "<INPUT TYPE='text' NAME='poster' size=30 value='$c_poster'>";

            echo "</TD>";
        echo "</TR>";
        echo "<TR>";
            echo "<TD width=100 align=right>";
                echo "E-Mail:";

            echo "</TD>";
            echo "<TD>";
                echo "<INPUT TYPE='text' NAME='email' size=30 value='$c_email'>";

            echo "</TD>";
        echo "</TR>";
        echo "<TR>";
            echo "<TD width=100 align=right valign=top>";
                echo "ず甧:";
            echo "</TD>";
            echo "<TD>";
                echo "<font color=green>や穿禬硈挡ノ猭絛ㄒ:<font color=red><b>[www]http://www.jerry.com.tw[/www]</b></font></font><br>";
                echo "<TEXTAREA NAME='body' cols='80' rows='16'>";
                echo "</TEXTAREA>";
            echo "</TD>";
        echo "</TR>";
        echo "<TR>";
            echo "<TD align=center colspan=2>";
                //echo "<INPUT TYPE='checkbox' NAME='remail'>";
                //echo "滦";
                if($sid) {
                    $br="-----------------------------------------------------------";
                    $obody="まノ $poster ゅ彻n$brn".$body;
                    $obody.="n$brn滦癚阶ず甧:n";
                    echo "<input type='hidden' name=obody value="$obody">";
                    echo "<INPUT TYPE='button' value='まノゅ' onClick="this.form.body.value=this.form.body.value + this.form.obody.value; this.form.obody.value='';">";
                }

                echo "    <INPUT TYPE='submit' value='癳'>";
            echo "</TD>";
        echo "</TR>";
    echo "</TABLE>";

}
待续....... 

    
[3]社区(php&&mysql)三
    来源: 互联网  发布时间: 2013-11-30
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 >";
    echo "<tr><td align=center>";
        $nextid=next_subj($sid);
        $previd=prev_subj($sid);
        echo "<a href=/blog_article/$PHP_SELF/aid/$aid/amp;sid/$sid/gt;[夹肈跋]/lt;/a/gt;.html";
        echo "<a href=#re>[莱セ絞]</a>";
        echo "<a href=/blog_article/$PHP_SELF/proc/view/amp;aid/$aid/gt;[祇穝ゅ彻]/lt;/a/gt;.html";
        echo "<a href=/blog_article/$PHP_SELF/proc/view/amp;aid/$aid/amp;sid/$nextid/amp;rid/$nextid/gt;[絞]/lt;/a/gt;.html";
        echo "<a href=/blog_article/$PHP_SELF/proc/view/amp;aid/$aid/amp;sid/$previd/amp;rid/$previd/gt;[絞]/lt;/a/gt;.html";
        //echo "<a href=/blog_article/$PHP_SELF/proc/view/amp;pgno/$pgno/amp;aid/$aid/amp;sid/$previd/amp;rid/$previd/gt;[程絞]/lt;/a/gt;.html";

    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/index.html"  target="_blank">\1</a>', $pbody );  
    $pbody =preg_replace( "/[www +([a-zA-Z0-9.:/_-]+)]([\x0-\xff]*?)[/www *]/", '<a href="/1/index.html"  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 >";
            echo "<TR><TD >";
                viewbar();
            echo "</td></tr>";
            echo "<TR><TD>";
            //====ゅ彻==============
            echo "<TABLE BORDER=0 width=100%  align=center cellPadding=1 cellSpacing=0 >";
            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' 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 >";     
                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 >";     
            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函数microtime()时间戳的定义与用法
▪php实现文件下载、支持中文文件名的示例代码... iis7站长之家
▪PHP数组排序方法总结(收藏)
▪php数组排序方法大全(脚本学堂整理奉献)
▪php数组排序的几个函数(附实例)
▪php二维数组排序(实例)
▪php根据键值对二维数组排序的小例子
▪php验证码(附截图)
▪php数组长度的获取方法(三个实例)
▪php获取数组长度的方法举例
▪判断php数组维度(php数组长度)的方法
▪php获取图片的exif信息的示例代码
▪PHP 数组key长度对性能的影响实例分析
▪php函数指定默认值的方法示例
▪php提交表单到当前页面、提交表单后页面重定...
▪php四舍五入的三种实现方法
▪php获得数组长度(元素个数)的方法
▪php日期函数的简单示例代码
▪php数学函数的简单示例代码
▪php字符串函数的简单示例代码
▪php文件下载代码(多浏览器兼容、支持中文文...
▪php实现文件下载、支持中文文件名的示例代码...
▪php文件下载(防止中文文件名乱码)的示例代码
▪解决PHP文件下载时中文文件名乱码的问题
▪php数组去重(一维、二维数组去重)的简单示例
▪php小数点后取两位的三种实现方法
▪php Redis 队列服务的简单示例
▪PHP导出excel时数字变为科学计数的解决方法
▪PHP数组根据值获取Key的简单示例
▪php数组去重的函数代码示例
 


站内导航:


特别声明:169IT网站部分信息来自互联网,如果侵犯您的权利,请及时告知,本站将立即删除!

©2012-2021,,E-mail:www_#163.com(请将#改为@)

浙ICP备11055608号-3