i have a website that allow people to unsubscribe to other websites (to mailing list, or spam etc...)
my web app allow clients and users to upload encrypted email list for mass unsubscribtion.
i have a table: unsubs. that table have email and domain.
the file structure is like this:
jhq232q3hq2yq3yuh2qyuqU/A$Ja324ju3a4jah34u3w$UQ"$Uq4u q34/hRYHSEa34uw34uQ"/YQ/$84?%JHHdfhdFJKAjaRJSErjsrjse W%$?p09-*Y+_)y8p7uYJgADGq2/TYQgSj1qR"3tQ"/gEHseruDUId
here's my PHP:
function decrypt($line) {
// do my logic etc...
return $line;
}
function isEmail($email) {
if(preg_match("/^([a-zA-Z0-9_-])*@([a-zA-Z0-9_-])+([a-zA-Z0-9_-]+)+$/", $email)){
return true;
}
return false;
}
function checkEmail($email) {
// logic
return array('baddomain.com');
}
function emailExists($email) {
// my logic
return TRUE; // for example
}
$file = file_get_contents('sample.txt');
$lines= explode("\n", $file);
foreach($lines as $line) {
if(!empty($line)) {
$line = decrypt($line);
if(isEmail($line)) {
$services = checkEmail($line);
if(is_array($service)) {
foreach($services as $service) {
insertEmail($db, $service, $line); // this is used
}
}
}
}
}
the check email function check if the email is unsub in all the lists, returns false if everything is unsubscripbed and an array (list of services = domain) if none.
now my problem is everytime i want to check if an email is valid it returns false. my encryption is working fine and it'S bullet proof.
what am i missing?