Deleting unconfirmed membersDeleting the members still unconfirmed after 10 days was done by looping through the records, and making up a SQL statement that included all of the member ID's.That way I only had one SQL statement to execute, outside of the loop. var sDelete = '';
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 )
{
...
}
else
{
if ( sDelete.length )
sDelete += ' OR ';
sDelete += 'MemberID=' + nID;
}
oRecordSet.moveNext ( );
}
if ( sDelete.length )
oConnection.Execute ( 'DELETE FROM Members WHERE ' + sDelete );
|
And that's it. The first new visitor to arrive on my site after midnight (server time) will cause the RemindMembers( ) function to be called, and unconfirmed members dealt with as appropriate. And one less job for me to do manually, which I personally think is very cool! There's too much code to list, but you can download everything by clicking on the icon.
|