Click to view full text
Idea: First set the time in the background, after the setup, the next step is the foreground program
The first step: Execute the JS code that sets the fixed cookie time value in Ajax :
/********** here set the time to start * * * Execute once per minute *********/
$.ajax ({
URL: "Ajax.php?action=time_ajax"
});
/********** here to set the end of the participation time **********/
Step two: Set the cookie value in Ajax
Case ' Time_ajax '://define a fixed timestamp for each minute of execution, which defines a fixed cookie that is not affected by other page refreshes, and depends on your situation
Setcookie ("Fasong_time", Time ());//Record a cookie timestamp
Exit ();
Break
Step Three: Execute the JS code that automatically sends the message :
This step is the JS program that executes when the page is loaded and sends a request to Ajax
Fourth step: Perform auto-send mail
Case ' Fasong_zidong '://Auto-Send mail
/*********** Send mail module start *********/
$now _time = time ();//First to get the current timestamp
$one _data = "The header of the sent message set in the" Select ' Database ', ' the content of the sent message set in the database ', ' The field of the hour set in the database (this is a numeric field) ', ' The field of minutes set in the database (this is a numeric field) ', ' The "from" table name that is set in the database to turn on the automatic sending function;//Query
$one _datas = Query function executes $one_data statement; Write your own query statement here
if ($one _datas[' Is_open ') {//Decide whether to turn on the Send mail feature
if (intval ($now _time-@$_cookie[' fasong_time ') ==intval (the field of the hour set in the $one _data[' database (this is a field of numeric type) ']+ $one _data[' The field of minutes set in the database (this is a numeric field)
Require_once ("fasong.php");//make comparisons between the current timestamp and the length of the background setting
Echo 1;
}
}
/*********** Send mail module end *********/
Exit ();
Break