The RemindMembers functionfunction RemindMembers ( )
{
// todays date
var dCutoff = new Date;
var nDate = dCutoff.getDate ( ) - 9;
dCutoff.setDate ( nDate + 1 );
DBInitConnection ( );
DBGetRecords ( 'SELECT MemberID,Email,Name,LastVisit FROM Members WHERE Confirmed=False AND LastVisit<=' + DBWrapDate ( FormatDateDMY ( dCutoff ) ) );
|
I started by getting today's date and setting dCutoff and dEmail to 10 and 11 days earlier respectively. I then opened the database and queried it for all records in the Members table that had been unconfirmed for that long. The simple loop below then went through each record in turn, and either emailed the user that he had one day left to confirm his membership, or deleted the record. I'll show you the details of those two processes in the next few pages. while ( !oRecordSet.EOF )
{
var nID = oRecordSet ( 0 ) - 0;
var dDate = new Date ( oRecordSet ( 3 ) );
// either send an email, or delete them..
if ( dDate.getDate ( ) == nDate )
{
// send email
}
else
{
// delete them
}
oRecordSet.moveNext ( );
}
|
Part 4: Emailing a reminder... |