社區(php&&mysql)五

來源:互聯網
上載者:User
關鍵字 社區(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 "
     
     ";
    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 "
     
     "; 
     
}
//======================================================================
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 "";
        echo "";
          echo "";
          echo " $banner";
          echo "";
          
        echo "";
        echo "";
          echo $poster;
        echo "";
        echo "";
          echo " ";
        echo "";
        echo "";
          echo $views;
        echo "";
        echo "";
          echo $wdate;
        echo "";
      
      echo "";
  }
  
}
//======================================================================
function search() {
  global $PHP_SELF;
  global $key,$aid;
  if(!strlen($key)) {
  echo "
     
     ";
  }
  echo "

";   echo "";   echo "
"; 
  
  
  $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 "
";    echo "
";
   echo "

























";     echo " ";       echo " ";       echo " ";       echo " ";       echo " ";       echo " ";     echo " ";     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 " ";         echo " ";         echo " ";         echo " ";         echo " ";         echo " ";       echo " ";            }     search_docs($aid,$skey);    echo "
夾肈祇癬ら戳
";
          echo "";
            echo $banner;
          echo "";
        echo "
";
          echo $poster;
        echo "
";
          echo $docs;
        echo "
";
          echo $views;
        echo "
";
          echo $wdate;
        echo "
";
  echo"
";   
  
  
  
  
}
//======================================================================

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");  
?>

以上前五篇為一個頁面
  • 相關文章

    聯繫我們

    該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

    如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.