Community (Php&&mysql) a _php tutorial

Source: Internet
Author: User
Tags failover setcookie
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 $way 1, $way 2;

if (Check_mail ($email)) {
$mailtype = 0; Subscriptions
if (strlen ($way 2)) $mailtype =1;//

$DROOT =getenv (' document_root ');
Include ("sql.php3");
$db =mysql_connect ($sql [' Host '], $sql [' User '], $sql [' passwd '];
if ($mailtype ==0) {//Subscriptions
$qsql = "SELECT * from BBS_SML where sid= ' $sid ' and email= ' $email '";
$rs =mysql_db_query ($sql [' db '], $qsql);
if (mysql_num_rows ($rs) ==0) {//Pro ⊿
$qsql = "INSERT into BBS_SML (sid,email) VALUES (' $sid ', ' $email ')";
$rs =mysql_db_query ($sql [' db '], $qsql);
} else {
echo "

";
}
} else {//subscriptions
$qsql = "SELECT * from BBS_SML where sid= ' $sid ' and email= ' $email '";
$rs =mysql_db_query ($sql [' db '], $qsql);
if (mysql_num_rows ($rs) > 0) {//Worm
$qsql = "DELETE from BBS_SML where sid= ' $sid ' and email= ' $email '";
$rs =mysql_db_query ($sql [' db '], $qsql);
} else {
echo "

";

}

}

} else {
echo "

";
}
echo "

";
}

//===============================================================
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. " Beyond subscriptions ゅ Beecher ";
$message = ": $poster \ n";
$message. = "ゅ 肈: $banner \ n";
$message. = "ゅ identify failover: $body \ n";
$message. = "\nㄤ min ゅ called 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;
}
House Hate Agent
$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 links tranches ゅ Beecher", $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. " ざや remnant ゅ Beecher ";
$message = "Next ne: $c _posterざ remnant this test ゅ beecher \ n";
$message. = "ゅ 肈: $banner \ n";
$message. = "ゅ identify failover: $body \ n";
$message. = "\nㄤ min ゅ called 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 "

";
}
//echo "rid= $rid a= $aid s= $sid p= $pgno";

Echo "

";
}

to be continued ...

http://www.bkjia.com/phpjc/315626.html www.bkjia.com true http://www.bkjia.com/phpjc/315626.html techarticle function Cook_cooloff () {Global $PHP _self, $aid, $pgno; Setcookie (OPEN _list,0,time () + 31536000); Header (location: $PHP _self?aid= $aidquot;); exit;}//================================== ...

  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    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.