Mailing List.
|
Error |
go back and fill out your email address.'; } else { $email = $_POST['email']; if(!filter_var($email, FILTER_VALIDATE_EMAIL)) { $error = 'Sorry, your email address is invalid. Please go back and enter a valid email address.'; } else { // gets the aes key. $aesKeyFilePath = BASEDIR . '../mailinglist/aes-key.txt'; $fh = fopen($aesKeyFilePath, 'r'); $aesKey = fread($fh, filesize($aesKeyFilePath)); fclose($fh); // set the aes block size. $aesBlockSize = 256; // encrypt the email address, cause Jamie is paranoid about privacy. $aes = new AES($email, $aesKey, $aesBlockSize); $encryptedEmail = $aes->encrypt(); // where the mailing list text file is located. $listFilePath = BASEDIR . '../mailinglist/list.txt'; // save. file_put_contents($listFilePath, $encryptedEmail . "\n", FILE_APPEND); } } ?>