Community (php & amp; mysql) 1

Source: Internet
Author: User

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 = '$ view' 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; // invalid variable
If (strlen ($ way2) $ mailtype = 1 ;//

$ DROOT = getenv ('document _ root ');
Include ("SQL. php3 ");
$ Db = mysql_connect ($ SQL ['host'], $ SQL ['user'], $ SQL ['passwd']);
If ($ mailtype = 0) {// INVALID RESPONSE
$ Qsql = "SELECT * from bbs_sml where sid = '$ sid' AND email = '$ email '";
$ Rs = mysql_db_query ($ SQL ['db'], $ qsql );
If (mysql_num_rows ($ rs) = 0) {// near
$ Qsql = "insert into bbs_sml (sid, email) values ('$ sid', '$ email ')";
$ Rs = mysql_db_query ($ SQL ['db'], $ qsql );
} Else {
Echo"
<Script language = javascript>
Alert ('hour, ぃ ');
</Script>
";
}
} Else {// zookeeper
$ 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"
<Script language = javascript>
Alert ('commandid! ');
</Script>
";

}

}

} Else {
Echo"
<Script language = javascript>
Alert ('e-mail too many regions ');
</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. "zookeeper cannot be uploaded ";
$ Message = ": $ poster \ n ";
$ Message. = "zookeeper folder failed: $ banner \ n ";
$ Message. = "returns success: $ body \ n ";
$ Message. = "\ n zookeeper is called http: // $ HTTP_HOST $ PHP_SELF? Proc = view & aid = $ aid & sid = $ sid & rid = $ rid \ n ";
$ Message. = "<strong >>\ 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;
}
// Hate it
$ 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 cannot be reached", $ 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. "Success success ";
$ Message = "Success success: $ c_poster success \ n ";
$ Message. = "zookeeper folder failed: $ banner \ n ";
$ Message. = "returns success: $ body \ n ";
$ Message. = "\ n zookeeper is called http: // $ HTTP_HOST $ PHP_SELF? Proc = view & sid = $ sid & aid = $ aid & rid = $ rid \ n ";
$ Message. = "<strong >>\ n ";
$ Mailfrom = "From:". $ c_email;

Mail ($ frmail, $ subj, $ message, $ mailfrom );
} Else {
Echo"
<Script language = javascript>
Alert ('e-mail too many regions ');
</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>
";
}

To be continued ......

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.