欢迎来到代码驿站!

PHP代码

当前位置:首页 > 软件编程 > PHP代码

社区(php&&mysql)一

时间:2022-01-21 09:43:50|栏目:PHP代码|点击:
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; //?q?\
    if(strlen($way2)) $mailtype=1;//???

    $DROOT=getenv('DOCUMENT_ROOT');
    include("sql.php3");
    $db=mysql_connect($sql['host'], $sql['user'] , $sql['passwd']);  
    if($mailtype==0) { //?q?\
        $qsql="SELECT * from bbs_sml where sid='$sid' AND email='$email'";
        $rs=mysql_db_query($sql['db'],$qsql);
        if(mysql_num_rows($rs)==0) { //临?S?[?J
          $qsql="INSERT INTO  bbs_sml (sid,email) values('$sid','$email')";
          $rs=mysql_db_query($sql['db'],$qsql);
        } else {
          echo "
          <script language=javascript>
          alert('?A?w?g?[?J,ぃ惠??狡?[?J');
          </script>
         ";     
        }
    } else { //????q?\
        $qsql="SELECT * from bbs_sml where sid='$sid' AND email='$email'";
        $rs=mysql_db_query($sql['db'],$qsql);
        if(mysql_num_rows($rs) > 0) { //?w?b?W虫
          $qsql="DELETE FROM  bbs_sml where sid='$sid' AND email='$email'";
          $rs=mysql_db_query($sql['db'],$qsql);
        } else {
          echo "
          <script language=javascript>
            alert('?|ゼ?b?W虫ず!');
          </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."ㄓ?郗q?\?氦宄?";
    $message="?@??:$poster\n";
    $message.="ゅ彻夹?D:$banner\n";
    $message.="ゅ彻ず?e:$body\n";
    $message.="\nㄤ?L?勖訾宄菇笑? http://$HTTP_HOST$PHP_SELF?proc=view&aid=$aid&sid=$sid&rid=$rid\n";
    $message.="<<?w?铵A?亥[?J>>\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;
    }
    //?H倒恨?z??
    $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 ?┓s?i?氦宄?",$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."ざ残?A?n?氦宄?";
    $message="?A?害n?Bね: $c_poster ざ残?A?莩o?胜宄?\n";
    $message.="ゅ彻夹?D:$banner\n";
    $message.="ゅ彻ず?e:$body\n";
    $message.="\nㄤ?L?勖訾宄菇笑? http://$HTTP_HOST$PHP_SELF?proc=view&sid=$sid&aid=$aid&rid=$rid\n";
    $message.="<<?w?铵A?亥[?J>>\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>
         ";  
}

待续...... 

上一篇:Discuz!插件:自动隐藏帖子第1/2页

栏    目:PHP代码

下一篇:PHP实现的DES加密解密封装类完整实例

本文标题:社区(php&&mysql)一

本文地址:http://www.codeinn.net/misctech/190860.html

推荐教程

广告投放 | 联系我们 | 版权申明

重要申明:本站所有的文章、图片、评论等,均由网友发表或上传并维护或收集自网络,属个人行为,与本站立场无关。

如果侵犯了您的权利,请与我们联系,我们将在24小时内进行处理、任何非本站因素导致的法律后果,本站均不负任何责任。

联系QQ:914707363 | 邮箱:codeinn#126.com(#换成@)

Copyright © 2020 代码驿站 版权所有