ÉçÇø(php&&mysql)Ò»

5年以前  |  阅读数:376 次  |  编程语言: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;//¨u®ø   

$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 { //¨u®ø­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³ae   
      $qsql="DELETE FROM  bbs_sml where sid='$sid' AND email='$email'";   
      $rs=mysql_db_query($sql['db'],$qsql);   
    } else {   
      echo "   
      <script language=javascript>   
        alert('(C)|¥¼¦b¦W³ae¤º!');   
      </script>   
     ";   

    }   

}   

} else {   
    echo "   
      <script language=javascript>   
          alert('E-mail®ae¦¡¿u»~');   
      </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¾\ªº¤a³¹";   
$message="§@ªÌ:$poster\n";   
$message.="¤a³¹¼ÐÃD:$banner\n";   
$message.="¤a³¹¤º®e:$body\n";   
$message.="\n¨a¥L¬ÛÃo¤a³¹½Ð¦Ü http://$HTTP_HOST$PHP_SELF?proc=view&aid;=$aid&sid;=$sid&rid;=$rid\n";   
$message.="<<Åwªi§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 ª(C)*s¶iªº¤a³¹",$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ªº¤a³¹";   
$message="§Aªº¦nªB¤Í: $c_poster ¤¶²Ð§A¬Ý³o«Ê¤a³¹\n";   
$message.="¤a³¹¼ÐÃD:$banner\n";   
$message.="¤a³¹¤º®e:$body\n";   
$message.="\n¨a¥L¬ÛÃo¤a³¹½Ð¦Ü http://$HTTP_HOST$PHP_SELF?proc=view&sid;=$sid&aid;=$aid&rid;=$rid\n";   
$message.="<<Åwªi§Aªº¥[¤J>>\n";   
$mailfrom="From:".$c_email;   

mail($frmail,$subj,$message,$mailfrom);   
}else {   
    echo "   
      <script language=javascript>   
          alert('E-mail®ae¦¡¿u»~');   
      </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分页显示制作详细讲解
SSH 登录失败:Host key verification failed
获取IMSI
将二进制数据转为16进制以便显示
获取IMEI
文件下载
贪吃蛇
双位运算符
PHP自定义函数获取搜索引擎来源关键字的方法
Java生成UUID
发送邮件
年的日历图
提取后缀名
在Zeus Web Server中安装PHP语言支持
让你成为最历害的git提交人
Yii2汉字转拼音类的实例代码
再谈PHP中单双引号的区别详解
指定应用ID以获取对应的应用名称
Python 2与Python 3版本和编码的对比
php封装的page分页类完整实例