示例#1
0
//Let's setup our token
$token = new Tokens();
//Set the account ID to be included as salt
$token->setIdentifier($row[$columns['id']]);
//Set the application string so the token is only valid for this app
$token->setApplication('PRECOVER');
//Set the token expiration time
$token->setExpiration($emailTokenLifetime);
//Save the user ID under the token
$token->setExternalData($row);
//Generate a key for the token
$token->generateKey();
//get the encoded key
$key = $token->get_encodedToken();
//register the token
$tokenReg = $token->registerToken();
//continue only if the key was successfully registered
if ($tokenReg === true) {
    //update the account event
    $update = $DB->prepare("UPDATE `account_data` SET `event` = UPPER(:event) WHERE `id` = :id LIMIT 1;");
    $update->bindParam(':id', $row[$columns['id']], PDO::PARAM_INT);
    $update->bindParam(':event', $event, PDO::PARAM_STR);
    $update->execute();
    unset($update);
    ############################################################################
    ## Not it's time to send the revocery mail
    $CORE->load_CoreModule('phpmailer');
    //setup the PHPMailer class
    $mail = new PHPMailer();
    $mail->IsMail();
    $mail->From = $config['Email'];