社区(php&&mysql)一

function cook_cooloff(){
    global $php_SELF,$aid,$pgno;
    setcookie("OPEN_LIST",0,time()+ 31536000);
    Header("Location:$php_SELF?aid=$aid&pgno=$pgno");
    exit;
}
//===============================================================
function cook_coolon(){
    global $php_SELF,$aid,$pgno;
    setcookie("OPEN_LIST",1,time()+ 31536000);
    Header("Location:$php_SELF?aid=$aid&pgno=$pgno");
    exit;
}
function check_mail($semail)
{
    $str=strchr($semail,'@');   
    if ($str=="") return false;
    $str=strchr($semail,".");
    if ($str=="") return false;
    return true;
}
//================================================================
function addhitviews($sid,$rid) {
    $DROOT=getenv('DOCUMENT_ROOT');
    include("sql.php3");
    $db=mysql_connect($sql['host'], $sql['user'] , $sql['passwd']);  
    if($sid==$rid)     $qsql="SELECT * from bbs_subj where id='$rid'";
    else $qsql="SELECT * from bbs_docs where id='$rid'";
    $rs=mysql_db_query($sql['db'],$qsql);
    $row=mysql_fetch_array($rs);
    $views=$row['views'];
    $views++;
    if($sid==$rid)     $qsql="UPDATE bbs_subj SET views='$views' where id='$rid'";
    else $qsql="UPDATE bbs_docs SET views='$views' where id='$rid'";

    mysql_db_query($sql['db'],$qsql);
}

//===============================================================
function mail_list(){
    global $php_SELF,$HTTP_HOST,$email;
    global $aid,$sid,$rid;
    global $way1,$way2;

    if(check_mail($email)) {
    $mailtype=0; //
    if(strlen($way2)) $mailtype=1;//

    $DROOT=getenv('DOCUMENT_ROOT');
    include("sql.php3");
    $db=mysql_connect($sql['host'], $sql['user'] , $sql['passwd']);  
    if($mailtype==0) { //
        $qsql="SELECT * from bbs_sml where sid='$sid' AND email='$email'";
        $rs=mysql_db_query($sql['db'],$qsql);
        if(mysql_num_rows($rs)==0) { //临
          $qsql="INSERT INTO  bbs_sml (sid,email) values('$sid','$email')";
          $rs=mysql_db_query($sql['db'],$qsql);
        } else {
          echo "
          <script language=Javascript>
          alert(',ぃ惠狡');
          </script>
         ";     
        }
    } else { //
        $qsql="SELECT * from bbs_sml where sid='$sid' AND email='$email'";
        $rs=mysql_db_query($sql['db'],$qsql);
        if(mysql_num_rows($rs) > 0) { //虫
          $qsql="DELETE FROM  bbs_sml where sid='$sid' AND email='$email'";
          $rs=mysql_db_query($sql['db'],$qsql);
        } else {
          echo "
          <script language=Javascript>
            alert('ゼ虫ず!');
          </script>
         ";

        }

    }

    } else {
        echo "
          <script language=Javascript>
              alert('E-mailΑ岿');
          </script>
         ";  
    }
    echo "
          <script language=Javascript>
          document.location='$php_SELF?proc=view&aid=$aid&sid=$sid&rid=$rid'
          </script>
         ";  
}

//===============================================================
function Send_the_doc_to_mail_list($aid,$sid,$rid){
    global $php_SELF,$HTTP_HOST;
    $DROOT=getenv('DOCUMENT_ROOT');
    include("sql.php3");
    $db=mysql_connect($sql['host'], $sql['user'] , $sql['passwd']);  
    if($sid==$rid)     $qsql="SELECT * from bbs_subj where id='$sid'";
    else $qsql="SELECT * from bbs_docs where id='$rid'";

    $rs=mysql_db_query($sql['db'],$qsql);
    $row=mysql_fetch_array($rs);
    $poster=$row['poster'];
    $banner=$row['banner'];
    $body=$row['body'];

    $subj=$c_poster."ㄓゅ彻";
    $message=":$poster/n";
    $message.="ゅ彻夹:$banner/n";
    $message.="ゅ彻ず:$body/n";
    $message.="/nㄤ闽ゅ彻叫 http://$HTTP_HOST$php_SELF?proc=view&aid=$aid&sid=$sid&rid=$rid/n";
    $message.="<<>>/n";
    $mailfrom="From:Magic Jerry";


    $qsql="SELECT * from bbs_sml where sid='$sid'";
    $rs=mysql_db_query($sql['db'],$qsql);
    while($row=mysql_fetch_array($rs)) { //mail_list
        $email=$row['email'];
        mail($email,$subj,$message,$mailfrom);
        echo $email;
    }
    //倒恨
    $qsql="SELECT * from bbs_area where id='$aid'";
    $rs=mysql_db_query($sql['db'],$qsql);
    $row=mysql_fetch_array($rs);
    $email=$row['email'];
    $banner=$row['banner'];

    mail($email,"$banner ゅ彻",$message,$mailfrom);


}
//===============================================================
function mail_friend(){
    global $php_SELF,$HTTP_HOST,$c_email,$c_poster,$frmail;
    global $aid,$sid,$rid;
    if(check_mail($frmail)) {
    $DROOT=getenv('DOCUMENT_ROOT');
    include("sql.php3");
    $db=mysql_connect($sql['host'], $sql['user'] , $sql['passwd']);
    if($sid==$rid) {  
        $qsql="SELECT * from bbs_subj where id='$rid' ";
    } else {
        $qsql="SELECT * from bbs_docs where id='$rid' ";
    }
    $rs=mysql_db_query($sql['db'],$qsql);
    $row=mysql_fetch_array($rs);

    $banner=$row['banner'];
    $body=$row['body'];

    $subj=$c_poster."ざ残ゅ彻";
    $message="ね: $c_poster ざ残ゅ彻/n";
    $message.="ゅ彻夹:$banner/n";
    $message.="ゅ彻ず:$body/n";
    $message.="/nㄤ闽ゅ彻叫 http://$HTTP_HOST$php_SELF?proc=view&sid=$sid&aid=$aid&rid=$rid/n";
    $message.="<<>>/n";
    $mailfrom="From:".$c_email;

    mail($frmail,$subj,$message,$mailfrom);
    }else {
        echo "
          <script language=Javascript>
              alert('E-mailΑ岿');
          </script>
         ";  
    }
    //echo "rid=$rid a=$aid s=$sid p=$pgno";

    echo "
          <script language=Javascript>
          document.location='$php_SELF?proc=view&aid=$aid&sid=$sid&rid=$rid'
          </script>
         ";  
}

待续...... 

php技术社区(php&amp;amp;&amp;amp;mysql)一,转载需保留来源!

郑重声明:本文版权归原作者所有,转载文章仅为传播更多信息之目的,如作者信息标记有误,请第一时间联系我们修改或删除,多谢。