getRow('SELECT `id_customer` FROM `'._DB_PREFIX_.'customer` WHERE `email` = "'.pSQL($email).'" '); if (!$customer) { continue; } // Opt-In if(strtolower($optin) == 'faux') { $active = 0; } else { $active = (int) $newsletter; } if ($optTest) { echo "Customer ID: ".$customer['id_customer']." - Active: ".$active."\n"; } // Update customer else { $db->ExecuteS('UPDATE `'._DB_PREFIX_.'customer` SET `newsletter` = '.(int) $active.', `newsletter_date_add` = NOW() WHERE `id_customer` = '.$customer['id_customer'].' LIMIT 1 '); } } fclose($handle); if ($optTest) { continue; } // Move file as done rename($filename, str_replace('/emarsys/', '/emarsys_done/', $filename)); } else { if ($optVerbose) { echo "File $filename can't be open.\n"; } } }