From eef27cac217ad5febf18e472002e864cad78cc2e Mon Sep 17 00:00:00 2001 From: root Date: Thu, 20 Oct 2016 01:38:35 +0200 Subject: [PATCH] Prende un file, crea un roll e inserisce le mail dei mambri nel database --- loader.php | 60 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 loader.php diff --git a/loader.php b/loader.php new file mode 100644 index 0000000..eeb9c9c --- /dev/null +++ b/loader.php @@ -0,0 +1,60 @@ +format('Y-m-d'); +} + + + +$db = new NotORM($pdo); + +$db->debug = true; + +$today = getMyDateFormatted(""); +$last = getMyDateFormatted($rollday); + +//Inserisco la mailing list e ottengo l'id +$ret = $db->roll()->insert(array( + "ml" => $ml, + "startroll" => $today, + "endroll" => $last +)); + +$file = fopen($filename, "r"); +while(!feof($file)){ + $line = fgets($file); + $sanitized_mail = filter_var($line, FILTER_SANITIZE_EMAIL); + if($sanitized_mail !== "") { + $token = getToken(); + + //Inserisco le mail dei membri della mailing list + $db->$db_table()->insert(array( + "id" => $ret['id'], + "token" => $token, + "email" => $sanitized_mail + )); + } +} +fclose($file);