|
|
|
@@ -0,0 +1,52 @@ |
|
|
|
<?php |
|
|
|
|
|
|
|
$customerCsvPath = __DIR__ . '/customer.csv'; |
|
|
|
$filterCsvPath = __DIR__ . '/filter.csv'; |
|
|
|
$handle = fopen($customerCsvPath, 'r'); |
|
|
|
|
|
|
|
$i = 1; |
|
|
|
$customers = []; |
|
|
|
while ($data = fgetcsv ($handle, 1000, ";") ) { |
|
|
|
if ($i !== 1) { |
|
|
|
$row = array_map("utf8_encode", $data); |
|
|
|
$customers[$row[0]] = array_map("utf8_encode", $data); |
|
|
|
} |
|
|
|
$i++; |
|
|
|
} |
|
|
|
|
|
|
|
$handle = fopen($filterCsvPath, 'r'); |
|
|
|
|
|
|
|
$i = 1; |
|
|
|
$filterData = []; |
|
|
|
while ($data = fgetcsv ($handle, 1000, ";") ) { |
|
|
|
if ($i !== 1) { |
|
|
|
$row = array_map("utf8_encode", $data); |
|
|
|
if ($row[18] !== "") { |
|
|
|
$filterData[$row[18]] = array_map("utf8_encode", $data); |
|
|
|
} |
|
|
|
} |
|
|
|
$i++; |
|
|
|
} |
|
|
|
|
|
|
|
$countCustomers = count($customers); |
|
|
|
$countFilters = count($filterData); |
|
|
|
|
|
|
|
foreach ($filterData as $key => $value) { |
|
|
|
if (array_key_exists($key, $customers)) { |
|
|
|
unset($customers[$key]); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
$countFilteredCustomers = count($customers); |
|
|
|
if (file_exists(__DIR__ . '/export.csv')) { |
|
|
|
unlink(__DIR__ . '/export.csv'); |
|
|
|
} |
|
|
|
|
|
|
|
$fp = fopen('export.csv', 'w'); |
|
|
|
fputcsv($fp, ['EMAIL'], ';'); |
|
|
|
foreach ($customers as $email => $val) { |
|
|
|
fputcsv($fp, [$email], ';'); |
|
|
|
} |
|
|
|
|
|
|
|
fclose($fp); |
|
|
|
|