diff --git a/application/controllers/Hyperviseur_dash.php b/application/controllers/Hyperviseur_dash.php index 0a4b86a0..2e0dc1e9 100755 --- a/application/controllers/Hyperviseur_dash.php +++ b/application/controllers/Hyperviseur_dash.php @@ -433,7 +433,7 @@ class Hyperviseur_dash extends CI_Controller private function historique($network_id, $startDate, $endDate, $type) { - $data['configWallet'] = $this->user_model->getConfigWallet($network_id); +// $data['configWallet'] = $this->user_model->getConfigWallet($network_id); $format = $this->session->userdata('site_lang') === 'french' ? 'd-m-Y' : 'Y-m-d'; $data['startDate'] = $startDate ? date($format, strtotime($startDate)) : null; $data['endDate'] = $endDate ? date($format, strtotime($endDate)) : null; @@ -445,7 +445,7 @@ class Hyperviseur_dash extends CI_Controller $data['currency_name_fr'] = $networkDetails->first_row()->currency_name_fr; $data['currency_name_en'] = $networkDetails->first_row()->currency_name_en; $data['transactions'] = $this->user_model->getIlinkTransactions($startDate, $endDate, $network_id); - + var_dump($data['transactions']); } else if ($type == 'commission_transfer') $data['transactions'] = $this->user_model->getCommissionTransfers($startDate, $endDate, $this->session->userdata('member_code')); else if ($type == 'balance_statement') @@ -455,7 +455,7 @@ class Hyperviseur_dash extends CI_Controller else $data['transactions'] = $this->user_model->getRecharges($startDate, $endDate, $network_id); - $data['active'] = "wallet"; + $data['active'] = "wallet_wallet"; $data['alert'] = ""; $data['firstname'] = $this->session->userdata('firstname'); $data['lastname'] = $this->session->userdata('lastname'); @@ -1011,7 +1011,7 @@ class Hyperviseur_dash extends CI_Controller private function config_wallet($config , $country) { // $data['configWallet'] = $this->user_model->getConfigWallet($network_id); - $data['active'] = "wallet"; + $data['active'] = "wallet_wallet"; $data['alert'] = ""; $data['firstname'] = $this->session->userdata('firstname'); $data['lastname'] = $this->session->userdata('lastname'); @@ -1147,7 +1147,7 @@ class Hyperviseur_dash extends CI_Controller private function show_config_infos($type) { - $data['active'] = "wallet"; + $data['active'] = "wallet_wallet"; $data['alert'] = ""; $data['firstname'] = $this->session->userdata('firstname'); $data['lastname'] = $this->session->userdata('lastname'); @@ -1190,31 +1190,106 @@ class Hyperviseur_dash extends CI_Controller public function nano_credit() { if ($this->isLogged()) { - $data['hasWallet'] = $this->user_model->getConfigWallet($this->session->userdata('network_id')); - $data['groups'] = $this->user_model->getUsersGroups($this->session->userdata('network_id')); - $data['idConfig'] = $data['hasWallet']->first_row()->id; - $data['rates'] = $this->user_model->getNanoCreditRates($data['idConfig']); - $data['taxes'] = $this->user_model->getTaxes($data['idConfig'], 'nano_credit'); - $data['active'] = "nano_credit"; - $data['alert'] = ""; - $data['game_pays'] = $this->user_model->getGameCountry(); - $data['network'] = $this->session->userdata('network'); - $data['country'] = $this->session->userdata('current_pays'); $data['network_id'] = $this->session->userdata('network_id'); - $data['firstname'] = $this->session->userdata('firstname'); - $data['lastname'] = $this->session->userdata('lastname'); - $data['currency_code'] = $this->session->userdata('currency_code'); - $data['token'] = $this->session->userdata('token'); - $data['email'] = $this->session->userdata('email'); - $data['configWallet'] = $data['hasWallet']->first_row(); - $data['villes'] = $this->user_model->getVilleByUserGeo($data['network'], $this->session->userdata('current_pays')); - $this->load->view('header_hyp', $data); - $this->load->view('nano_credit/gestion_nano_credit_hyp'); - $this->load->view('footer'); - + if ($this->input->get('history')) { + $this->historique_nano_credit($data['network_id'], $this->input->get('d'), $this->input->get('f'), $this->input->get('history')); + } elseif ($this->input->get('config')) { + $this->config_nano_credit($this->input->get('config')); + } else { + $data['hasWallet'] = $this->user_model->getConfigWallet($this->session->userdata('network_id')); + $data['groups'] = $this->user_model->getUsersGroups($this->session->userdata('network_id')); + $data['idConfig'] = $data['hasWallet']->first_row()->id; + $data['rates'] = $this->user_model->getNanoCreditRates($data['idConfig']); + $data['taxes'] = $this->user_model->getTaxes($data['idConfig'], 'nano_credit'); + $data['active'] = "nano_credit"; + $data['alert'] = ""; + $data['game_pays'] = $this->user_model->getGameCountry(); + $data['network'] = $this->session->userdata('network'); + $data['country'] = $this->session->userdata('current_pays'); + $data['firstname'] = $this->session->userdata('firstname'); + $data['lastname'] = $this->session->userdata('lastname'); + $data['currency_code'] = $this->session->userdata('currency_code'); + $data['token'] = $this->session->userdata('token'); + $data['email'] = $this->session->userdata('email'); + $data['configWallet'] = $data['hasWallet']->first_row(); + $data['villes'] = $this->user_model->getVilleByUserGeo($data['network'], $this->session->userdata('current_pays')); + $this->load->view('header_hyp', $data); + $this->load->view('nano_credit/gestion_nano_credit_hyp'); + $this->load->view('footer'); + } } } + private function config_nano_credit($config) + { +// $data['configWallet'] = $this->user_model->getConfigWallet($network_id); + $data['active'] = "nano_credit"; + $data['alert'] = ""; + $data['firstname'] = $this->session->userdata('firstname'); + $data['lastname'] = $this->session->userdata('lastname'); + $data['email'] = $this->session->userdata('email'); + $data['network'] = $this->session->userdata('network'); + $data['villes'] = $this->user_model->getVilleByUserGeo($data['network'], $this->session->userdata('current_pays')); + $data['hasWallet'] = $this->user_model->getConfigWallet($this->session->userdata('network_id')); + $data['country'] = $this->session->userdata('current_pays'); + $data['category'] = $this->session->userdata('category'); + $data['idConfig'] = $data['hasWallet']->first_row()->id; + $data['network_id'] = $this->session->userdata('network_id'); + + switch ($config) { + case 'nano_credit': + $data['rates'] = $this->user_model->getNanoCreditRates($data['idConfig']); + $data['taxes'] = $this->user_model->getTaxes($data['idConfig'], 'nano_credit'); + $this->load->view('header_hyp', $data); + $this->load->view('nano_credit/config_nano_credit'); + break; + + case 'epargne': + $data['rates'] = $this->user_model->getNanoCreditRates($data['idConfig'], 'epargne'); + $data['taxes'] = $this->user_model->getTaxes($data['idConfig'], 'epargne'); + $this->load->view('header_hyp', $data); + $this->load->view('nano_credit/config_savings'); + break; + } + $this->load->view('footer'); + } + + private function historique_nano_credit($network_id, $startDate, $endDate, $type) + { + $data['configWallet'] = $this->user_model->getConfigWallet($network_id); + $format = $this->session->userdata('site_lang') === 'french' ? 'd-m-Y' : 'Y-m-d'; + $data['startDate'] = $startDate ? date($format, strtotime($startDate)) : null; + $data['endDate'] = $endDate ? date($format, strtotime($endDate)) : null; + $endDate = Date('Y-m-d', strtotime($endDate . "+1 day")); + $data['currency_code'] = $this->session->userdata('currency_code'); + + if ($type == 'nano_credit') { + $data['transactions'] = $this->user_model->getUserDemandesCredit($startDate, $endDate, $network_id); + + } else if ($type == 'transaction_ilink') { + $data['transactions'] = $this->user_model->getIlinkTransactions($startDate, $endDate, $network_id); + } + $data['active'] = "nano_credit"; + $data['alert'] = ""; + $data['firstname'] = $this->session->userdata('firstname'); + $data['lastname'] = $this->session->userdata('lastname'); + $data['email'] = $this->session->userdata('email'); + $data['network'] = $this->session->userdata('network'); + $data['villes'] = $this->user_model->getVilleByUserGeo($data['network'], $this->session->userdata('current_pays')); + $data['networks'] = $this->user_model->getActiveNetwork(); + $data['superviseurs'] = $this->user_model->getSuperNameAndCodeForHyp($this->session->userdata('member_code')); + $data['hasWallet'] = $this->user_model->getConfigWallet($this->session->userdata('network_id')); + $data['country'] = $this->session->userdata('current_pays'); + $data['category'] = $this->session->userdata('category'); + + $this->load->view('header_hyp', $data); + if ($type == 'epargne') + $this->load->view('nano_credit/historique_savings'); + else + $this->load->view('nano_credit/historique_nano_credit'); + $this->load->view('footer'); + } + public function saveCreditLimit() { if ($this->isLogged()) { @@ -1241,7 +1316,9 @@ class Hyperviseur_dash extends CI_Controller if (isset($_POST)) { $idConfig = $_POST['id_config']; $rates = isset($_POST['rates']) ? $_POST['rates'] : null; - $this->insertNanoCreditRates($rates, $idConfig); + $type = isset($_POST['type']) ? $_POST['type'] : 'nano_credit'; + + $this->insertNanoCreditRates($rates, $idConfig, $type); $res = true; if ($res) { @@ -1253,12 +1330,12 @@ class Hyperviseur_dash extends CI_Controller } } - private function insertNanoCreditRates($palier, $idConfig) + private function insertNanoCreditRates($palier, $idConfig, $type) { - $exist = $this->user_model->getNanoCreditRates($idConfig); + $exist = $this->user_model->getNanoCreditRates($idConfig, $type); if ($exist) { - $this->user_model->deleteNanoCreditRates($idConfig); + $this->user_model->deleteNanoCreditRates($idConfig, $type); } if ($palier) { @@ -1268,7 +1345,7 @@ class Hyperviseur_dash extends CI_Controller foreach ($array as $key => $value) { $row[] = $value; } - $this->user_model->addNanoCreditRates($idConfig, $row[0], $row[1]); + $this->user_model->addNanoCreditRates($idConfig, $row[0], $row[1], $type); } } } diff --git a/application/controllers/InsertGeolocated.php b/application/controllers/InsertGeolocated.php index b336aa16..1d4e2941 100755 --- a/application/controllers/InsertGeolocated.php +++ b/application/controllers/InsertGeolocated.php @@ -1,140 +1,140 @@ -load->model('insert_model'); - - } - - public function index() - { - $url = 'https://ilink-app.com/mobilebackend/interacted/MembersAction.php'; - - $row = 1; - if (($handle = fopen("https://ilink-app.com/backofficebeta/application/controllers/BASE.csv", "r")) !== FALSE) { - while (($data = fgetcsv($handle, 1000, ",")) !== FALSE ) { - $num = count($data); - echo "

$num fields in line $row:

\n"; - if($row>2) { - for ($c = 0; $c < $num; $c++) { - $user_info = explode(";", $data[$c]); - //echo $data[$c] . "
\n"; - $fields = array( - "tag" => "member", - "type" => "create_geolocated_user", - "lastname" => addslashes($user_info[0]), - "phone" => "+226" . str_replace(' ', '', $user_info[3]), - "phone_transaction" => "+226" . str_replace(' ', '', $user_info[2]), - "address" => "", - "lang" => "fr", - "email" => "orangeburkina@ilink-app.com", - "password" => "1234", - "town" => ["id" => 11, "country_id" => 35, "name" => "Ouagadougou", "status" => 1], - "network" => ["id" => 34, "country_id" => 35, "name" => "Orange Burkina Faso"], - "latitude" => -1, - "longitude" => -1, - "category" => "Geolocated", - "member" => "lBWqyGbqFd" - ); - - - $fields_string = http_build_query($fields); - //url-ify the data for the POST - /*foreach ($fields as $key => $value) { - $fields_string .= $key . '=' . $value . '&'; - } - rtrim($fields_string, '&');*/ - - $ch = curl_init(); - - - curl_setopt($ch, CURLOPT_URL, $url); - curl_setopt($ch, CURLOPT_POST, 1); - curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($fields)); - curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: text/plain')); - - //execute post - $result = curl_exec($ch); - - //close connection - curl_close($ch); - - var_dump($fields_string); - - //echo json_encode($fields) . "
\n"; - - } - } - $row++; - } - fclose($handle); - } - - for ($c = 6001; $c <= 7873; $c++) { - $query = $this->db->query("SELECT phone,transactionNumber FROM networks_agents WHERE agent_id=".$c); - if($query->num_rows()>0){ - echo "N° ".$c." "."
\n"; - $update_phone = str_replace('+24100', '+2410', $query->row()->phone); - $update_transactionNumber = str_replace('+24100', '+2410',$query->row()->transactionNumber); - - $this->db->trans_start(); - $this->db->query("UPDATE networks_agents SET phone='".$update_phone."' WHERE agent_id ='".$c."'"); - $this->db->query("UPDATE networks_agents SET transactionNumber='".$update_transactionNumber."' WHERE agent_id ='".$c."'"); - $this->db->trans_complete(); - - if ($this->db->trans_status() === FALSE) - { - echo "Echec ligne n° ".$c; - }else{ - echo "Transaction réussite ligne n° ".$c; - } - echo "
\n"; - }else{ - echo "something wrong"; - } - } - } - - public function getDistincQuartier(){ - - $row = 1; - $count = 1; - if (($handle = fopen("https://ilink-app.com/backofficebeta/application/controllers/BASE_AGENT_TEST.csv", "r")) !== FALSE) { - while (($data = fgetcsv($handle, 1000, ",")) !== FALSE ) { - $num = count($data); - //echo "

$num fields in line $row:

\n"; - if($row>2) { - - for ($c = 0; $c < $num; $c++) { - $user_info = explode(";", $data[$c]); - //echo $data[$c] . "
\n"; - if( stristr($user_info[3], "akebe")) { - echo "N° ".$count; - echo "

\n"; - $count++; - - $fields = array( - "username" => addslashes($user_info[0]), - "phone" => "+241" . str_replace(' ', '', $user_info[1]), - "phone_transaction" => "+241" . str_replace(' ', '', $user_info[2]), - "address" => $user_info[3], - "lang" => "fr" - ); - - echo json_encode($fields); - } - - } - } - $row++; - } - fclose($handle); - } - } -} -?> \ No newline at end of file +load->model('insert_model'); + + } + + public function index() + { + $url = 'https://ilink-app.com/mobilebackend/interacted/MembersAction.php'; + + $row = 1; + if (($handle = fopen("https://ilink-app.com/backofficebeta/application/controllers/BASE.csv", "r")) !== FALSE) { + while (($data = fgetcsv($handle, 1000, ",")) !== FALSE ) { + $num = count($data); + echo "

$num fields in line $row:

\n"; + if($row>2) { + for ($c = 0; $c < $num; $c++) { + $user_info = explode(";", $data[$c]); + //echo $data[$c] . "
\n"; + $fields = array( + "tag" => "member", + "type" => "create_geolocated_user", + "lastname" => addslashes($user_info[0]), + "phone" => "+226" . str_replace(' ', '', $user_info[3]), + "phone_transaction" => "+226" . str_replace(' ', '', $user_info[2]), + "address" => "", + "lang" => "fr", + "email" => "orangeburkina@ilink-app.com", + "password" => "1234", + "town" => ["id" => 11, "country_id" => 35, "name" => "Ouagadougou", "status" => 1], + "network" => ["id" => 34, "country_id" => 35, "name" => "Orange Burkina Faso"], + "latitude" => -1, + "longitude" => -1, + "category" => "Geolocated", + "member" => "lBWqyGbqFd" + ); + + + $fields_string = http_build_query($fields); + //url-ify the data for the POST + /*foreach ($fields as $key => $value) { + $fields_string .= $key . '=' . $value . '&'; + } + rtrim($fields_string, '&');*/ + + $ch = curl_init(); + + + curl_setopt($ch, CURLOPT_URL, $url); + curl_setopt($ch, CURLOPT_POST, 1); + curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($fields)); + curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: text/plain')); + + //execute post + $result = curl_exec($ch); + + //close connection + curl_close($ch); + + //var_dump($fields_string); + + //echo json_encode($fields) . "
\n"; + + } + } + $row++; + } + fclose($handle); + } + + for ($c = 6001; $c <= 7873; $c++) { + $query = $this->db->query("SELECT phone,transactionNumber FROM networks_agents WHERE agent_id=".$c); + if($query->num_rows()>0){ + echo "N° ".$c." "."
\n"; + $update_phone = str_replace('+24100', '+2410', $query->row()->phone); + $update_transactionNumber = str_replace('+24100', '+2410',$query->row()->transactionNumber); + + $this->db->trans_start(); + $this->db->query("UPDATE networks_agents SET phone='".$update_phone."' WHERE agent_id ='".$c."'"); + $this->db->query("UPDATE networks_agents SET transactionNumber='".$update_transactionNumber."' WHERE agent_id ='".$c."'"); + $this->db->trans_complete(); + + if ($this->db->trans_status() === FALSE) + { + echo "Echec ligne n° ".$c; + }else{ + echo "Transaction réussite ligne n° ".$c; + } + echo "
\n"; + }else{ + echo "something wrong"; + } + } + } + + public function getDistincQuartier(){ + + $row = 1; + $count = 1; + if (($handle = fopen("https://ilink-app.com/backofficebeta/application/controllers/BASE_AGENT_TEST.csv", "r")) !== FALSE) { + while (($data = fgetcsv($handle, 1000, ",")) !== FALSE ) { + $num = count($data); + //echo "

$num fields in line $row:

\n"; + if($row>2) { + + for ($c = 0; $c < $num; $c++) { + $user_info = explode(";", $data[$c]); + //echo $data[$c] . "
\n"; + if( stristr($user_info[3], "akebe")) { + echo "N° ".$count; + echo "

\n"; + $count++; + + $fields = array( + "username" => addslashes($user_info[0]), + "phone" => "+241" . str_replace(' ', '', $user_info[1]), + "phone_transaction" => "+241" . str_replace(' ', '', $user_info[2]), + "address" => $user_info[3], + "lang" => "fr" + ); + + echo json_encode($fields); + } + + } + } + $row++; + } + fclose($handle); + } + } +} +?> diff --git a/application/controllers/Transfere.php b/application/controllers/Transfere.php index c7e30aec..671517f9 100755 --- a/application/controllers/Transfere.php +++ b/application/controllers/Transfere.php @@ -1,2934 +1,2934 @@ -load->model('insert_model'); - $this->load->model('user_model'); - } - - public function index() - { - $url = 'https://ilink-app.com/mobilebackend/interacted/MembersAction.php'; - - $row = 1; - if (($handle = fopen("https://ilink-app.com/backofficebeta/application/controllers/BASE.csv", "r")) !== FALSE) { - while (($data = fgetcsv($handle, 1, ",")) !== FALSE ) { - $num = count($data); - echo "

$num fields in line $row:

\n"; - if($row==1) { - $webhost = 'localhost'; - $webusername = 'root'; - $webpassword = 'vps@2017GA'; - $webdbname = 'ilink_beta'; - $webcon = mysqli_connect($webhost, $webusername, $webpassword, $webdbname); - if (mysqli_connect_errno()) - { - echo 'Failed to connect to MySQL: ' . mysqli_connect_error(); - } - $results = mysqli_query($webcon, "SELECT phone FROM `users` WHERE `country_code`='Gabon' and network='Libertis' and `category`='geolocated'"); - - $mobhost = 'localhost'; - $mobusername = 'root'; - $mobpassword = 'vps@2017GA'; - $mobdbname = 'iLink_test'; - $mobcon = mysqli_connect($mobhost, $mobusername, $mobpassword, $mobdbname); - if (mysqli_connect_errno()) - { - echo 'Failed to connect to MySQL: ' . mysqli_connect_error(); - } - if($results) { - while ($row = mysqli_fetch_array($results)) { - - //$user_info = explode(";", $data[$c]); - //echo $data[$c] . "
\n"; - foreach ($row as $key => $val) { - $row[$key] = mysqli_real_escape_string($mobcon, $row[$key]); - } - $fields = null; - if ($row['country_code'] == 'Cameroun') { - - } elseif ($row['country_code'] == 'France') { - - } elseif ($row['country_code'] == 'Gabon') { - $fields = array( - "tag" => "member", - "type" => "create_geolocated_user", - "lastname" => addslashes($row['lastname']), - "phone" => $row['phone'], - "phone_transaction" => $row['phone'], - "address" => $row['firstname'], - "lang" => "fr", - "email" => $row['email'], - "password" => "1234", - "town" => ["id" => 1, "country_id" => 78, "name" => "Gabon", "status" => 1], - "network" => ["id" => 14, "country_id" => 78, "name" => "Mobicash"], - "latitude" => $row['latitude'], - "longitude" => $row['longitude'], - "category" => "super", - "member" => "lBkGLqdC7f" - ); - } - - - $fields_string = http_build_query($fields); - //url-ify the data for the POST - /*foreach ($fields as $key => $value) { - $fields_string .= $key . '=' . $value . '&'; - } - rtrim($fields_string, '&');*/ - - $ch = curl_init(); - - - curl_setopt($ch, CURLOPT_URL, $url); - curl_setopt($ch, CURLOPT_POST, 1); - curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($fields)); - curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: text/plain')); - - //execute post - $result = curl_exec($ch); - - //close connection - curl_close($ch); - - var_dump($fields_string); - - //echo json_encode($fields) . "
\n"; - - } - }else{ - echo json_encode($results); - } - } - $row++; - } - fclose($handle); - } - - for ($c = 6001; $c <= 7873; $c++) { - $query = $this->db->query("SELECT phone,transactionNumber FROM networks_agents WHERE agent_id=".$c); - if($query->num_rows()>0){ - echo "N° ".$c." "."
\n"; - $update_phone = str_replace('+24100', '+2410', $query->row()->phone); - $update_transactionNumber = str_replace('+24100', '+2410',$query->row()->transactionNumber); - - $this->db->trans_start(); - $this->db->query("UPDATE networks_agents SET phone='".$update_phone."' WHERE agent_id ='".$c."'"); - $this->db->query("UPDATE networks_agents SET transactionNumber='".$update_transactionNumber."' WHERE agent_id ='".$c."'"); - $this->db->trans_complete(); - - if ($this->db->trans_status() === FALSE) - { - echo "Echec ligne n° ".$c; - }else{ - echo "Transaction réussite ligne n° ".$c; - } - echo "
\n"; - }else{ - echo "something wrong"; - } - } - } - - public function getDistincQuartier(){ - - $row = 1; - $count = 1; - if (($handle = fopen("https://ilink-app.com/backofficebeta/application/controllers/BASE_AGENT_TEST.csv", "r")) !== FALSE) { - while (($data = fgetcsv($handle, 1000, ",")) !== FALSE ) { - $num = count($data); - //echo "

$num fields in line $row:

\n"; - if($row>2) { - - for ($c = 0; $c < $num; $c++) { - $user_info = explode(";", $data[$c]); - //echo $data[$c] . "
\n"; - if( stristr($user_info[3], "akebe")) { - echo "N° ".$count; - echo "

\n"; - $count++; - - $fields = array( - "username" => addslashes($user_info[0]), - "phone" => "+241" . str_replace(' ', '', $user_info[1]), - "phone_transaction" => "+241" . str_replace(' ', '', $user_info[2]), - "address" => $user_info[3], - "lang" => "fr" - ); - - echo json_encode($fields); - } - - } - } - $row++; - } - fclose($handle); - } - } - - public function update_network(){ - - $webhost = 'localhost'; - $webusername = 'root'; - $webpassword = 'vps@2017GA'; - $webdbname = 'ilink_beta'; - $webcon = mysqli_connect($webhost, $webusername, $webpassword, $webdbname); - if (mysqli_connect_errno()) - { - echo 'Failed to connect to MySQL: ' . mysqli_connect_error(); - } - $results = mysqli_query($webcon, "SELECT phone FROM `users` WHERE `country_code`='Gabon' and network='Libertis' and `category`='geolocated'"); - - $mobhost = 'localhost'; - $mobusername = 'root'; - $mobpassword = 'vps@2017GA'; - $mobdbname = 'iLink_test'; - $mobcon = mysqli_connect($mobhost, $mobusername, $mobpassword, $mobdbname); - if (mysqli_connect_errno()) - { - echo 'Failed to connect to MySQL: ' . mysqli_connect_error(); - } - $res1 = null; - $code_parrain ='LADreUhH5S'; - $id_network =77; - $this->db->trans_begin(); - if($results) { - while ($row = mysqli_fetch_array($results)) { - - foreach ($row as $key => $val) { - $row[$key] = mysqli_real_escape_string($mobcon, $row[$key]); - } - $res1 = $this->user_model->update_networkAgent($row['phone'],$id_network); - if($res1){ - $id_codeG = $this->user_model->getCodeG($row['phone']); - if($id_codeG!=false){ - $res2 = $this->user_model->updateCodeG($id_codeG,$code_parrain); - if($res2){ - echo "id du code Ok\n"; - }else{ - echo "erreur\n"; - } - } - } - if($this->db->trans_status() === FALSE){ - $this->db->trans_rollback(); - echo "transaction annulée"; - }else{ - $this->db->trans_commit(); - echo "Completed"; - } - - } - - - }else{ - echo json_encode($results); - } - - } - - public function insert_super(){ - - $url = 'https://ilink-app.com/mobilebackend/interacted/MembersAction.php'; - - $row = 1; - if (($handle = fopen("https://ilink-app.com/backofficebeta/application/controllers/BASE.csv", "r")) !== FALSE) { - while (($data = fgetcsv($handle, 1, ",")) !== FALSE ) { - $num = count($data); - echo "

$num fields in line $row:

\n"; - if($row==1) { - $webhost = 'localhost'; - $webusername = 'root'; - $webpassword = 'vps@2017GA'; - $webdbname = 'ilink_beta'; - $webcon = mysqli_connect($webhost, $webusername, $webpassword, $webdbname); - if (mysqli_connect_errno()) - { - echo 'Failed to connect to MySQL: ' . mysqli_connect_error(); - } - $results = mysqli_query($webcon, "SELECT phone FROM `users` WHERE `country_code`='Gabon' and network='Libertis' and `category`='geolocated'"); - - $mobhost = 'localhost'; - $mobusername = 'root'; - $mobpassword = 'vps@2017GA'; - $mobdbname = 'iLink_test'; - $mobcon = mysqli_connect($mobhost, $mobusername, $mobpassword, $mobdbname); - if (mysqli_connect_errno()) - { - echo 'Failed to connect to MySQL: ' . mysqli_connect_error(); - } - if($results) { - while ($row = mysqli_fetch_array($results)) { - - //$user_info = explode(";", $data[$c]); - //echo $data[$c] . "
\n"; - foreach ($row as $key => $val) { - $row[$key] = mysqli_real_escape_string($mobcon, $row[$key]); - } - $fields = null; - if ($row['country_code'] == 'Cameroun') { - - } elseif ($row['country_code'] == 'France') { - - } elseif ($row['country_code'] == 'Gabon') { - $fields = array( - "tag" => "member", - "type" => "create_geolocated_user", - "lastname" => addslashes($row['lastname']), - "phone" => $row['phone'], - "phone_transaction" => $row['phone'], - "address" => $row['firstname'], - "lang" => "fr", - "email" => $row['email'], - "password" => "1234", - "town" => ["id" => 1, "country_id" => 78, "name" => "Gabon", "status" => 1], - "network" => ["id" => 14, "country_id" => 78, "name" => "Mobicash"], - "latitude" => $row['latitude'], - "longitude" => $row['longitude'], - "category" => "super", - "member" => "lBkGLqdC7f" - ); - } - - - $fields_string = http_build_query($fields); - //url-ify the data for the POST - /*foreach ($fields as $key => $value) { - $fields_string .= $key . '=' . $value . '&'; - } - rtrim($fields_string, '&');*/ - - $ch = curl_init(); - - - curl_setopt($ch, CURLOPT_URL, $url); - curl_setopt($ch, CURLOPT_POST, 1); - curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($fields)); - curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: text/plain')); - - //execute post - $result = curl_exec($ch); - - //close connection - curl_close($ch); - - var_dump($fields_string); - - //echo json_encode($fields) . "
\n"; - - } - }else{ - echo json_encode($results); - } - } - $row++; - } - fclose($handle); - } - - } - - public function creation_super(){ - - $data['message'] = "Login first!"; - $this->load->view('generer_super', $data); - } - - public function insert_super_ag(){ - - $url = 'https://ilink-app.com/mobilebackendtestA/interacted/MembersAction.php'; - - if(isset($_POST)) - { - $num_transac = (int)$this->input->post('transaction'); - $phone = (int)$this->input->post('telephone'); - $end = 1; - - $network = $this->user_model->getGabonNetwork(); - - - foreach ($network->result() AS $row){ - - $code_hyper = $this->user_model->getCodeHyper(77); - var_dump($code_hyper); - - if($code_hyper!=false){ - $nom = $this->input->post('nom'); - $fields = array( - "tag" => "member", - "type" => "create_geolocated_user", - "lastname" => addslashes($nom), - "phone" => $phone, - "phone_transaction" => $num_transac, - "address" => "Awendjé", - "lang" => "fr", - "email" => str_replace(' ', '', strtolower($row->name))."@ilink-app.com", - "password" => "1234", - "town" => ["id" => 1, "country_id" => 78, "name" => "Gabon", "status" => 1], - "network" => ["id" => $row->id, "country_id" => 78, "name" => $row->name], - "latitude" => -1, - "longitude" => -1, - "category" => "super", - "member" => $code_hyper - ); - - $fields_string = http_build_query($fields); - $ch = curl_init(); - curl_setopt($ch, CURLOPT_URL, $url); - curl_setopt($ch, CURLOPT_POST, 1); - curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($fields)); - curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: text/plain')); - $result = curl_exec($ch); - curl_close($ch); - - //var_dump($fields_string); - $num_transac++; - $phone++; - } - } - - } - } - - public function insert_airtel_mobi(){ - $url = 'https://ilink-app.com/mobilebackendtest/interacted/MembersAction.php'; - - if(isset($_POST)) - { - $num_transac = (int)$this->input->post('transaction'); - $phone = (int)$this->input->post('telephone'); - $end = 1; - - $code_hyper = 'XaU1lVW5DO'; - $nom = $this->input->post('nom'); - $email ="airtelmoney.ga@ilink-app.com"; - $idNetwork = 14; - $nameNetwork = "Airtel Money"; - - for ($i = 1; $i <= 2; $i++){ - - - $fields = array( - "tag" => "member", - "type" => "create_geolocated_user", - "lastname" => addslashes($nom), - "phone" => $phone, - "phone_transaction" => $num_transac, - "address" => "Awendjé", - "lang" => "fr", - "email" => $email, - "password" => "1234", - "town" => ["id" => 1, "country_id" => 78, "name" => "Gabon", "status" => 1], - "network" => ["id" => $idNetwork, "country_id" => 78, "name" => $nameNetwork], - "latitude" => -1, - "longitude" => -1, - "category" => "super", - "member" => $code_hyper - ); - - $fields_string = http_build_query($fields); - $ch = curl_init(); - curl_setopt($ch, CURLOPT_URL, $url); - curl_setopt($ch, CURLOPT_POST, 1); - curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($fields)); - curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: text/plain')); - $result = curl_exec($ch); - curl_close($ch); - - //var_dump($fields_string); - $num_transac++; - $phone++; - $email ="mobicash.ga@ilink-app.com"; - $idNetwork = 77; - $nameNetwork = "Mobicash"; - - } - - } - } - - public function insert_satcon_agents(){ - $url = 'https://ilink-app.com/mobilebackendtest/interacted/MembersAction.php'; - - if(isset($_POST)) - { - $num_transac = (int)$this->input->post('transaction'); - $phone = (int)$this->input->post('telephone'); - $end = 1; - - $code_hyper = 'aTWyxm5vAq'; - $nom = $this->input->post('nom'); - $email ="satcon.ga@ilink-app.com"; - $idNetwork = 223; - $nameNetwork = "Satcon"; - $fields = array( - "tag" => "member", - "type" => "create_geolocated_user", - "lastname" => addslashes($nom), - "phone" => $phone, - "phone_transaction" => $num_transac, - "address" => "Awendjé", - "lang" => "fr", - "email" => $email, - "password" => "1234", - "town" => ["id" => 1, "country_id" => 78, "name" => "Gabon", "status" => 1], - "network" => ["id" => $idNetwork, "country_id" => 78, "name" => $nameNetwork], - "latitude" => -1, - "longitude" => -1, - "category" => "super", - "member" => $code_hyper - ); - - $fields_string = http_build_query($fields); - $ch = curl_init(); - curl_setopt($ch, CURLOPT_URL, $url); - curl_setopt($ch, CURLOPT_POST, 1); - curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($fields)); - curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: text/plain')); - $result = curl_exec($ch); - curl_close($ch); - - //var_dump($fields_string); - - } - } - - public function create_hyper_super__for_cameroun(){ - - $url = 'https://ilink-app.com/mobilebackendtest/interacted/MembersAction.php'; - - $id_country = 38; - $country_name = 'Cameroun'; - $list_network = $this->user_model->getAllNetworksInfos($id_country); - $phone = 800405; - $num_transac = 801405; - - $this->db->trans_begin(); - foreach ($list_network->result() AS $row){ - - $nom = 'Super - '.$row->name; - $email = str_replace('+','plus',strtolower(str_replace(' ','',$row->name.'.cm@ilink-app.com'))); - $code_hyper = ''; - //$code_hyper = $this->user_model->getCodeHyper($row->id); - - switch ($row->id) { - case 61: - $code_hyper = "1qGVCj9mUW"; - break; - case 72: - $code_hyper = "SIY5RRDHuq"; - break; - case 83: - $code_hyper = "LxugQ1sEv3"; - break; - case 96: - $code_hyper = "inmycWlKg7"; - break; - case 101: - $code_hyper = "GUhpKC4xP4"; - break; - case 110: - $code_hyper = "xEHh8bromY"; - break; - case 119: - $code_hyper = "QV1yez3Vvv"; - break; - case 128: - $code_hyper = "U3oZgJ3Raj"; - break; - case 136: - $code_hyper = "IYI8LZy80k"; - break; - case 147: - $code_hyper = "ojGmDqWUXN"; - break; - case 159: - $code_hyper = "Yw2hMiEUUi"; - break; - case 172: - $code_hyper = "rXLofF9iCq"; - break; - case 185: - $code_hyper = "pNlXXMIxrr"; - break; - case 198: - $code_hyper = "YeqY1vRtqp"; - break; - case 210: - $code_hyper = "2X9MKvWAdV"; - break; - } - - - for ($i = 11; $i <= 15; $i++){ - $fields = array( - "tag" => "member", - "type" => "create_geolocated_user", - "lastname" => addslashes($nom.' '.$i), - "phone" => '+237'.$phone, - "phone_transaction" => '+237'.$num_transac, - "address" => "Douala", - "lang" => "fr", - "email" => $email, - "password" => "1234", - "town" => ["id" => 2, "country_id" => $id_country, "name" => $country_name, "status" => 1], - "network" => ["id" => $row->id, "country_id" => $id_country, "name" => $row->name], - "latitude" => 4.0303481, - "longitude" => 9.6955774, - "category" => "super", - "member" => $code_hyper - ); - - $fields_string = http_build_query($fields); - $ch = curl_init(); - curl_setopt($ch, CURLOPT_URL, $url); - curl_setopt($ch, CURLOPT_POST, 1); - curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($fields)); - curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: text/plain')); - $result = curl_exec($ch); - curl_close($ch); - - //var_dump($fields_string); - $num_transac++; - $phone++; - - } - - - if ($this->db->trans_status() === FALSE) - { - $this->db->trans_rollback(); - } - else - { - $this->db->trans_commit(); - } - } - } - - public function create_hyper_super__for_burkina(){ - - $url = 'https://ilink-app.com/mobilebackendtest/interacted/MembersAction.php'; - - $id_country = 35; - $country_name = 'Burkina Faso'; - $list_network = $this->user_model->getAllNetworksInfos($id_country); - $phone = 800330; - $num_transac = 801330; - - $this->db->trans_begin(); - foreach ($list_network->result() AS $row){ - - $nom = 'Super - '.$row->name; - $email = str_replace('+','plus',strtolower(str_replace(' ','',$row->name.'.bf@ilink-app.com'))); - $code_hyper = ''; - //$code_hyper = $this->user_model->getCodeHyper($row->id); - - switch ($row->id) { - case 34: - $code_hyper = "FwdhzYphN9"; //Orange Money - break; - case 80: - $code_hyper = "mKDhlm6qHE"; //Mobicash - break; - case 92: - $code_hyper = "hCx1XWUdkF"; //Western Union - break; - case 107: - $code_hyper = "K8QyRT6lx1"; //Express Union - break; - case 113: - $code_hyper = "40dBWQO01Y"; //Money Express - break; - case 126: - $code_hyper = "6VZn319rLg"; //UBA - break; - case 134: - $code_hyper = "OnYzGrYOmn"; //Canal + - break; - case 144: - $code_hyper = "yricgPggVQ"; //Small World - break; - case 155: - $code_hyper = "8a3ce5WmjX"; //Juba - break; - case 168: - $code_hyper = "dLrX56TGff"; //Wari - break; - case 181: - $code_hyper = "ARILdZBjMZ"; //Ria - break; - case 194: - $code_hyper = "6vNWB5NUCF"; //Sigue - break; - case 207: - $code_hyper = "u4PJg75tDr"; //Ecobank - break; - case 218: - $code_hyper = "uCphmoVjkQ"; //DHL - break; - case 224: - $code_hyper = "0EbLos93CE"; //MoneyGram - break; - } - - - for ($i = 1; $i <= 5; $i++){ - $fields = array( - "tag" => "member", - "type" => "create_geolocated_user", - "lastname" => addslashes($nom.' '.$i), - "phone" => '+226'.$phone, - "phone_transaction" => '+226'.$num_transac, - "address" => "Ouagadougou", - "lang" => "fr", - "email" => $email, - "password" => "1234", - "town" => ["id" => 11, "country_id" => $id_country, "name" => $country_name, "status" => 1], - "network" => ["id" => $row->id, "country_id" => $id_country, "name" => $row->name], - "latitude" => -1.50914, - "longitude" => 12.3136, - "category" => "super", - "member" => $code_hyper - ); - - $fields_string = http_build_query($fields); - $ch = curl_init(); - curl_setopt($ch, CURLOPT_URL, $url); - curl_setopt($ch, CURLOPT_POST, 1); - curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($fields)); - curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: text/plain')); - $result = curl_exec($ch); - curl_close($ch); - - //var_dump($fields_string); - $num_transac++; - $phone++; - - } - - - if ($this->db->trans_status() === FALSE) - { - $this->db->trans_rollback(); - } - else - { - $this->db->trans_commit(); - } - } - } - - public function create_hyper_super__for_congo(){ - - $url = 'https://ilink-app.com/mobilebackendtest/interacted/MembersAction.php'; - - $id_country = 50; - $country_name = 'Congo'; - $list_network = $this->user_model->getAllNetworksInfos($id_country); - $phone = 800344; - $num_transac = 801344; - - $this->db->trans_begin(); - foreach ($list_network->result() AS $row){ - - $nom = 'Super - '.$row->name; - $email = str_replace('+','plus',strtolower(str_replace(' ','',$row->name.'.cg@ilink-app.com'))); - $code_hyper = ''; - //$code_hyper = $this->user_model->getCodeHyper($row->id); - - switch ($row->id) { - case 15: - $code_hyper = "tsKrqQ9Ysu"; //Airtel Money Congo - break; - case 73: - $code_hyper = "i2y8cQSd5v"; //MTN Congo - break; - case 85: - $code_hyper = "zXDRW92SAs"; //Western Union Congo - break; - case 102: - $code_hyper = "uLQsOjz18F"; //Express Union Congo - break; - case 120: - $code_hyper = "XmogcV7QS5"; //UBA Congo - break; - case 129: - $code_hyper = "dfOz5pA0Xr"; //Canal + Congo - break; - case 137: - $code_hyper = "CnsnYwAlUX"; //Small World Congo - break; - case 148: - $code_hyper = "uqAD5k5wr0"; //Juba Congo - break; - case 161: - $code_hyper = "eKk9RTafzd"; //Wari Congo - break; - case 174: - $code_hyper = "kCXVFm2qDy"; //Ria Congo - break; - case 187: - $code_hyper = "kRiO8jGA9k"; //Sigue Congo - break; - case 200: - $code_hyper = "gUIkTEZzSW"; //Ecobank Congo - break; - case 211: - $code_hyper = "361EmZOKjr"; //DHL Congo - break; - case 98: - $code_hyper = "zhCnuFtqjb"; //MoneyGram Congo - break; - } - - - for ($i = 1; $i <= 15; $i++){ - $fields = array( - "tag" => "member", - "type" => "create_geolocated_user", - "lastname" => addslashes($nom.' '.$i), - "phone" => '+242'.$phone, - "phone_transaction" => '+242'.$num_transac, - "address" => "Brazzaville", - "lang" => "fr", - "email" => $email, - "password" => "1234", - "town" => ["id" => 4, "country_id" => $id_country, "name" => $country_name, "status" => 1], - "network" => ["id" => $row->id, "country_id" => $id_country, "name" => $row->name], - "latitude" => 4.2634, - "longitude" => 15.2429, - "category" => "super", - "member" => $code_hyper - ); - - $fields_string = http_build_query($fields); - $ch = curl_init(); - curl_setopt($ch, CURLOPT_URL, $url); - curl_setopt($ch, CURLOPT_POST, 1); - curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($fields)); - curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: text/plain')); - $result = curl_exec($ch); - curl_close($ch); - - //var_dump($fields_string); - $num_transac++; - $phone++; - - } - - - if ($this->db->trans_status() === FALSE) - { - $this->db->trans_rollback(); - } - else - { - $this->db->trans_commit(); - } - } - } - - public function create_hyper(){ - - $url = 'https://ilink-app.com/mobilebackendtest/interacted/MembersAction.php'; - $countries = $this->user_model->getCountries(); - foreach ($countries->result() AS $country){ - if($country->id ==35){ - $id_country = $country->id; - $country_name = $country->name; - $code_country = $country->code_country; - $code_dial = $country->code_dial; - $ville = $country->ville; - $id_ville = $country->id_ville; - - $list_network = $this->user_model->getAllNetworksInfos($id_country); - $phone = 99900001; - $num_transac = 99900101; - - $this->db->trans_begin(); - foreach ($list_network->result() AS $row) { - - if ($row->id == 228){ - - $nom = 'Hyper - ' . $row->name; - $email = str_replace('+', 'plus', strtolower(str_replace(' ', '', $row->name . '.' . $code_country . '@ilink-app.com'))); - $code_hyper = $this->user_model->getFreeCode(); - - $fields = array( - "tag" => "member", - "type" => "create_geolocated_user", - "lastname" => addslashes($nom), - "phone" => $code_dial . $phone, - "phone_transaction" => $code_dial . $num_transac, - "address" => $ville, - "lang" => "fr", - "email" => $email, - "password" => "1234", - "town" => ["id" => $id_ville, "country_id" => $id_country, "name" => $country_name, "status" => 1], - "network" => ["id" => $row->id, "country_id" => $id_country, "name" => $row->name], - "latitude" => -1.50914, - "longitude" => 12.3136, - "category" => "hyper", - "member" => $code_hyper - ); - - $fields_string = http_build_query($fields); - $ch = curl_init(); - curl_setopt($ch, CURLOPT_URL, $url); - curl_setopt($ch, CURLOPT_POST, 1); - curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($fields)); - curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: text/plain')); - $result = curl_exec($ch); - curl_close($ch); - - //var_dump($fields_string); - $num_transac++; - $phone++; - - if ($this->db->trans_status() === FALSE) { - $this->db->trans_rollback(); - } else { - $this->db->trans_commit(); - } - - } - } - - - } - } - } - - public function active_hyper(){ - $url = 'https://ilink-app.com/mobilebackendtest/interacted/MembersAction.php'; - - $hypervisers = $this->user_model->getInfosActivationHyperviseur(); - foreach ($hypervisers->result() AS $hyperviser){ - $fields = array( - "tag" => "member", - "type" => "validate_hyper_backoffice", - "lang" => "fr", - "phone" => $hyperviser->phone, - "code_validation" => $hyperviser->validation_code, - "nbre_super" => 200, - "nbre_geo" => 2000 - ); - $fields_string = http_build_query($fields); - $ch = curl_init(); - curl_setopt($ch, CURLOPT_URL, $url); - curl_setopt($ch, CURLOPT_POST, 1); - curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($fields)); - curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: text/plain')); - $result = curl_exec($ch); - curl_close($ch); - } - } - - public function create_super(){ - - $url = 'https://ilink-app.com/mobilebackendtest/interacted/MembersAction.php'; - $countries = $this->user_model->getCountries(); - foreach ($countries->result() AS $country){ - - if($country->id ==38){ - $id_country = $country->id; - $country_name = $country->name; - $code_country = $country->code_country; - $code_dial = $country->code_dial; - $ville = $country->ville; - $id_ville = $country->id_ville; - - $list_network = $this->user_model->getAllNetworksInfos($id_country); - $phone = 99900014; - $num_transac = 99900114; - $nom [] = null; - $nom[1] = 'Ewombe Patricia'; - $nom[2] = 'Michelle TAWA'; - $nom[3] = 'Maxime MADIBA MBAPPE'; - $nom[4] = 'Ndemba Anais'; - $nom[5] = 'Balla Simplice Steven'; - $nom[6] = 'NDOME Eyango Hondrea'; - $nom[7] = 'NYAME Guy Thierry'; - $nom[8] = 'Valentin BABAGNAK'; - $nom[9] = 'Christian Junior KOOH DALLE'; - $nom[10] = 'Lottin Jeannot'; - $nom[11] = 'Priscille ENGONO'; - $nom[12] = 'AGENT-NYASSA-PK28'; - - $this->db->trans_begin(); - foreach ($list_network->result() AS $row) { - echo $row->name; - if($row->id==231){ - $nom = 'Benoit MBANGUE'; - $email = str_replace('+', 'plus', strtolower(str_replace(' ', '', $row->name . '.' . $code_country . '@ilink-app.com'))); - $code_hyper = $this->user_model->getCodeMembreHyper($row->id); - - for ($i = 1; $i <= 1; $i++) { - - $fields = array( - "tag" => "member", - "type" => "create_geolocated_user", - "lastname" => addslashes($nom), - "phone" => $code_dial . $phone, - "phone_transaction" => $code_dial . $num_transac, - "address" => $ville, - "lang" => "fr", - "email" => $email, - "password" => "1234", - "town" => ["id" => $id_ville, "country_id" => $id_country, "name" => $country_name, "status" => 1], - "network" => ["id" => $row->id, "country_id" => $id_country, "name" => $row->name], - "latitude" => 4.05, - "longitude" => 9.7, - "category" => "super", - "member" => $code_hyper - ); - - $fields_string = http_build_query($fields); - $ch = curl_init(); - curl_setopt($ch, CURLOPT_URL, $url); - curl_setopt($ch, CURLOPT_POST, 1); - curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($fields)); - curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: text/plain')); - $result = curl_exec($ch); - curl_close($ch); - - - //var_dump($fields_string); - $num_transac++; - $phone++; - } - - if ($this->db->trans_status() === FALSE) { - $this->db->trans_rollback(); - } else { - $this->db->trans_commit(); - } - }else{ - - } - - - } - - - }else{ - - } - } - } - - public function show_geolocatedPoints(){ - - $webhost = 'localhost'; - $webusername = 'root'; - $webpassword = 'vps@2017GA'; - $webdbname = 'iLink_cannary'; - $webcon = mysqli_connect($webhost, $webusername, $webpassword, $webdbname); - if (mysqli_connect_errno()) - { - echo 'Failed to connect to MySQL: ' . mysqli_connect_error(); - } - $results = mysqli_query($webcon, "SELECT agents.lastname,networks.name,networks_agents.phone,networks_agents.transactionNumber FROM `agents` - INNER JOIN networks_agents ON agents.id=networks_agents.agent_id - INNER JOIN networks ON networks.id=networks_agents.network_id - WHERE networks.country_id=78 - ORDER BY agents.lastname"); - - if($results) { - while ($row = mysqli_fetch_array($results)) { - echo $row['lastname'].' '.$row['name'].' '.$row['transactionNumber'].' '.$row['phone'].' '.$row['transactionNumber']."
"; - } - }else{ - echo 'Something wrong !'; - } - } - - public function test(){ - - $data['active'] = "demandes"; - $data['alert'] = ""; - $data['token'] = $this->session->userdata('token'); - $data['email'] = "nzaleh@gmail.com"; - $data['firstname'] = "Hanry"; - $data['lastname'] = "Nzale"; - $data['code_parrain'] = "VGVTttvf"; - $data['phone'] = "+24107916421"; - $data['adresse'] = "IAI"; - $data['category'] = "Admin"; - $data['network'] = 1; - $data['pays'] = $this->user_model->getAllCountries(); - $data['pays'] = $this->user_model->getAllCountries(); - $data['hyper'] = $this->user_model->getAllHyper($data['pays']->first_row()->id); - $data['ville'] = $this->user_model->getVilleNetworkByHyper($data['hyper']->first_row()->code_membre); - $this->load->view('header', $data); - $this->load->view('test'); - $this->load->view('footer'); - } - //ok - public function campagne_geocoding_orangemoney(){ - - function get_lat_lng($address){ - - $address_encoding = htmlentities(urlencode($address)); - $api = "AIzaSyClYkvZ3XUD9EKZv3Z2BLzkr7wBoV2aQ98"; - - $url = "https://maps.googleapis.com/maps/api/geocode/json?address=".$address_encoding."&key=".$api; - $contents = file_get_contents($url); - if($contents !== false){ - $contents = utf8_encode($contents); - $results = json_decode($contents); - $data = $results->results; - $lat = $data[0]->geometry->location->lat; - $lng = $data[0]->geometry->location->lng; - $adress = $data[0]->formatted_address; - $ville = $data[0]->address_components[2]->long_name; - $position["lat"] = $lat; - $position["lng"] = $lng; - $position["adresse"] = $address; - $results = $data; - - if ($results[0]) { - $num = sizeof($results[0]->address_components); - for ($i=0; $i<$num; $i++) { - $num2 = sizeof($results[0]->address_components[$i]->types); - for ($b=0;$b<$num2;$b++) { - if ($results[0]->address_components[$i]->types[$b] == "locality") { - $city= $results[0]->address_components[$i]; - break; - } - } - } - } - $position["ville"] = $city->long_name; - return $position; - }else{ - return null; - } - } - $url = 'https://ilink-app.com/mobilebackendtest/interacted/MembersAction.php'; - $row = 1; - $nom = ""; - $address = ""; - $num_contact =""; - $default_num = 33900001018; - - if (($handle = fopen("https://ilink-app.com/backofficeiLinkTest/application/controllers/Orange_money_paris.csv", "r")) !== FALSE) { - while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) { - $num = count($data); - if($row==3){ - echo "

$num fields in line $row:

\n"; - for ($c=0; $c < $num; $c++) { - $infos = explode(";", $data[$c]); - - $network_name = "Orange Money"; - $network_id = 60; - $email = 'orangemoney.fr@ilink-app.com'; - $code_super = "eNz6BDONDs"; - - $nom = $infos[0]; - $address = $infos[1].', '.$infos[2]; - $num_contact = '+33'.$infos[4]; - - $position = get_lat_lng($address); - $lat = $position['lat']; - $lng = $position['lng']; - $ville = $position['ville']; - $address = $position['adresse']; - $town_id = $this->user_model->getTownId($ville); - - $default_num++; - $exist = $this->user_model->checkPosition($lat,$lng); - if($exist == false){ - $fields = array( - "tag" => "member", - "type" => "create_geolocated_user", - "lastname" => addslashes($nom), - "phone" => $num_contact, - "phone_transaction" => '+'.$default_num, - "address" => addslashes($address), - "lang" => "fr", - "email" => $email, - "password" => "1234", - "town" => ["id" => $town_id, "country_id" => 74, "name" => "France", "status" => 1], - "network" => ["id" => $network_id, "country_id" => 74, "name" => $network_name], - "latitude" => $lat, - "longitude" => $lng, - "category" => "geolocated", - "member" => $code_super - ); - }else{ - - } - //echo json_encode($fields)."

\n"; - $this->db->trans_begin(); - $fields_string = http_build_query($fields); - $ch = curl_init(); - curl_setopt($ch, CURLOPT_URL, $url); - curl_setopt($ch, CURLOPT_POST, 1); - curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($fields)); - curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: text/plain')); - $result = curl_exec($ch); - curl_close($ch); - if ($this->db->trans_status() === FALSE) { - $this->db->trans_rollback(); - } else { - $this->db->trans_commit(); - } - - //echo $infos[0] .' -- '.$infos[1].' -- '.$infos[2].' -- '.$infos[3].' ('.$lat.'/'.$lng. ")
\n"; - } - } - $row++; - } - fclose($handle); - } - - /*$address = ""; - $position = get_lat_lng($address); - $lat = $position['lat']; - $lng = $position["lng"];*/ - - - } - //ok - public function campagne_geocoding_western(){ - - function get_lat_lng($address){ - - $address_encoding = htmlentities(urlencode($address)); - $api = "AIzaSyClYkvZ3XUD9EKZv3Z2BLzkr7wBoV2aQ98"; - - $url = "https://maps.googleapis.com/maps/api/geocode/json?address=".$address_encoding."&key=".$api; - $contents = file_get_contents($url); - if($contents !== false){ - $contents = utf8_encode($contents); - $results = json_decode($contents); - $data = $results->results; - $lat = $data[0]->geometry->location->lat; - $lng = $data[0]->geometry->location->lng; - $adress = $data[0]->formatted_address; - $ville = $data[0]->address_components[2]->long_name; - $position["lat"] = $lat; - $position["lng"] = $lng; - $position["adresse"] = $address; - $results = $data; - - if ($results[0]) { - $num = sizeof($results[0]->address_components); - for ($i=0; $i<$num; $i++) { - $num2 = sizeof($results[0]->address_components[$i]->types); - for ($b=0;$b<$num2;$b++) { - if ($results[0]->address_components[$i]->types[$b] == "locality") { - $city= $results[0]->address_components[$i]; - break; - } - } - } - } - $position["ville"] = $city->long_name; - return $position; - }else{ - return null; - } - } - function remove_accent($str) - { - $a = array('À', 'Á', 'Â', 'Ã', 'Ä', 'Å', 'Æ', 'Ç', 'È', 'É', 'Ê', 'Ë', 'Ì', 'Í', 'Î', 'Ï', 'Ð', - 'Ñ', 'Ò', 'Ó', 'Ô', 'Õ', 'Ö', 'Ø', 'Ù', 'Ú', 'Û', 'Ü', 'Ý', 'ß', 'à', 'á', 'â', 'ã', - 'ä', 'å', 'æ', 'ç', 'è', 'é', 'ê', 'ë', 'ì', 'í', 'î', 'ï', 'ñ', 'ò', 'ó', 'ô', 'õ', - 'ö', 'ø', 'ù', 'ú', 'û', 'ü', 'ý', 'ÿ', 'Ā', 'ā', 'Ă', 'ă', 'Ą', 'ą', 'Ć', 'ć', 'Ĉ', - 'ĉ', 'Ċ', 'ċ', 'Č', 'č', 'Ď', 'ď', 'Đ', 'đ', 'Ē', 'ē', 'Ĕ', 'ĕ', 'Ė', 'ė', 'Ę', 'ę', - 'Ě', 'ě', 'Ĝ', 'ĝ', 'Ğ', 'ğ', 'Ġ', 'ġ', 'Ģ', 'ģ', 'Ĥ', 'ĥ', 'Ħ', 'ħ', 'Ĩ', 'ĩ', 'Ī', 'ī', - 'Ĭ', 'ĭ', 'Į', 'į', 'İ', 'ı', 'IJ', 'ij', 'Ĵ', 'ĵ', 'Ķ', 'ķ', 'Ĺ', 'ĺ', 'Ļ', 'ļ', 'Ľ', 'ľ', - 'Ŀ', 'ŀ', 'Ł', 'ł', 'Ń', 'ń', 'Ņ', 'ņ', 'Ň', 'ň', 'ʼn', 'Ō', 'ō', 'Ŏ', 'ŏ', 'Ő', 'ő', 'Œ', - 'œ', 'Ŕ', 'ŕ', 'Ŗ', 'ŗ', 'Ř', 'ř', 'Ś', 'ś', 'Ŝ', 'ŝ', 'Ş', 'ş', 'Š', 'š', 'Ţ', 'ţ', 'Ť', - 'ť', 'Ŧ', 'ŧ', 'Ũ', 'ũ', 'Ū', 'ū', 'Ŭ', 'ŭ', 'Ů', 'ů', 'Ű', 'ű', 'Ų', 'ų', 'Ŵ', 'ŵ', 'Ŷ', - 'ŷ', 'Ÿ', 'ÿ', 'Ź', 'ź', 'Ż', 'ż', 'Ž', 'ž', 'ſ', 'ƒ', 'Ơ', 'ơ', 'Ư', 'ư', 'Ǎ', 'ǎ', 'Ǐ', 'ǐ', - 'Ǒ', 'ǒ', 'Ǔ', 'ǔ', 'Ǖ', 'ǖ', 'Ǘ', 'ǘ', 'Ǚ', 'ǚ', 'Ǜ', 'ǜ', 'Ǻ', 'ǻ', 'Ǽ', 'ǽ', 'Ǿ', 'ǿ'); - - $b = array('A', 'A', 'A', 'A', 'A', 'A', 'AE', 'C', 'E', 'E', 'E', 'E', 'I', 'I', 'I', 'I', 'D', 'N', 'O', - 'O', 'O', 'O', 'O', 'O', 'U', 'U', 'U', 'U', 'Y', 's', 'a', 'a', 'a', 'a', 'a', 'a', 'ae', 'c', - 'e', 'e', 'e', 'e', 'i', 'i', 'i', 'i', 'n', 'o', 'o', 'o', 'o', 'o', 'o', 'u', 'u', 'u', 'u', - 'y', 'y', 'A', 'a', 'A', 'a', 'A', 'a', 'C', 'c', 'C', 'c', 'C', 'c', 'C', 'c', 'D', 'd', 'D', - 'd', 'E', 'e', 'E', 'e', 'E', 'e', 'E', 'e', 'E', 'e', 'G', 'g', 'G', 'g', 'G', 'g', 'G', 'g', - 'H', 'h', 'H', 'h', 'I', 'i', 'I', 'i', 'I', 'i', 'I', 'i', 'I', 'i', 'IJ', 'ij', 'J', 'j', 'K', - 'k', 'L', 'l', 'L', 'l', 'L', 'l', 'L', 'l', 'L', 'l', 'N', 'n', 'N', 'n', 'N', 'n', 'n', 'O', 'o', - 'O', 'o', 'O', 'o', 'OE', 'oe', 'R', 'r', 'R', 'r', 'R', 'r', 'S', 's', 'S', 's', 'S', 's', 'S', - 's', 'T', 't', 'T', 't', 'T', 't', 'U', 'u', 'U', 'u', 'U', 'u', 'U', 'u', 'U', 'u', 'U', 'u', 'W', - 'w', 'Y', 'y', 'y', 'Y', 'Z', 'z', 'Z', 'z', 'Z', 'z', 's', 'f', 'O', 'o', 'U', 'u', 'A', 'a', 'I', 'i', - 'O', 'o', 'U', 'u', 'U', 'u', 'U', 'u', 'U', 'u', 'U', 'u', 'A', 'a', 'AE', 'ae', 'O', 'o'); - return str_replace($a, $b, $str); - } - $url = 'https://ilink-app.com/mobilebackendtest/interacted/MembersAction.php'; - $row = 1; - $nom = ""; - $address = ""; - $num_contact =""; - $n1=1; - $n2=0; - $ok = true; - $ct = 0; - $default_num = 33900004034; - $lastname = ""; - - if (($handle = fopen("https://ilink-app.com/backofficeiLinkTest/application/controllers/western_union_paris.csv", "r")) !== FALSE) { - while (($data = fgetcsv($handle, 10000, ";")) !== FALSE) { - $num = count($data); - //echo "

$num fields in line $row:

\n"; - - for ($c=0; $c < $num; $c++) { - //echo $data[$c] . "
\n"; - if($n1 == 1){ - $lastname = $data[$c]; - $n1++; - }elseif($n1==2){ - $tmp = utf8_encode(str_replace( chr( 194 ) . chr( 160 ), ' ', $data[$c] )); - $inf = explode("+", str_replace( chr( 194 ) . chr( 160 ), ' ', $tmp )); - $address = $inf[0]; - $contact_correct = str_replace('-','',$inf[1]); - $num_contact = '+'.$contact_correct; - $nom = $lastname; - /*echo $lastname. "
\n"; - echo $address. "
\n"; - echo $num_contact. "
\n";*/ - - $network_name = "Western Union"; - $network_id = 84; - $email = 'westernunion.fr@ilink-app.com'; - $code_super = "fDvQe9ZANz"; - - $position = get_lat_lng($address); - $lat = $position['lat']; - $lng = $position['lng']; - $ville = remove_accent($position['ville']); - $ville = str_replace('A¿', 'y', $ville); - $address = $position['adresse']; - /*$town_id = $this->user_model->getTownId(addslashes($ville)); - if($town_id==null){ - $res = $this->user_model->create_town(74,addslashes($ville)); - if($res){ - $town_id = $this->user_model->getTownId(addslashes($ville)); - $ret = $this->user_model->update_town_agent($lat,$lng,$town_id); - if($ret){ - echo "Mise à jour Ok!"; - }else{ - echo "Erreur lors de la mise à jour"; - } - }else{ - echo "Erreur lors de la création de la ville"; - } - }*/ - - - /*if($num_contact == "+33969366050"){ - $num_contact = $default_num; - $default_num++; - } - for($i=10; $i < 34; $i++){ - if($num_contact == '+339000000'.$i){ - $num_contact = $default_num; - $default_num++; - } - } - for($i=0; $i < 10; $i++){ - if($num_contact == '+3390000000'.$i){ - $num_contact = $default_num; - $default_num++; - } - }*/ - - $fields = array( - "tag" => "member", - "type" => "create_geolocated_user", - "lastname" => addslashes($nom), - "phone" => $num_contact, - "phone_transaction" => '+'.$default_num, - "address" => addslashes($address), - "lang" => "fr", - "email" => $email, - "password" => "1234", - "town" => ["id" => 3, "country_id" => 74, "name" => "France", "status" => 1], - "network" => ["id" => $network_id, "country_id" => 74, "name" => $network_name], - "latitude" => $lat, - "longitude" => $lng, - "category" => "geolocated", - "member" => $code_super - ); - $default_num++; - //echo json_encode($fields)."

\n";; - $this->db->trans_begin(); - $fields_string = http_build_query($fields); - $ch = curl_init(); - curl_setopt($ch, CURLOPT_URL, $url); - curl_setopt($ch, CURLOPT_POST, 1); - curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($fields)); - curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: text/plain')); - $result = curl_exec($ch); - curl_close($ch); - if ($this->db->trans_status() === FALSE) { - $this->db->trans_rollback(); - } else { - $this->db->trans_commit(); - } - - $n1 = 1; - } - - /*$data[0] = utf8_encode($data[0]); - $data[0] = str_replace( chr( 194 ) . chr( 160 ), ' ', $data[0] ); - $inf = explode("+", str_replace( chr( 194 ) . chr( 160 ), ' ', $data[0] )); - $address = str_replace( chr( 194 ) . chr( 160 ), ' ', $data[0] ).' '.$inf[0]; - $contact_correct = str_replace('-','',$inf[1]); - $num_contact ='+'.$contact_correct; - echo "

$num fields in line $row:

\n"; - echo $lastname."

\n"; - echo json_encode($data)."

\n";*/ - } - $row++; - } - fclose($handle); - } - - /*$address = ""; - $position = get_lat_lng($address); - $lat = $position['lat']; - $lng = $position["lng"];*/ - - - } - //ok - public function campagne_geocoding_moneygram(){ - - function get_lat_lng($address){ - - $address_encoding = htmlentities(urlencode($address)); - $api = "AIzaSyClYkvZ3XUD9EKZv3Z2BLzkr7wBoV2aQ98"; - - $url = "https://maps.googleapis.com/maps/api/geocode/json?address=".$address_encoding."&key=".$api; - $contents = file_get_contents($url); - if($contents !== false){ - $contents = utf8_encode($contents); - $results = json_decode($contents); - $data = $results->results; - $lat = $data[0]->geometry->location->lat; - $lng = $data[0]->geometry->location->lng; - $adress = $data[0]->formatted_address; - $ville = $data[0]->address_components[2]->long_name; - $position["lat"] = $lat; - $position["lng"] = $lng; - $position["adresse"] = $address; - $results = $data; - - if ($results[0]) { - $num = sizeof($results[0]->address_components); - for ($i=0; $i<$num; $i++) { - $num2 = sizeof($results[0]->address_components[$i]->types); - for ($b=0;$b<$num2;$b++) { - if ($results[0]->address_components[$i]->types[$b] == "locality") { - $city= $results[0]->address_components[$i]; - break; - } - } - } - } - $position["ville"] = $city->long_name; - return $position; - }else{ - return null; - } - } - $url = 'https://ilink-app.com/mobilebackendtest/interacted/MembersAction.php'; - $row = 1; - $nom = ""; - $address = ""; - $num_contact =""; - $n1=1; - $n2=0; - $ok = true; - $ct = 0; - $default_num = 33900003034; - $lastname = ""; - - if (($handle = fopen("https://ilink-app.com/backofficeiLinkTest/application/controllers/MONEYGRAM.csv", "r")) !== FALSE) { - while (($data = fgetcsv($handle, 10000, ";")) !== FALSE) { - $num = count($data); - for ($c=0; $c < $num; $c++) { - //echo $data[$c] . "
\n"; - if($n1 == 1){ - $lastname = $data[$c]; - $n1++; - }elseif($n1==2){ - $adress1 = $data[$c]; - $n1++; - - - /*if($num_contact == "+33969366050"){ - $num_contact = $default_num; - $default_num++; - } - for($i=10; $i < 34; $i++){ - if($num_contact == '+339000000'.$i){ - $num_contact = $default_num; - $default_num++; - } - } - for($i=0; $i < 10; $i++){ - if($num_contact == '+3390000000'.$i){ - $num_contact = $default_num; - $default_num++; - } - }*/ - - /* - */ - - - }elseif($n1 == 3){ - $address = $adress1.' '.$data[$c]; - $n1++; - }elseif($n1 == 4){ - $num_contact = $data[$c]; - /*echo $lastname."

\n"; - echo $address."

\n"; - echo $num_contact."

\n";*/ - - $num_contact = '+33'.$num_contact; - $nom = $lastname; - /*echo $lastname. "
\n"; - echo $address. "
\n"; - echo $num_contact. "
\n";*/ - - $network_name = "MoneyGram"; - $network_id = 97; - $email = 'moneygram.fr@ilink-app.com'; - $code_super = "Q4kVHVRHvo"; - - $position = get_lat_lng($address); - $lat = $position['lat']; - $lng = $position['lng']; - $ville = $position['ville']; - $address = $position['adresse']; - //$town_id = $this->user_model->getTownId($ville); - - $exist = $this->user_model->checkPosition($lat,$lng); - if($exist == false){ - $fields = array( - "tag" => "member", - "type" => "create_geolocated_user", - "lastname" => addslashes($nom), - "phone" => $num_contact, - "phone_transaction" => '+'.$default_num, - "address" => addslashes($address), - "lang" => "fr", - "email" => $email, - "password" => "1234", - "town" => ["id" => 3, "country_id" => 74, "name" => "France", "status" => 1], - "network" => ["id" => $network_id, "country_id" => 74, "name" => $network_name], - "latitude" => $lat, - "longitude" => $lng, - "category" => "geolocated", - "member" => $code_super - ); - }else{ - - } - $default_num++; - //echo json_encode($fields)."

\n"; - $this->db->trans_begin(); - $fields_string = http_build_query($fields); - $ch = curl_init(); - curl_setopt($ch, CURLOPT_URL, $url); - curl_setopt($ch, CURLOPT_POST, 1); - curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($fields)); - curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: text/plain')); - $result = curl_exec($ch); - curl_close($ch); - if ($this->db->trans_status() === FALSE) { - $this->db->trans_rollback(); - } else { - $this->db->trans_commit(); - } - - - $n1 = 1; - } - - /*$data[0] = utf8_encode($data[0]); - $data[0] = str_replace( chr( 194 ) . chr( 160 ), ' ', $data[0] ); - $inf = explode("+", str_replace( chr( 194 ) . chr( 160 ), ' ', $data[0] )); - $address = str_replace( chr( 194 ) . chr( 160 ), ' ', $data[0] ).' '.$inf[0]; - $contact_correct = str_replace('-','',$inf[1]); - $num_contact ='+'.$contact_correct; - echo "

$num fields in line $row:

\n"; - echo $lastname."

\n"; - echo json_encode($data)."

\n";*/ - } - $row++; - } - fclose($handle); - } - - /*$address = ""; - $position = get_lat_lng($address); - $lat = $position['lat']; - $lng = $position["lng"];*/ - - - } - //ok - public function campagne_geocoding_ria(){ - - function get_lat_lng($address){ - - $address_encoding = htmlentities(urlencode($address)); - $api = "AIzaSyClYkvZ3XUD9EKZv3Z2BLzkr7wBoV2aQ98"; - - $url = "https://maps.googleapis.com/maps/api/geocode/json?address=".$address_encoding."&key=".$api; - $contents = file_get_contents($url); - if($contents !== false){ - $contents = utf8_encode($contents); - $results = json_decode($contents); - $data = $results->results; - $lat = $data[0]->geometry->location->lat; - $lng = $data[0]->geometry->location->lng; - $adress = $data[0]->formatted_address; - $ville = $data[0]->address_components[2]->long_name; - $position["lat"] = $lat; - $position["lng"] = $lng; - $position["adresse"] = $address; - $results = $data; - - if ($results[0]) { - $num = sizeof($results[0]->address_components); - for ($i=0; $i<$num; $i++) { - $num2 = sizeof($results[0]->address_components[$i]->types); - for ($b=0;$b<$num2;$b++) { - if ($results[0]->address_components[$i]->types[$b] == "locality") { - $city= $results[0]->address_components[$i]; - break; - } - } - } - } - $position["ville"] = $city->long_name; - return $position; - }else{ - return null; - } - } - $url = 'https://ilink-app.com/mobilebackendtest/interacted/MembersAction.php'; - $row = 1; - $nom = ""; - $address = ""; - $num_contact =""; - $n1=1; - $n2=0; - $ok = true; - $ct = 0; - $default_num = 33900002000; - $lastname = ""; - - if (($handle = fopen("https://ilink-app.com/backofficeiLinkTest/application/controllers/ria_paris.csv", "r")) !== FALSE) { - while (($data = fgetcsv($handle, 10000, ";")) !== FALSE) { - $num = count($data); - $num = 1; - //echo "

$num fields in line $row:

\n"; - for ($c=0; $c < $num; $c++) { - //echo $data[$c] . "
\n"; - if($n1 == 1){ - $adress1 = $data[$c]; - $n1++; - - }elseif($n1==2){ - $address_temp = $adress1.' '.$data[$c]; - $n1++; - }elseif($n1 == 3){ - $phone = $data[$c]; - $inf_ctc = explode("+", $phone); - $num_contact = '+'.$inf_ctc[1]; - $nom = "Boutique Ria"; - - $network_name = "Ria"; - $network_id = 173; - $email = 'ria.fr@ilink-app.com'; - $code_super = "UZ8RdNwd9W"; - - $position = get_lat_lng(utf8_encode($address_temp)); - $lat = $position['lat']; - $lng = $position['lng']; - $ville = $position['ville']; - $address = $position['adresse']; - $town_id = $this->user_model->getTownId($ville); - - $exist = $this->user_model->checkPosition($lat,$lng); - if($exist == false){ - $fields = array( - "tag" => "member", - "type" => "create_geolocated_user", - "lastname" => addslashes($nom), - "phone" => $num_contact, - "phone_transaction" => '+'.$default_num, - "address" => $address, - "lang" => "fr", - "email" => $email, - "password" => "1234", - "town" => ["id" => 3, "country_id" => 74, "name" => "France", "status" => 1], - "network" => ["id" => $network_id, "country_id" => 74, "name" => $network_name], - "latitude" => $lat, - "longitude" => $lng, - "category" => "geolocated", - "member" => $code_super - ); - }else{ - - } - $default_num++; - //echo json_encode($fields)."

\n"; - $this->db->trans_begin(); - $fields_string = http_build_query($fields); - $ch = curl_init(); - curl_setopt($ch, CURLOPT_URL, $url); - curl_setopt($ch, CURLOPT_POST, 1); - curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($fields)); - curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: text/plain')); - $result = curl_exec($ch); - curl_close($ch); - if ($this->db->trans_status() === FALSE) { - $this->db->trans_rollback(); - } else { - $this->db->trans_commit(); - } - $n1 = 1; - } - - /*$data[0] = utf8_encode($data[0]); - $data[0] = str_replace( chr( 194 ) . chr( 160 ), ' ', $data[0] ); - $inf = explode("+", str_replace( chr( 194 ) . chr( 160 ), ' ', $data[0] )); - $address = str_replace( chr( 194 ) . chr( 160 ), ' ', $data[0] ).' '.$inf[0]; - $contact_correct = str_replace('-','',$inf[1]); - $num_contact ='+'.$contact_correct; - echo "

$num fields in line $row:

\n"; - echo $lastname."

\n"; - echo json_encode($data)."

\n";*/ - } - $row++; - } - fclose($handle); - } - - /*$address = ""; - $position = get_lat_lng($address); - $lat = $position['lat']; - $lng = $position["lng"];*/ - - - } - - public function campagne_geocoding_sigue(){ - - function get_lat_lng($address){ - - $address_encoding = htmlentities(urlencode($address)); - $api = "AIzaSyClYkvZ3XUD9EKZv3Z2BLzkr7wBoV2aQ98"; - - $url = "https://maps.googleapis.com/maps/api/geocode/json?address=".$address_encoding."&key=".$api; - $contents = file_get_contents($url); - if($contents !== false){ - $contents = utf8_encode($contents); - $results = json_decode($contents); - $data = $results->results; - $lat = $data[0]->geometry->location->lat; - $lng = $data[0]->geometry->location->lng; - $adress = $data[0]->formatted_address; - $ville = $data[0]->address_components[2]->long_name; - $position["lat"] = $lat; - $position["lng"] = $lng; - $position["adresse"] = $address; - $results = $data; - - if ($results[0]) { - $num = sizeof($results[0]->address_components); - for ($i=0; $i<$num; $i++) { - $num2 = sizeof($results[0]->address_components[$i]->types); - for ($b=0;$b<$num2;$b++) { - if ($results[0]->address_components[$i]->types[$b] == "locality") { - $city= $results[0]->address_components[$i]; - break; - } - } - } - } - $position["ville"] = $city->long_name; - return $position; - }else{ - return null; - } - } - $url = 'https://ilink-app.com/mobilebackendtest/interacted/MembersAction.php'; - $row = 1; - $nom = ""; - $address = ""; - $num_contact =""; - $n1=1; - $n2=0; - $ok = true; - $ct = 0; - $default_num = 33900004000; - $lastname = ""; - - if (($handle = fopen("https://ilink-app.com/backofficeiLinkTest/application/controllers/SIGUE.csv", "r")) !== FALSE) { - while (($data = fgetcsv($handle, 10000, ";")) !== FALSE) { - $num = count($data); - $num = 1; - //echo "

$num fields in line $row:

\n"; - for ($c=0; $c < $num; $c++) { - //echo $data[$c] . "
\n"; - if($n1 == 1){ - $address_temp = $data[$c]; - $n1++; - //echo $address_temp; - }elseif($n1 == 2){ - $infos = utf8_encode($data[$c]); - $inf_ctc = explode("Tél : 0", str_replace( chr( 194 ) . chr( 160 ), ' ', $infos )); - $num_contact = '+33'.str_replace(' ','',$inf_ctc[1]); - $nom = "Sigue ".$inf_ctc[0]; - - $network_name = "Sigue"; - $network_id = 186; - $email = 'sigue.fr@ilink-app.com'; - $code_super = "utC4SjNUHe"; - - $position = get_lat_lng(utf8_encode($address_temp)); - - $adress = $position["adresse"]; - $lat = $position['lat']; - $lng = $position['lng']; - - $fields = array( - "tag" => "member", - "type" => "create_geolocated_user", - "lastname" => addslashes($nom), - "phone" => $num_contact, - "phone_transaction" => '+'.$default_num, - "address" => $adress, - "lang" => "fr", - "email" => $email, - "password" => "1234", - "town" => ["id" => 3, "country_id" => 74, "name" => "France", "status" => 1], - "network" => ["id" => $network_id, "country_id" => 74, "name" => $network_name], - "latitude" => $lat, - "longitude" => $lng, - "category" => "geolocated", - "member" => $code_super - ); - $default_num++; - //echo json_encode($fields)."

\n"; - $this->db->trans_begin(); - $fields_string = http_build_query($fields); - $ch = curl_init(); - curl_setopt($ch, CURLOPT_URL, $url); - curl_setopt($ch, CURLOPT_POST, 1); - curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($fields)); - curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: text/plain')); - $result = curl_exec($ch); - curl_close($ch); - if ($this->db->trans_status() === FALSE) { - $this->db->trans_rollback(); - } else { - $this->db->trans_commit(); - } - $n1 = 1; - } - - /*$data[0] = utf8_encode($data[0]); - $data[0] = str_replace( chr( 194 ) . chr( 160 ), ' ', $data[0] ); - $inf = explode("+", str_replace( chr( 194 ) . chr( 160 ), ' ', $data[0] )); - $address = str_replace( chr( 194 ) . chr( 160 ), ' ', $data[0] ).' '.$inf[0]; - $contact_correct = str_replace('-','',$inf[1]); - $num_contact ='+'.$contact_correct; - echo "

$num fields in line $row:

\n"; - echo $lastname."

\n"; - echo json_encode($data)."

\n";*/ - } - $row++; - } - fclose($handle); - } - - /*$address = ""; - $position = get_lat_lng($address); - $lat = $position['lat']; - $lng = $position["lng"];*/ - - - } - - public function campagne_geocoding_dubai_western(){ - - function get_lat_lng($address){ - - $address_encoding = htmlentities(urlencode($address)); - $api = "AIzaSyClYkvZ3XUD9EKZv3Z2BLzkr7wBoV2aQ98"; - - $url = "https://maps.googleapis.com/maps/api/geocode/json?address=".$address_encoding."&key=".$api; - $contents = file_get_contents($url); - if($contents !== false){ - $contents = utf8_encode($contents); - $results = json_decode($contents); - $data = $results->results; - if($data != []){ - $lat = $data[0]->geometry->location->lat; - $lng = $data[0]->geometry->location->lng; - $adress = $data[0]->formatted_address; - $position["lat"] = $lat; - $position["lng"] = $lng; - $position["adresse"] = $address; - if ($data[0]) { - $num = sizeof($data[0]->address_components); - for ($i=0; $i<$num; $i++) { - $num2 = sizeof($data[0]->address_components[$i]->types); - for ($b=0;$b<$num2;$b++) { - if ($data[0]->address_components[$i]->types[$b] == "locality") { - $city= $data[0]->address_components[$i]; - break; - } - } - } - } - if(isset($city->long_name)){ - $position["ville"] = $city->long_name; - }else{ - $position["ville"] = null; - } - }else{ - $position = null; - } - return $position; - }else{ - return null; - } - } - $url = 'https://ilink-app.com/mobilebackendtest/interacted/MembersAction.php'; - $row = 1; - $nom = ""; - $address = ""; - $num_contact =""; - $n1=1; - $n2=2; - $ok = true; - $ct = 0; - $default_num = 97100001001; - $lastname = ""; - - if (($handle = fopen("https://ilink-app.com/backofficeiLinkTest/application/controllers/western_union_dubai.csv", "r")) !== FALSE) { - while (($data = fgetcsv($handle, 10000, ";")) !== FALSE) { - $num = count($data); - $num = 1; - //echo "

$num fields in line $row:

\n"; - for ($c=0; $c < $num; $c++) { - //echo $data[$c] . "
\n"; - if($n1 == 1){ - $nom = $data[$c]; - $n1++; - //echo $address_temp; - }elseif($n1 == 2){ - $infos = utf8_encode($data[$c]); - $inf_ctc = explode("+", str_replace( chr( 194 ) . chr( 160 ), ' ', $infos )); - - - $network_name = "Western Union"; - $network_id = 94; - $email = 'westernunion.ae@ilink-app.com'; - $code_super = "b4r2uqbyeN"; - //$town_id = $this->user_model->getTownId($town_name); - - $position = get_lat_lng(utf8_encode($inf_ctc[0])); - if($position == null){ - //$n1 = 1; - //break; - }else{ - - //echo $nom."

\n"; - //echo json_encode($inf_ctc)."

\n"; - } - $num_contact = '+'.str_replace('-','',$inf_ctc[1]); - - $adress = $position["adresse"]; - $lat = $position['lat']; - $lng = $position['lng']; - - echo 'Point '.$n2.' '.json_encode($position)."

\n"; - echo $nom."

\n"; - echo json_encode($inf_ctc)."

\n"; - $n2++; - - if($position['ville'] != null && $position['ville'] == 'Dubai'){ - $fields = array( - "tag" => "member", - "type" => "create_geolocated_user", - "lastname" => addslashes($nom), - "phone" => $num_contact, - "phone_transaction" => '+'.$default_num, - "address" => $adress, - "lang" => "fr", - "email" => $email, - "password" => "1234", - "town" => ["id" => 13, "country_id" => 233, "name" => "United Arab Emirates", "status" => 1], - "network" => ["id" => $network_id, "country_id" => 74, "name" => $network_name], - "latitude" => $lat, - "longitude" => $lng, - "category" => "geolocated", - "member" => $code_super - ); - $default_num++; - //echo json_encode($fields)."

\n"; - /*$this->db->trans_begin(); - $fields_string = http_build_query($fields); - $ch = curl_init(); - curl_setopt($ch, CURLOPT_URL, $url); - curl_setopt($ch, CURLOPT_POST, 1); - curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($fields)); - curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: text/plain')); - $result = curl_exec($ch); - curl_close($ch); - if ($this->db->trans_status() === FALSE) { - $this->db->trans_rollback(); - } else { - $this->db->trans_commit(); - }*/ - } - $n1 = 1; - } - - /*$data[0] = utf8_encode($data[0]); - $data[0] = str_replace( chr( 194 ) . chr( 160 ), ' ', $data[0] ); - $inf = explode("+", str_replace( chr( 194 ) . chr( 160 ), ' ', $data[0] )); - $address = str_replace( chr( 194 ) . chr( 160 ), ' ', $data[0] ).' '.$inf[0]; - $contact_correct = str_replace('-','',$inf[1]); - $num_contact ='+'.$contact_correct; - echo "

$num fields in line $row:

\n"; - echo $lastname."

\n"; - echo json_encode($data)."

\n";*/ - } - $row++; - } - fclose($handle); - } - - /*$address = ""; - $position = get_lat_lng($address); - $lat = $position['lat']; - $lng = $position["lng"];*/ - - - } - - public function campagne_geocoding_dubai_moneygram(){ - - function get_lat_lng($address){ - - $address_encoding = htmlentities(urlencode($address)); - $api = "AIzaSyClYkvZ3XUD9EKZv3Z2BLzkr7wBoV2aQ98"; - - $url = "https://maps.googleapis.com/maps/api/geocode/json?address=".$address_encoding."&key=".$api; - $contents = file_get_contents($url); - if($contents !== false){ - $contents = utf8_encode($contents); - $results = json_decode($contents); - $data = $results->results; - if($data != []){ - $lat = $data[0]->geometry->location->lat; - $lng = $data[0]->geometry->location->lng; - $adress = $data[0]->formatted_address; - $position["lat"] = $lat; - $position["lng"] = $lng; - $position["adresse"] = $address; - $position["ville"] = null; - if ($data[0]) { - $num = sizeof($data[0]->address_components); - for ($i=0; $i<$num; $i++) { - $num2 = sizeof($data[0]->address_components[$i]->types); - for ($b=0;$b<$num2;$b++) { - if ($data[0]->address_components[$i]->types[$b] == "locality") { - $city= $data[0]->address_components[$i]; - if($city->long_name){ - echo $address. "
\n"; - echo $city->long_name. "
\n"; - $position["ville"] = $city->long_name; - } - break; - } - } - } - } - - }else{ - $position = null; - } - return $position; - }else{ - return null; - } - } - $url = 'https://ilink-app.com/mobilebackendtest/interacted/MembersAction.php'; - $row = 1; - $nom = ""; - $address = ""; - $num_contact =""; - $n1=1; - $n2=1; - $ok = true; - $ct = 0; - $default_num = 97100006621; - $lastname = ""; - - if (($handle = fopen("https://ilink-app.com/backofficeiLinkTest/application/controllers/moneygram_dubai.csv", "r")) !== FALSE) { - while (($data = fgetcsv($handle, 10000, ";")) !== FALSE) { - $num = count($data); - $num = 1; - //echo "

$num fields in line $row:

\n"; - for ($c=0; $c < $num; $c++) { - //echo $data[$c] . "
\n"; - if($n1 == 1){ - $nom = $data[$c]; - $n1++; - //echo $address_temp; - }elseif($n1 == 2){ - $adress_temp = str_replace( chr( 194 ) . chr( 160 ), ' ',utf8_encode($data[$c])); - $n1++; - }elseif($n1 == 3){ - $adress_temp = $adress_temp.' '.str_replace( chr( 194 ) . chr( 160 ), ' ',utf8_encode($data[$c])); - $n1++; - }elseif($n1 == 4){ - /*$infos = utf8_encode($data[$c]); - $inf_ctc = explode("+", str_replace( chr( 194 ) . chr( 160 ), ' ', $infos ));*/ - - - $network_name = "MoneyGram"; - $network_id = 81; - $email = 'moneygram.ae@ilink-app.com'; - $code_super = "ynSAWooVMT"; - //$town_id = $this->user_model->getTownId($town_name); - echo json_encode(utf8_encode($adress_temp))."

\n"; - - $position = get_lat_lng(utf8_encode($adress_temp)); - - echo json_encode(utf8_encode($position))."

\n"; - - if($position == null){ - $n1 = 1; - break; - }else{ - $num_contact = $data[$c]; - if($num_contact == '971%'){ - $num_contact = '+'.$num_contact; - }else{ - $num_contact = '+971'.$num_contact; - } - } - - $adress = $position["adresse"]; - $lat = $position['lat']; - $lng = $position['lng']; - - - if($position['ville'] != null && $position['ville'] == 'Ajman'){ - $fields = array( - "tag" => "member", - "type" => "create_geolocated_user", - "lastname" => addslashes($nom), - "phone" => $num_contact, - "phone_transaction" => '+'.$default_num, - "address" => $adress, - "lang" => "fr", - "email" => $email, - "password" => "1234", - "town" => ["id" => 31, "country_id" => 233, "name" => "United Arab Emirates", "status" => 1], - "network" => ["id" => $network_id, "country_id" => 233, "name" => $network_name], - "latitude" => $lat, - "longitude" => $lng, - "category" => "geolocated", - "member" => $code_super - ); - //echo json_encode($fields)."

\n"; - $default_num++; - - /*$this->db->trans_begin(); - $fields_string = http_build_query($fields); - $ch = curl_init(); - curl_setopt($ch, CURLOPT_URL, $url); - curl_setopt($ch, CURLOPT_POST, 1); - curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($fields)); - curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: text/plain')); - $result = curl_exec($ch); - curl_close($ch); - if ($this->db->trans_status() === FALSE) { - $this->db->trans_rollback(); - } else { - $this->db->trans_commit(); - }*/ - } - - $n1 = 1; - } - - /*$data[0] = utf8_encode($data[0]); - $data[0] = str_replace( chr( 194 ) . chr( 160 ), ' ', $data[0] ); - $inf = explode("+", str_replace( chr( 194 ) . chr( 160 ), ' ', $data[0] )); - $address = str_replace( chr( 194 ) . chr( 160 ), ' ', $data[0] ).' '.$inf[0]; - $contact_correct = str_replace('-','',$inf[1]); - $num_contact ='+'.$contact_correct; - echo "

$num fields in line $row:

\n"; - echo $lastname."

\n"; - echo json_encode($data)."

\n";*/ - } - $row++; - } - fclose($handle); - } - - /*$address = ""; - $position = get_lat_lng($address); - $lat = $position['lat']; - $lng = $position["lng"];*/ - - - } - - public function campagne_geocoding_wari(){ - - function get_lat_lng($address){ - - $address_encoding = htmlentities(urlencode($address)); - $api = "AIzaSyClYkvZ3XUD9EKZv3Z2BLzkr7wBoV2aQ98"; - - $url = "https://maps.googleapis.com/maps/api/geocode/json?address=".$address_encoding."&key=".$api; - $contents = file_get_contents($url); - if($contents !== false){ - $contents = utf8_encode($contents); - $results = json_decode($contents); - //echo json_encode($results->status). "
\n"; - if($results->status == "OK"){ - $data = $results->results; - //echo json_encode($url). "
\n"; - //echo json_encode($contents). "
\n"; - $lat = $data[0]->geometry->location->lat; - $lng = $data[0]->geometry->location->lng; - $adress = $data[0]->formatted_address; - //$ville = $data[0]->address_components[2]->long_name; - $position["lat"] = $lat; - $position["lng"] = $lng; - $position["adresse"] = $address; - $results = $data; - - /*if ($results[0]) { - $num = sizeof($results[0]->address_components); - for ($i=0; $i<$num; $i++) { - $num2 = sizeof($results[0]->address_components[$i]->types); - for ($b=0;$b<$num2;$b++) { - if ($results[0]->address_components[$i]->types[$b] == "locality") { - $city= $results[0]->address_components[$i]; - break; - } - } - } - }*/ - //$position["ville"] = $city->long_name; - return $position; - }else{ - return null; - } - }else{ - return null; - } - } - $url = 'https://ilink-app.com/mobilebackendtest/interacted/MembersAction.php'; - $row = 1; - $nom = ""; - $address = ""; - $num_contact =""; - $n1=1; - $n2=1; - $ok = true; - $ct = 0; - $default_num = 33900006121; - $lastname = ""; - - if (($handle = fopen("https://ilink-app.com/backofficeiLinkTest/application/controllers/WARI_paris.csv", "r")) !== FALSE) { - while (($data = fgetcsv($handle, 10000, ";")) !== FALSE) { - $num = count($data); - $num = 1; - //echo "

$num fields in line $row:

\n"; - if($row>516){ - for ($c=0; $c < $num; $c++) { - //echo $data[$c] . "
\n"; - - if($n1 == 1){ - $nom = $data[$c]; - $n1++; - - }elseif($n1==2){ - $address_temp = $data[$c]; - $n1++; - }elseif($n1 == 3){ - $n1++; - }elseif($n1 == 4){ - $phone = $data[$c]; - $num_contact = str_replace(' ', '', str_replace('00', '+', $phone)); - - $network_name = "Wari"; - $network_id = 160; - $email = 'wari.fr@ilink-app.com'; - $code_super = "h6pLJn8tcb"; - - $position = get_lat_lng(utf8_encode($address_temp)); - if($position == null){ - $n1 = 1; - break; - } - $lat = $position['lat']; - $lng = $position['lng']; - //$ville = $position['ville']; - $address = $position['adresse']; - //$town_id = $this->user_model->getTownId($ville); - - $fields = array( - "tag" => "member", - "type" => "create_geolocated_user", - "lastname" => addslashes($nom), - "phone" => $num_contact, - "phone_transaction" => '+'.$default_num, - "address" => $address, - "lang" => "fr", - "email" => $email, - "password" => "1234", - "town" => ["id" => 3, "country_id" => 74, "name" => "France", "status" => 1], - "network" => ["id" => $network_id, "country_id" => 74, "name" => $network_name], - "latitude" => $lat, - "longitude" => $lng, - "category" => "geolocated", - "member" => $code_super - ); - - $default_num++; - //echo 'Groupe '.$n2."

\n"; - //echo json_encode($fields)."

\n"; - $n2++; - $this->db->trans_begin(); - $fields_string = http_build_query($fields); - $ch = curl_init(); - curl_setopt($ch, CURLOPT_URL, $url); - curl_setopt($ch, CURLOPT_POST, 1); - curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($fields)); - curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: text/plain')); - $result = curl_exec($ch); - curl_close($ch); - if ($this->db->trans_status() === FALSE) { - $this->db->trans_rollback(); - } else { - $this->db->trans_commit(); - } - $n1 = 1; - } - - /*$data[0] = utf8_encode($data[0]); - $data[0] = str_replace( chr( 194 ) . chr( 160 ), ' ', $data[0] ); - $inf = explode("+", str_replace( chr( 194 ) . chr( 160 ), ' ', $data[0] )); - $address = str_replace( chr( 194 ) . chr( 160 ), ' ', $data[0] ).' '.$inf[0]; - $contact_correct = str_replace('-','',$inf[1]); - $num_contact ='+'.$contact_correct; - echo "

$num fields in line $row:

\n"; - echo $lastname."

\n"; - echo json_encode($data)."

\n";*/ - } - } - $row++; - } - fclose($handle); - } - - /*$address = ""; - $position = get_lat_lng($address); - $lat = $position['lat']; - $lng = $position["lng"];*/ - - - } - - public function campagne_geocoding_express_union(){ - - function get_lat_lng($address){ - - $address_encoding = htmlentities(urlencode($address)); - $api = "AIzaSyClYkvZ3XUD9EKZv3Z2BLzkr7wBoV2aQ98"; - - $url = "https://maps.googleapis.com/maps/api/geocode/json?address=".$address_encoding."&key=".$api; - $contents = file_get_contents($url); - if($contents !== false){ - $contents = utf8_encode($contents); - $results = json_decode($contents); - $data = $results->results; - $lat = $data[0]->geometry->location->lat; - $lng = $data[0]->geometry->location->lng; - $adress = $data[0]->formatted_address; - $ville = $data[0]->address_components[2]->long_name; - $position["lat"] = $lat; - $position["lng"] = $lng; - $position["adresse"] = $address; - $results = $data; - - if ($results[0]) { - $num = sizeof($results[0]->address_components); - for ($i=0; $i<$num; $i++) { - $num2 = sizeof($results[0]->address_components[$i]->types); - for ($b=0;$b<$num2;$b++) { - if ($results[0]->address_components[$i]->types[$b] == "locality") { - $city= $results[0]->address_components[$i]; - break; - } - } - } - } - $position["ville"] = $city->long_name; - return $position; - }else{ - return null; - } - } - $url = 'https://ilink-app.com/mobilebackendtest/interacted/MembersAction.php'; - $row = 1; - $nom = ""; - $address = ""; - $num_contact =""; - $n1=1; - $n2=0; - $ok = true; - $ct = 0; - $default_num = 33900007000; - $lastname = ""; - - if (($handle = fopen("https://ilink-app.com/backofficeiLinkTest/application/controllers/Express_union.csv", "r")) !== FALSE) { - while (($data = fgetcsv($handle, 10000, ";")) !== FALSE) { - $num = count($data); - //echo "

$num fields in line $row:

\n"; - for ($c=0; $c < $num; $c++) { - //echo $data[$c] . "
\n"; - if($n1 == 1){ - $nom = $data[$c]; - $n1++; - //echo $address_temp; - }elseif($n1 == 2){ - $address_temp = $data[$c]; - $n1++; - }elseif($n1 == 3){ - $address_temp = $address_temp.', '.$data[$c]; - $n1++; - }elseif($n1 == 4){ - $num_contact = '+33'.str_replace(' ','',$data[$c]); - - $network_name = "Express Union"; - $network_id = 99; - $email = 'expressunion.fr@ilink-app.com'; - $code_super = "fUdUbrsUcr"; - - $position = get_lat_lng(utf8_encode($address_temp)); - $lat = $position['lat']; - $lng = $position['lng']; - $address = str_replace( chr( 194 ) . chr( 160 ), ' ', $position['adresse']); - - $fields = array( - "tag" => "member", - "type" => "create_geolocated_user", - "lastname" => addslashes($nom), - "phone" => $num_contact, - "phone_transaction" => '+'.$default_num, - "address" => $address, - "lang" => "fr", - "email" => $email, - "password" => "1234", - "town" => ["id" => 3, "country_id" => 74, "name" => "France", "status" => 1], - "network" => ["id" => $network_id, "country_id" => 74, "name" => $network_name], - "latitude" => $lat, - "longitude" => $lng, - "category" => "geolocated", - "member" => $code_super - ); - $default_num++; - //echo var_dump($fields)."

\n"; - $this->db->trans_begin(); - $fields_string = http_build_query($fields); - $ch = curl_init(); - curl_setopt($ch, CURLOPT_URL, $url); - curl_setopt($ch, CURLOPT_POST, 1); - curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($fields)); - curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: text/plain')); - $result = curl_exec($ch); - curl_close($ch); - if ($this->db->trans_status() === FALSE) { - $this->db->trans_rollback(); - } else { - $this->db->trans_commit(); - } - $n1 = 1; - } - - /*$data[0] = utf8_encode($data[0]); - $data[0] = str_replace( chr( 194 ) . chr( 160 ), ' ', $data[0] ); - $inf = explode("+", str_replace( chr( 194 ) . chr( 160 ), ' ', $data[0] )); - $address = str_replace( chr( 194 ) . chr( 160 ), ' ', $data[0] ).' '.$inf[0]; - $contact_correct = str_replace('-','',$inf[1]); - $num_contact ='+'.$contact_correct; - echo "

$num fields in line $row:

\n"; - echo $lastname."

\n"; - echo json_encode($data)."

\n";*/ - } - $row++; - } - fclose($handle); - } - - /*$address = ""; - $position = get_lat_lng($address); - $lat = $position['lat']; - $lng = $position["lng"];*/ - - - } - - public function campagne_geocoding_juba_dubai(){ - - function get_lat_lng($address){ - - $address_encoding = htmlentities(urlencode($address)); - $api = "AIzaSyClYkvZ3XUD9EKZv3Z2BLzkr7wBoV2aQ98"; - - $url = "https://maps.googleapis.com/maps/api/geocode/json?address=".$address_encoding."&key=".$api; - $contents = file_get_contents($url); - if($contents !== false){ - $contents = utf8_encode($contents); - $results = json_decode($contents); - $data = $results->results; - $lat = $data[0]->geometry->location->lat; - $lng = $data[0]->geometry->location->lng; - $adress = $data[0]->formatted_address; - $ville = $data[0]->address_components[2]->long_name; - $position["lat"] = $lat; - $position["lng"] = $lng; - $position["adresse"] = $address; - $results = $data; - - if ($results[0]) { - $num = sizeof($results[0]->address_components); - for ($i=0; $i<$num; $i++) { - $num2 = sizeof($results[0]->address_components[$i]->types); - for ($b=0;$b<$num2;$b++) { - if ($results[0]->address_components[$i]->types[$b] == "locality") { - $city= $results[0]->address_components[$i]; - break; - } - } - } - } - $position["ville"] = $city->long_name; - return $position; - }else{ - return null; - } - } - $url = 'https://ilink-app.com/mobilebackendtest/interacted/MembersAction.php'; - $row = 1; - $nom = ""; - $address = ""; - $num_contact =""; - $default_num = 97100002002; - - $network_name = "Juba"; - $network_id = 157; - $email = 'juba.ae@ilink-app.com'; - $code_super = "PoGOE9Fn2J"; - - $nom = 'INTERNATIONAL DEVELOPMENT EXCHANGE'; - $address = 'Sharjah dawara saaa, United Arab Emirates'; - $num_contact = '+971505547229'; - - $position = get_lat_lng($address); - $lat = $position['lat']; - $lng = $position['lng']; - $ville = $position['ville']; - $address = $position['adresse']; - //$town_id = $this->user_model->getTownId($ville); - - - $fields = array( - "tag" => "member", - "type" => "create_geolocated_user", - "lastname" => addslashes($nom), - "phone" => $num_contact, - "phone_transaction" => '+'.$default_num, - "address" => addslashes($address), - "lang" => "fr", - "email" => $email, - "password" => "1234", - "town" => ["id" => 30, "country_id" => 233, "name" => "United Arab Emirates", "status" => 1], - "network" => ["id" => $network_id, "country_id" => 233, "name" => $network_name], - "latitude" => $lat, - "longitude" => $lng, - "category" => "geolocated", - "member" => $code_super - ); - $default_num++; - //echo json_encode($fields)."

\n"; - $this->db->trans_begin(); - $fields_string = http_build_query($fields); - $ch = curl_init(); - curl_setopt($ch, CURLOPT_URL, $url); - curl_setopt($ch, CURLOPT_POST, 1); - curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($fields)); - curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: text/plain')); - $result = curl_exec($ch); - curl_close($ch); - if ($this->db->trans_status() === FALSE) { - $this->db->trans_rollback(); - } else { - $this->db->trans_commit(); - } - - } - - public function campagne_geocoding_dubai_ria(){ - - function get_lat_lng($address){ - - $address_encoding = htmlentities(urlencode($address)); - $api = "AIzaSyClYkvZ3XUD9EKZv3Z2BLzkr7wBoV2aQ98"; - - $url = "https://maps.googleapis.com/maps/api/geocode/json?address=".$address_encoding."&key=".$api; - $contents = file_get_contents($url); - if($contents !== false){ - $contents = utf8_encode($contents); - $results = json_decode($contents); - $data = $results->results; - if($data != []){ - $lat = $data[0]->geometry->location->lat; - $lng = $data[0]->geometry->location->lng; - $adress = $data[0]->formatted_address; - $position["lat"] = $lat; - $position["lng"] = $lng; - $position["adresse"] = $address; - $position["ville"] = null; - if ($data[0]) { - $num = sizeof($data[0]->address_components); - for ($i=0; $i<$num; $i++) { - $num2 = sizeof($data[0]->address_components[$i]->types); - for ($b=0;$b<$num2;$b++) { - if ($data[0]->address_components[$i]->types[$b] == "locality") { - $city= $data[0]->address_components[$i]; - if($city->long_name){ - //echo $city->long_name. "
\n"; - $position["ville"] = $city->long_name; - } - break; - } - } - } - } - - }else{ - $position = null; - } - return $position; - }else{ - return null; - } - } - $url = 'https://ilink-app.com/mobilebackendtest/interacted/MembersAction.php'; - $row = 1; - $nom = ""; - $address = ""; - $num_contact =""; - $n1=1; - $n2=1; - $ok = true; - $ct = 0; - $default_num = 97100003010; - $lastname = ""; - - if (($handle = fopen("https://ilink-app.com/backofficeiLinkTest/application/controllers/ria_dubai.csv", "r")) !== FALSE) { - while (($data = fgetcsv($handle, 10000, ";")) !== FALSE) { - $num = count($data); - $num = 1; - //echo "

$num fields in line $row:

\n"; - for ($c=0; $c < $num; $c++) { - //echo $data[$c] . "
\n"; - if($n1 == 1){ - $nom = $data[$c]; - $n1++; - //echo $address_temp; - }elseif($n1 == 2){ - $infos = utf8_encode($data[$c]); - $adress1 = str_replace( chr( 194 ) . chr( 160 ), ' ', $infos ); - $n1++; - }elseif($n1 == 3){ - $infos = utf8_encode($data[$c]); - $adress_temp = $adress1.' '.str_replace( chr( 194 ) . chr( 160 ), ' ', $infos ); - - - $network_name = "Ria"; - $network_id = 183; - $email = 'ria.ae@ilink-app.com'; - $code_super = "z3GRV23fOV"; - //$town_id = $this->user_model->getTownId($town_name); - - $position = get_lat_lng($adress_temp); - $num_contact = '+'.$default_num; - $adress = $position["adresse"]; - $lat = $position['lat']; - $lng = $position['lng']; - - if($position['ville'] != null && $position['ville'] == 'Sharjah'){ - //echo "

fields number $n2:

\n"; - $n2++; - $fields = array( - "tag" => "member", - "type" => "create_geolocated_user", - "lastname" => addslashes($nom), - "phone" => $num_contact, - "phone_transaction" => '+'.$default_num, - "address" => $adress, - "lang" => "fr", - "email" => $email, - "password" => "1234", - "town" => ["id" => 30, "country_id" => 233, "name" => "United Arab Emirates", "status" => 1], - "network" => ["id" => $network_id, "country_id" => 74, "name" => $network_name], - "latitude" => $lat, - "longitude" => $lng, - "category" => "geolocated", - "member" => $code_super - ); - $default_num++; - - //echo json_encode($fields)."

\n"; - $this->db->trans_begin(); - $fields_string = http_build_query($fields); - $ch = curl_init(); - curl_setopt($ch, CURLOPT_URL, $url); - curl_setopt($ch, CURLOPT_POST, 1); - curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($fields)); - curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: text/plain')); - $result = curl_exec($ch); - curl_close($ch); - if ($this->db->trans_status() === FALSE) { - $this->db->trans_rollback(); - } else { - $this->db->trans_commit(); - } - } - $n1 = 1; - } - - /*$data[0] = utf8_encode($data[0]); - $data[0] = str_replace( chr( 194 ) . chr( 160 ), ' ', $data[0] ); - $inf = explode("+", str_replace( chr( 194 ) . chr( 160 ), ' ', $data[0] )); - $address = str_replace( chr( 194 ) . chr( 160 ), ' ', $data[0] ).' '.$inf[0]; - $contact_correct = str_replace('-','',$inf[1]); - $num_contact ='+'.$contact_correct; - echo "

$num fields in line $row:

\n"; - echo $lastname."

\n"; - echo json_encode($data)."

\n";*/ - } - $row++; - } - fclose($handle); - } - - /*$address = ""; - $position = get_lat_lng($address); - $lat = $position['lat']; - $lng = $position["lng"];*/ - - - } - - public function campagne_geocoding_dubai_small_world(){ - - function get_lat_lng($address){ - - $address_encoding = htmlentities(urlencode($address)); - $api = "AIzaSyClYkvZ3XUD9EKZv3Z2BLzkr7wBoV2aQ98"; - - $url = "https://maps.googleapis.com/maps/api/geocode/json?address=".$address_encoding."&key=".$api; - $contents = file_get_contents($url); - if($contents !== false){ - $contents = utf8_encode($contents); - $results = json_decode($contents); - $data = $results->results; - if($data != []){ - $lat = $data[0]->geometry->location->lat; - $lng = $data[0]->geometry->location->lng; - $adress = $data[0]->formatted_address; - $position["lat"] = $lat; - $position["lng"] = $lng; - $position["adresse"] = $address; - $position["ville"] = null; - if ($data[0]) { - $num = sizeof($data[0]->address_components); - for ($i=0; $i<$num; $i++) { - $num2 = sizeof($data[0]->address_components[$i]->types); - for ($b=0;$b<$num2;$b++) { - if ($data[0]->address_components[$i]->types[$b] == "locality") { - $city= $data[0]->address_components[$i]; - if($city->long_name){ - //echo $address. "
\n"; - //echo $city->long_name. "
\n"; - $position["ville"] = $city->long_name; - } - break; - } - } - } - } - - }else{ - $position = null; - } - return $position; - }else{ - return null; - } - } - $url = 'https://ilink-app.com/mobilebackendtest/interacted/MembersAction.php'; - $row = 1; - $nom = ""; - $address = ""; - $num_contact =""; - $n1=1; - $n2=1; - $ok = true; - $ct = 0; - $default_num = 97100005301; - $lastname = ""; - - if (($handle = fopen("https://ilink-app.com/backofficeiLinkTest/application/controllers/small_world_dubai.csv", "r")) !== FALSE) { - while (($data = fgetcsv($handle, 10000, ";")) !== FALSE) { - $num = count($data); - $num = 1; - //echo "

$num fields in line $row:

\n"; - for ($c=0; $c < $num; $c++) { - //echo $data[$c] . "
\n"; - if($n1 == 1){ - $nom = $data[$c]; - $n1++; - //echo $address_temp; - }elseif($n1 == 2){ - $infos = utf8_encode($data[$c]); - $adress_temp = str_replace( chr( 194 ) . chr( 160 ), ' ', $infos ); - $n1++; - }elseif($n1 == 3){ - $infos = utf8_encode($data[$c]); - $inf = explode('/',$infos); - if(isset($inf[1])){ - $infos = $inf[0]; - }else{ - - } - $num_contact = str_replace('-','',str_replace( 'CONTACT00', '+', $infos )); - $num_contact = str_replace( 'CONTACT04', '+9714', $num_contact); - $num_contact = str_replace( 'CONTACT06', '+9716', $num_contact); - $num_contact = str_replace( 'CONTACT+9', '+9', $num_contact); - $num_contact = str_replace( 'CONTACT9', '+9', $num_contact); - $num_contact = str_replace( 'CONTACTEZ LE00', '+', $num_contact); - $num_contact = str_replace( ' ', '', $num_contact); - - - $network_name = "Small World"; - $network_id = 146; - $email = 'smallworld.ae@ilink-app.com'; - $code_super = "L6WtcGgYrh"; - //$town_id = $this->user_model->getTownId($town_name); - - $position = get_lat_lng($adress_temp); - $adress = $position["adresse"]; - $lat = $position['lat']; - $lng = $position['lng']; - - if($position['ville'] != null && $position['ville'] == 'Ajman'){ - //echo "

fields number $n2:

\n"; - //echo $position['ville']."

\n"; - $n2++; - $fields = array( - "tag" => "member", - "type" => "create_geolocated_user", - "lastname" => addslashes($nom), - "phone" => $num_contact, - "phone_transaction" => '+'.$default_num, - "address" => $adress, - "lang" => "fr", - "email" => $email, - "password" => "1234", - "town" => ["id" => 31, "country_id" => 233, "name" => "United Arab Emirates", "status" => 1], - "network" => ["id" => $network_id, "country_id" => 74, "name" => $network_name], - "latitude" => $lat, - "longitude" => $lng, - "category" => "geolocated", - "member" => $code_super - ); - $default_num++; - - //echo json_encode($fields)."

\n"; - //var_dump($fields); - $this->db->trans_begin(); - $fields_string = http_build_query($fields); - $ch = curl_init(); - curl_setopt($ch, CURLOPT_URL, $url); - curl_setopt($ch, CURLOPT_POST, 1); - curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($fields)); - curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: text/plain')); - $result = curl_exec($ch); - curl_close($ch); - if ($this->db->trans_status() === FALSE) { - $this->db->trans_rollback(); - } else { - $this->db->trans_commit(); - } - } - $n1 = 1; - } - - /*$data[0] = utf8_encode($data[0]); - $data[0] = str_replace( chr( 194 ) . chr( 160 ), ' ', $data[0] ); - $inf = explode("+", str_replace( chr( 194 ) . chr( 160 ), ' ', $data[0] )); - $address = str_replace( chr( 194 ) . chr( 160 ), ' ', $data[0] ).' '.$inf[0]; - $contact_correct = str_replace('-','',$inf[1]); - $num_contact ='+'.$contact_correct; - echo "

$num fields in line $row:

\n"; - echo $lastname."

\n"; - echo json_encode($data)."

\n";*/ - } - $row++; - } - fclose($handle); - } - - /*$address = ""; - $position = get_lat_lng($address); - $lat = $position['lat']; - $lng = $position["lng"];*/ - - - } - - public function anbg(){ - $url = "https://www.anbg.ga/Result-CT/traitement-recherche.php?recherche=FRA&choix=Pays"; - $contents = file_get_contents($url); - echo($contents); - } - - -} \ No newline at end of file +load->model('insert_model'); + $this->load->model('user_model'); + } + + public function index() + { + $url = 'https://ilink-app.com/mobilebackend/interacted/MembersAction.php'; + + $row = 1; + if (($handle = fopen("https://ilink-app.com/backofficebeta/application/controllers/BASE.csv", "r")) !== FALSE) { + while (($data = fgetcsv($handle, 1, ",")) !== FALSE ) { + $num = count($data); + echo "

$num fields in line $row:

\n"; + if($row==1) { + $webhost = 'localhost'; + $webusername = 'root'; + $webpassword = 'vps@2017GA'; + $webdbname = 'ilink_beta'; + $webcon = mysqli_connect($webhost, $webusername, $webpassword, $webdbname); + if (mysqli_connect_errno()) + { + echo 'Failed to connect to MySQL: ' . mysqli_connect_error(); + } + $results = mysqli_query($webcon, "SELECT phone FROM `users` WHERE `country_code`='Gabon' and network='Libertis' and `category`='geolocated'"); + + $mobhost = 'localhost'; + $mobusername = 'root'; + $mobpassword = 'vps@2017GA'; + $mobdbname = 'iLink_test'; + $mobcon = mysqli_connect($mobhost, $mobusername, $mobpassword, $mobdbname); + if (mysqli_connect_errno()) + { + echo 'Failed to connect to MySQL: ' . mysqli_connect_error(); + } + if($results) { + while ($row = mysqli_fetch_array($results)) { + + //$user_info = explode(";", $data[$c]); + //echo $data[$c] . "
\n"; + foreach ($row as $key => $val) { + $row[$key] = mysqli_real_escape_string($mobcon, $row[$key]); + } + $fields = null; + if ($row['country_code'] == 'Cameroun') { + + } elseif ($row['country_code'] == 'France') { + + } elseif ($row['country_code'] == 'Gabon') { + $fields = array( + "tag" => "member", + "type" => "create_geolocated_user", + "lastname" => addslashes($row['lastname']), + "phone" => $row['phone'], + "phone_transaction" => $row['phone'], + "address" => $row['firstname'], + "lang" => "fr", + "email" => $row['email'], + "password" => "1234", + "town" => ["id" => 1, "country_id" => 78, "name" => "Gabon", "status" => 1], + "network" => ["id" => 14, "country_id" => 78, "name" => "Mobicash"], + "latitude" => $row['latitude'], + "longitude" => $row['longitude'], + "category" => "super", + "member" => "lBkGLqdC7f" + ); + } + + + $fields_string = http_build_query($fields); + //url-ify the data for the POST + /*foreach ($fields as $key => $value) { + $fields_string .= $key . '=' . $value . '&'; + } + rtrim($fields_string, '&');*/ + + $ch = curl_init(); + + + curl_setopt($ch, CURLOPT_URL, $url); + curl_setopt($ch, CURLOPT_POST, 1); + curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($fields)); + curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: text/plain')); + + //execute post + $result = curl_exec($ch); + + //close connection + curl_close($ch); + + //var_dump($fields_string); + + //echo json_encode($fields) . "
\n"; + + } + }else{ + echo json_encode($results); + } + } + $row++; + } + fclose($handle); + } + + for ($c = 6001; $c <= 7873; $c++) { + $query = $this->db->query("SELECT phone,transactionNumber FROM networks_agents WHERE agent_id=".$c); + if($query->num_rows()>0){ + echo "N° ".$c." "."
\n"; + $update_phone = str_replace('+24100', '+2410', $query->row()->phone); + $update_transactionNumber = str_replace('+24100', '+2410',$query->row()->transactionNumber); + + $this->db->trans_start(); + $this->db->query("UPDATE networks_agents SET phone='".$update_phone."' WHERE agent_id ='".$c."'"); + $this->db->query("UPDATE networks_agents SET transactionNumber='".$update_transactionNumber."' WHERE agent_id ='".$c."'"); + $this->db->trans_complete(); + + if ($this->db->trans_status() === FALSE) + { + echo "Echec ligne n° ".$c; + }else{ + echo "Transaction réussite ligne n° ".$c; + } + echo "
\n"; + }else{ + echo "something wrong"; + } + } + } + + public function getDistincQuartier(){ + + $row = 1; + $count = 1; + if (($handle = fopen("https://ilink-app.com/backofficebeta/application/controllers/BASE_AGENT_TEST.csv", "r")) !== FALSE) { + while (($data = fgetcsv($handle, 1000, ",")) !== FALSE ) { + $num = count($data); + //echo "

$num fields in line $row:

\n"; + if($row>2) { + + for ($c = 0; $c < $num; $c++) { + $user_info = explode(";", $data[$c]); + //echo $data[$c] . "
\n"; + if( stristr($user_info[3], "akebe")) { + echo "N° ".$count; + echo "

\n"; + $count++; + + $fields = array( + "username" => addslashes($user_info[0]), + "phone" => "+241" . str_replace(' ', '', $user_info[1]), + "phone_transaction" => "+241" . str_replace(' ', '', $user_info[2]), + "address" => $user_info[3], + "lang" => "fr" + ); + + echo json_encode($fields); + } + + } + } + $row++; + } + fclose($handle); + } + } + + public function update_network(){ + + $webhost = 'localhost'; + $webusername = 'root'; + $webpassword = 'vps@2017GA'; + $webdbname = 'ilink_beta'; + $webcon = mysqli_connect($webhost, $webusername, $webpassword, $webdbname); + if (mysqli_connect_errno()) + { + echo 'Failed to connect to MySQL: ' . mysqli_connect_error(); + } + $results = mysqli_query($webcon, "SELECT phone FROM `users` WHERE `country_code`='Gabon' and network='Libertis' and `category`='geolocated'"); + + $mobhost = 'localhost'; + $mobusername = 'root'; + $mobpassword = 'vps@2017GA'; + $mobdbname = 'iLink_test'; + $mobcon = mysqli_connect($mobhost, $mobusername, $mobpassword, $mobdbname); + if (mysqli_connect_errno()) + { + echo 'Failed to connect to MySQL: ' . mysqli_connect_error(); + } + $res1 = null; + $code_parrain ='LADreUhH5S'; + $id_network =77; + $this->db->trans_begin(); + if($results) { + while ($row = mysqli_fetch_array($results)) { + + foreach ($row as $key => $val) { + $row[$key] = mysqli_real_escape_string($mobcon, $row[$key]); + } + $res1 = $this->user_model->update_networkAgent($row['phone'],$id_network); + if($res1){ + $id_codeG = $this->user_model->getCodeG($row['phone']); + if($id_codeG!=false){ + $res2 = $this->user_model->updateCodeG($id_codeG,$code_parrain); + if($res2){ + echo "id du code Ok\n"; + }else{ + echo "erreur\n"; + } + } + } + if($this->db->trans_status() === FALSE){ + $this->db->trans_rollback(); + echo "transaction annulée"; + }else{ + $this->db->trans_commit(); + echo "Completed"; + } + + } + + + }else{ + echo json_encode($results); + } + + } + + public function insert_super(){ + + $url = 'https://ilink-app.com/mobilebackend/interacted/MembersAction.php'; + + $row = 1; + if (($handle = fopen("https://ilink-app.com/backofficebeta/application/controllers/BASE.csv", "r")) !== FALSE) { + while (($data = fgetcsv($handle, 1, ",")) !== FALSE ) { + $num = count($data); + echo "

$num fields in line $row:

\n"; + if($row==1) { + $webhost = 'localhost'; + $webusername = 'root'; + $webpassword = 'vps@2017GA'; + $webdbname = 'ilink_beta'; + $webcon = mysqli_connect($webhost, $webusername, $webpassword, $webdbname); + if (mysqli_connect_errno()) + { + echo 'Failed to connect to MySQL: ' . mysqli_connect_error(); + } + $results = mysqli_query($webcon, "SELECT phone FROM `users` WHERE `country_code`='Gabon' and network='Libertis' and `category`='geolocated'"); + + $mobhost = 'localhost'; + $mobusername = 'root'; + $mobpassword = 'vps@2017GA'; + $mobdbname = 'iLink_test'; + $mobcon = mysqli_connect($mobhost, $mobusername, $mobpassword, $mobdbname); + if (mysqli_connect_errno()) + { + echo 'Failed to connect to MySQL: ' . mysqli_connect_error(); + } + if($results) { + while ($row = mysqli_fetch_array($results)) { + + //$user_info = explode(";", $data[$c]); + //echo $data[$c] . "
\n"; + foreach ($row as $key => $val) { + $row[$key] = mysqli_real_escape_string($mobcon, $row[$key]); + } + $fields = null; + if ($row['country_code'] == 'Cameroun') { + + } elseif ($row['country_code'] == 'France') { + + } elseif ($row['country_code'] == 'Gabon') { + $fields = array( + "tag" => "member", + "type" => "create_geolocated_user", + "lastname" => addslashes($row['lastname']), + "phone" => $row['phone'], + "phone_transaction" => $row['phone'], + "address" => $row['firstname'], + "lang" => "fr", + "email" => $row['email'], + "password" => "1234", + "town" => ["id" => 1, "country_id" => 78, "name" => "Gabon", "status" => 1], + "network" => ["id" => 14, "country_id" => 78, "name" => "Mobicash"], + "latitude" => $row['latitude'], + "longitude" => $row['longitude'], + "category" => "super", + "member" => "lBkGLqdC7f" + ); + } + + + $fields_string = http_build_query($fields); + //url-ify the data for the POST + /*foreach ($fields as $key => $value) { + $fields_string .= $key . '=' . $value . '&'; + } + rtrim($fields_string, '&');*/ + + $ch = curl_init(); + + + curl_setopt($ch, CURLOPT_URL, $url); + curl_setopt($ch, CURLOPT_POST, 1); + curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($fields)); + curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: text/plain')); + + //execute post + $result = curl_exec($ch); + + //close connection + curl_close($ch); + + //var_dump($fields_string); + + //echo json_encode($fields) . "
\n"; + + } + }else{ + echo json_encode($results); + } + } + $row++; + } + fclose($handle); + } + + } + + public function creation_super(){ + + $data['message'] = "Login first!"; + $this->load->view('generer_super', $data); + } + + public function insert_super_ag(){ + + $url = 'https://ilink-app.com/mobilebackendtestA/interacted/MembersAction.php'; + + if(isset($_POST)) + { + $num_transac = (int)$this->input->post('transaction'); + $phone = (int)$this->input->post('telephone'); + $end = 1; + + $network = $this->user_model->getGabonNetwork(); + + + foreach ($network->result() AS $row){ + + $code_hyper = $this->user_model->getCodeHyper(77); + // var_dump($code_hyper); + + if($code_hyper!=false){ + $nom = $this->input->post('nom'); + $fields = array( + "tag" => "member", + "type" => "create_geolocated_user", + "lastname" => addslashes($nom), + "phone" => $phone, + "phone_transaction" => $num_transac, + "address" => "Awendjé", + "lang" => "fr", + "email" => str_replace(' ', '', strtolower($row->name))."@ilink-app.com", + "password" => "1234", + "town" => ["id" => 1, "country_id" => 78, "name" => "Gabon", "status" => 1], + "network" => ["id" => $row->id, "country_id" => 78, "name" => $row->name], + "latitude" => -1, + "longitude" => -1, + "category" => "super", + "member" => $code_hyper + ); + + $fields_string = http_build_query($fields); + $ch = curl_init(); + curl_setopt($ch, CURLOPT_URL, $url); + curl_setopt($ch, CURLOPT_POST, 1); + curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($fields)); + curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: text/plain')); + $result = curl_exec($ch); + curl_close($ch); + + //var_dump($fields_string); + $num_transac++; + $phone++; + } + } + + } + } + + public function insert_airtel_mobi(){ + $url = 'https://ilink-app.com/mobilebackendtest/interacted/MembersAction.php'; + + if(isset($_POST)) + { + $num_transac = (int)$this->input->post('transaction'); + $phone = (int)$this->input->post('telephone'); + $end = 1; + + $code_hyper = 'XaU1lVW5DO'; + $nom = $this->input->post('nom'); + $email ="airtelmoney.ga@ilink-app.com"; + $idNetwork = 14; + $nameNetwork = "Airtel Money"; + + for ($i = 1; $i <= 2; $i++){ + + + $fields = array( + "tag" => "member", + "type" => "create_geolocated_user", + "lastname" => addslashes($nom), + "phone" => $phone, + "phone_transaction" => $num_transac, + "address" => "Awendjé", + "lang" => "fr", + "email" => $email, + "password" => "1234", + "town" => ["id" => 1, "country_id" => 78, "name" => "Gabon", "status" => 1], + "network" => ["id" => $idNetwork, "country_id" => 78, "name" => $nameNetwork], + "latitude" => -1, + "longitude" => -1, + "category" => "super", + "member" => $code_hyper + ); + + $fields_string = http_build_query($fields); + $ch = curl_init(); + curl_setopt($ch, CURLOPT_URL, $url); + curl_setopt($ch, CURLOPT_POST, 1); + curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($fields)); + curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: text/plain')); + $result = curl_exec($ch); + curl_close($ch); + + //var_dump($fields_string); + $num_transac++; + $phone++; + $email ="mobicash.ga@ilink-app.com"; + $idNetwork = 77; + $nameNetwork = "Mobicash"; + + } + + } + } + + public function insert_satcon_agents(){ + $url = 'https://ilink-app.com/mobilebackendtest/interacted/MembersAction.php'; + + if(isset($_POST)) + { + $num_transac = (int)$this->input->post('transaction'); + $phone = (int)$this->input->post('telephone'); + $end = 1; + + $code_hyper = 'aTWyxm5vAq'; + $nom = $this->input->post('nom'); + $email ="satcon.ga@ilink-app.com"; + $idNetwork = 223; + $nameNetwork = "Satcon"; + $fields = array( + "tag" => "member", + "type" => "create_geolocated_user", + "lastname" => addslashes($nom), + "phone" => $phone, + "phone_transaction" => $num_transac, + "address" => "Awendjé", + "lang" => "fr", + "email" => $email, + "password" => "1234", + "town" => ["id" => 1, "country_id" => 78, "name" => "Gabon", "status" => 1], + "network" => ["id" => $idNetwork, "country_id" => 78, "name" => $nameNetwork], + "latitude" => -1, + "longitude" => -1, + "category" => "super", + "member" => $code_hyper + ); + + $fields_string = http_build_query($fields); + $ch = curl_init(); + curl_setopt($ch, CURLOPT_URL, $url); + curl_setopt($ch, CURLOPT_POST, 1); + curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($fields)); + curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: text/plain')); + $result = curl_exec($ch); + curl_close($ch); + + //var_dump($fields_string); + + } + } + + public function create_hyper_super__for_cameroun(){ + + $url = 'https://ilink-app.com/mobilebackendtest/interacted/MembersAction.php'; + + $id_country = 38; + $country_name = 'Cameroun'; + $list_network = $this->user_model->getAllNetworksInfos($id_country); + $phone = 800405; + $num_transac = 801405; + + $this->db->trans_begin(); + foreach ($list_network->result() AS $row){ + + $nom = 'Super - '.$row->name; + $email = str_replace('+','plus',strtolower(str_replace(' ','',$row->name.'.cm@ilink-app.com'))); + $code_hyper = ''; + //$code_hyper = $this->user_model->getCodeHyper($row->id); + + switch ($row->id) { + case 61: + $code_hyper = "1qGVCj9mUW"; + break; + case 72: + $code_hyper = "SIY5RRDHuq"; + break; + case 83: + $code_hyper = "LxugQ1sEv3"; + break; + case 96: + $code_hyper = "inmycWlKg7"; + break; + case 101: + $code_hyper = "GUhpKC4xP4"; + break; + case 110: + $code_hyper = "xEHh8bromY"; + break; + case 119: + $code_hyper = "QV1yez3Vvv"; + break; + case 128: + $code_hyper = "U3oZgJ3Raj"; + break; + case 136: + $code_hyper = "IYI8LZy80k"; + break; + case 147: + $code_hyper = "ojGmDqWUXN"; + break; + case 159: + $code_hyper = "Yw2hMiEUUi"; + break; + case 172: + $code_hyper = "rXLofF9iCq"; + break; + case 185: + $code_hyper = "pNlXXMIxrr"; + break; + case 198: + $code_hyper = "YeqY1vRtqp"; + break; + case 210: + $code_hyper = "2X9MKvWAdV"; + break; + } + + + for ($i = 11; $i <= 15; $i++){ + $fields = array( + "tag" => "member", + "type" => "create_geolocated_user", + "lastname" => addslashes($nom.' '.$i), + "phone" => '+237'.$phone, + "phone_transaction" => '+237'.$num_transac, + "address" => "Douala", + "lang" => "fr", + "email" => $email, + "password" => "1234", + "town" => ["id" => 2, "country_id" => $id_country, "name" => $country_name, "status" => 1], + "network" => ["id" => $row->id, "country_id" => $id_country, "name" => $row->name], + "latitude" => 4.0303481, + "longitude" => 9.6955774, + "category" => "super", + "member" => $code_hyper + ); + + $fields_string = http_build_query($fields); + $ch = curl_init(); + curl_setopt($ch, CURLOPT_URL, $url); + curl_setopt($ch, CURLOPT_POST, 1); + curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($fields)); + curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: text/plain')); + $result = curl_exec($ch); + curl_close($ch); + + //var_dump($fields_string); + $num_transac++; + $phone++; + + } + + + if ($this->db->trans_status() === FALSE) + { + $this->db->trans_rollback(); + } + else + { + $this->db->trans_commit(); + } + } + } + + public function create_hyper_super__for_burkina(){ + + $url = 'https://ilink-app.com/mobilebackendtest/interacted/MembersAction.php'; + + $id_country = 35; + $country_name = 'Burkina Faso'; + $list_network = $this->user_model->getAllNetworksInfos($id_country); + $phone = 800330; + $num_transac = 801330; + + $this->db->trans_begin(); + foreach ($list_network->result() AS $row){ + + $nom = 'Super - '.$row->name; + $email = str_replace('+','plus',strtolower(str_replace(' ','',$row->name.'.bf@ilink-app.com'))); + $code_hyper = ''; + //$code_hyper = $this->user_model->getCodeHyper($row->id); + + switch ($row->id) { + case 34: + $code_hyper = "FwdhzYphN9"; //Orange Money + break; + case 80: + $code_hyper = "mKDhlm6qHE"; //Mobicash + break; + case 92: + $code_hyper = "hCx1XWUdkF"; //Western Union + break; + case 107: + $code_hyper = "K8QyRT6lx1"; //Express Union + break; + case 113: + $code_hyper = "40dBWQO01Y"; //Money Express + break; + case 126: + $code_hyper = "6VZn319rLg"; //UBA + break; + case 134: + $code_hyper = "OnYzGrYOmn"; //Canal + + break; + case 144: + $code_hyper = "yricgPggVQ"; //Small World + break; + case 155: + $code_hyper = "8a3ce5WmjX"; //Juba + break; + case 168: + $code_hyper = "dLrX56TGff"; //Wari + break; + case 181: + $code_hyper = "ARILdZBjMZ"; //Ria + break; + case 194: + $code_hyper = "6vNWB5NUCF"; //Sigue + break; + case 207: + $code_hyper = "u4PJg75tDr"; //Ecobank + break; + case 218: + $code_hyper = "uCphmoVjkQ"; //DHL + break; + case 224: + $code_hyper = "0EbLos93CE"; //MoneyGram + break; + } + + + for ($i = 1; $i <= 5; $i++){ + $fields = array( + "tag" => "member", + "type" => "create_geolocated_user", + "lastname" => addslashes($nom.' '.$i), + "phone" => '+226'.$phone, + "phone_transaction" => '+226'.$num_transac, + "address" => "Ouagadougou", + "lang" => "fr", + "email" => $email, + "password" => "1234", + "town" => ["id" => 11, "country_id" => $id_country, "name" => $country_name, "status" => 1], + "network" => ["id" => $row->id, "country_id" => $id_country, "name" => $row->name], + "latitude" => -1.50914, + "longitude" => 12.3136, + "category" => "super", + "member" => $code_hyper + ); + + $fields_string = http_build_query($fields); + $ch = curl_init(); + curl_setopt($ch, CURLOPT_URL, $url); + curl_setopt($ch, CURLOPT_POST, 1); + curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($fields)); + curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: text/plain')); + $result = curl_exec($ch); + curl_close($ch); + + //var_dump($fields_string); + $num_transac++; + $phone++; + + } + + + if ($this->db->trans_status() === FALSE) + { + $this->db->trans_rollback(); + } + else + { + $this->db->trans_commit(); + } + } + } + + public function create_hyper_super__for_congo(){ + + $url = 'https://ilink-app.com/mobilebackendtest/interacted/MembersAction.php'; + + $id_country = 50; + $country_name = 'Congo'; + $list_network = $this->user_model->getAllNetworksInfos($id_country); + $phone = 800344; + $num_transac = 801344; + + $this->db->trans_begin(); + foreach ($list_network->result() AS $row){ + + $nom = 'Super - '.$row->name; + $email = str_replace('+','plus',strtolower(str_replace(' ','',$row->name.'.cg@ilink-app.com'))); + $code_hyper = ''; + //$code_hyper = $this->user_model->getCodeHyper($row->id); + + switch ($row->id) { + case 15: + $code_hyper = "tsKrqQ9Ysu"; //Airtel Money Congo + break; + case 73: + $code_hyper = "i2y8cQSd5v"; //MTN Congo + break; + case 85: + $code_hyper = "zXDRW92SAs"; //Western Union Congo + break; + case 102: + $code_hyper = "uLQsOjz18F"; //Express Union Congo + break; + case 120: + $code_hyper = "XmogcV7QS5"; //UBA Congo + break; + case 129: + $code_hyper = "dfOz5pA0Xr"; //Canal + Congo + break; + case 137: + $code_hyper = "CnsnYwAlUX"; //Small World Congo + break; + case 148: + $code_hyper = "uqAD5k5wr0"; //Juba Congo + break; + case 161: + $code_hyper = "eKk9RTafzd"; //Wari Congo + break; + case 174: + $code_hyper = "kCXVFm2qDy"; //Ria Congo + break; + case 187: + $code_hyper = "kRiO8jGA9k"; //Sigue Congo + break; + case 200: + $code_hyper = "gUIkTEZzSW"; //Ecobank Congo + break; + case 211: + $code_hyper = "361EmZOKjr"; //DHL Congo + break; + case 98: + $code_hyper = "zhCnuFtqjb"; //MoneyGram Congo + break; + } + + + for ($i = 1; $i <= 15; $i++){ + $fields = array( + "tag" => "member", + "type" => "create_geolocated_user", + "lastname" => addslashes($nom.' '.$i), + "phone" => '+242'.$phone, + "phone_transaction" => '+242'.$num_transac, + "address" => "Brazzaville", + "lang" => "fr", + "email" => $email, + "password" => "1234", + "town" => ["id" => 4, "country_id" => $id_country, "name" => $country_name, "status" => 1], + "network" => ["id" => $row->id, "country_id" => $id_country, "name" => $row->name], + "latitude" => 4.2634, + "longitude" => 15.2429, + "category" => "super", + "member" => $code_hyper + ); + + $fields_string = http_build_query($fields); + $ch = curl_init(); + curl_setopt($ch, CURLOPT_URL, $url); + curl_setopt($ch, CURLOPT_POST, 1); + curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($fields)); + curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: text/plain')); + $result = curl_exec($ch); + curl_close($ch); + + //var_dump($fields_string); + $num_transac++; + $phone++; + + } + + + if ($this->db->trans_status() === FALSE) + { + $this->db->trans_rollback(); + } + else + { + $this->db->trans_commit(); + } + } + } + + public function create_hyper(){ + + $url = 'https://ilink-app.com/mobilebackendtest/interacted/MembersAction.php'; + $countries = $this->user_model->getCountries(); + foreach ($countries->result() AS $country){ + if($country->id ==35){ + $id_country = $country->id; + $country_name = $country->name; + $code_country = $country->code_country; + $code_dial = $country->code_dial; + $ville = $country->ville; + $id_ville = $country->id_ville; + + $list_network = $this->user_model->getAllNetworksInfos($id_country); + $phone = 99900001; + $num_transac = 99900101; + + $this->db->trans_begin(); + foreach ($list_network->result() AS $row) { + + if ($row->id == 228){ + + $nom = 'Hyper - ' . $row->name; + $email = str_replace('+', 'plus', strtolower(str_replace(' ', '', $row->name . '.' . $code_country . '@ilink-app.com'))); + $code_hyper = $this->user_model->getFreeCode(); + + $fields = array( + "tag" => "member", + "type" => "create_geolocated_user", + "lastname" => addslashes($nom), + "phone" => $code_dial . $phone, + "phone_transaction" => $code_dial . $num_transac, + "address" => $ville, + "lang" => "fr", + "email" => $email, + "password" => "1234", + "town" => ["id" => $id_ville, "country_id" => $id_country, "name" => $country_name, "status" => 1], + "network" => ["id" => $row->id, "country_id" => $id_country, "name" => $row->name], + "latitude" => -1.50914, + "longitude" => 12.3136, + "category" => "hyper", + "member" => $code_hyper + ); + + $fields_string = http_build_query($fields); + $ch = curl_init(); + curl_setopt($ch, CURLOPT_URL, $url); + curl_setopt($ch, CURLOPT_POST, 1); + curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($fields)); + curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: text/plain')); + $result = curl_exec($ch); + curl_close($ch); + + //var_dump($fields_string); + $num_transac++; + $phone++; + + if ($this->db->trans_status() === FALSE) { + $this->db->trans_rollback(); + } else { + $this->db->trans_commit(); + } + + } + } + + + } + } + } + + public function active_hyper(){ + $url = 'https://ilink-app.com/mobilebackendtest/interacted/MembersAction.php'; + + $hypervisers = $this->user_model->getInfosActivationHyperviseur(); + foreach ($hypervisers->result() AS $hyperviser){ + $fields = array( + "tag" => "member", + "type" => "validate_hyper_backoffice", + "lang" => "fr", + "phone" => $hyperviser->phone, + "code_validation" => $hyperviser->validation_code, + "nbre_super" => 200, + "nbre_geo" => 2000 + ); + $fields_string = http_build_query($fields); + $ch = curl_init(); + curl_setopt($ch, CURLOPT_URL, $url); + curl_setopt($ch, CURLOPT_POST, 1); + curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($fields)); + curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: text/plain')); + $result = curl_exec($ch); + curl_close($ch); + } + } + + public function create_super(){ + + $url = 'https://ilink-app.com/mobilebackendtest/interacted/MembersAction.php'; + $countries = $this->user_model->getCountries(); + foreach ($countries->result() AS $country){ + + if($country->id ==38){ + $id_country = $country->id; + $country_name = $country->name; + $code_country = $country->code_country; + $code_dial = $country->code_dial; + $ville = $country->ville; + $id_ville = $country->id_ville; + + $list_network = $this->user_model->getAllNetworksInfos($id_country); + $phone = 99900014; + $num_transac = 99900114; + $nom [] = null; + $nom[1] = 'Ewombe Patricia'; + $nom[2] = 'Michelle TAWA'; + $nom[3] = 'Maxime MADIBA MBAPPE'; + $nom[4] = 'Ndemba Anais'; + $nom[5] = 'Balla Simplice Steven'; + $nom[6] = 'NDOME Eyango Hondrea'; + $nom[7] = 'NYAME Guy Thierry'; + $nom[8] = 'Valentin BABAGNAK'; + $nom[9] = 'Christian Junior KOOH DALLE'; + $nom[10] = 'Lottin Jeannot'; + $nom[11] = 'Priscille ENGONO'; + $nom[12] = 'AGENT-NYASSA-PK28'; + + $this->db->trans_begin(); + foreach ($list_network->result() AS $row) { + echo $row->name; + if($row->id==231){ + $nom = 'Benoit MBANGUE'; + $email = str_replace('+', 'plus', strtolower(str_replace(' ', '', $row->name . '.' . $code_country . '@ilink-app.com'))); + $code_hyper = $this->user_model->getCodeMembreHyper($row->id); + + for ($i = 1; $i <= 1; $i++) { + + $fields = array( + "tag" => "member", + "type" => "create_geolocated_user", + "lastname" => addslashes($nom), + "phone" => $code_dial . $phone, + "phone_transaction" => $code_dial . $num_transac, + "address" => $ville, + "lang" => "fr", + "email" => $email, + "password" => "1234", + "town" => ["id" => $id_ville, "country_id" => $id_country, "name" => $country_name, "status" => 1], + "network" => ["id" => $row->id, "country_id" => $id_country, "name" => $row->name], + "latitude" => 4.05, + "longitude" => 9.7, + "category" => "super", + "member" => $code_hyper + ); + + $fields_string = http_build_query($fields); + $ch = curl_init(); + curl_setopt($ch, CURLOPT_URL, $url); + curl_setopt($ch, CURLOPT_POST, 1); + curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($fields)); + curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: text/plain')); + $result = curl_exec($ch); + curl_close($ch); + + + //var_dump($fields_string); + $num_transac++; + $phone++; + } + + if ($this->db->trans_status() === FALSE) { + $this->db->trans_rollback(); + } else { + $this->db->trans_commit(); + } + }else{ + + } + + + } + + + }else{ + + } + } + } + + public function show_geolocatedPoints(){ + + $webhost = 'localhost'; + $webusername = 'root'; + $webpassword = 'vps@2017GA'; + $webdbname = 'iLink_cannary'; + $webcon = mysqli_connect($webhost, $webusername, $webpassword, $webdbname); + if (mysqli_connect_errno()) + { + echo 'Failed to connect to MySQL: ' . mysqli_connect_error(); + } + $results = mysqli_query($webcon, "SELECT agents.lastname,networks.name,networks_agents.phone,networks_agents.transactionNumber FROM `agents` + INNER JOIN networks_agents ON agents.id=networks_agents.agent_id + INNER JOIN networks ON networks.id=networks_agents.network_id + WHERE networks.country_id=78 + ORDER BY agents.lastname"); + + if($results) { + while ($row = mysqli_fetch_array($results)) { + echo $row['lastname'].' '.$row['name'].' '.$row['transactionNumber'].' '.$row['phone'].' '.$row['transactionNumber']."
"; + } + }else{ + echo 'Something wrong !'; + } + } + + public function test(){ + + $data['active'] = "demandes"; + $data['alert'] = ""; + $data['token'] = $this->session->userdata('token'); + $data['email'] = "nzaleh@gmail.com"; + $data['firstname'] = "Hanry"; + $data['lastname'] = "Nzale"; + $data['code_parrain'] = "VGVTttvf"; + $data['phone'] = "+24107916421"; + $data['adresse'] = "IAI"; + $data['category'] = "Admin"; + $data['network'] = 1; + $data['pays'] = $this->user_model->getAllCountries(); + $data['pays'] = $this->user_model->getAllCountries(); + $data['hyper'] = $this->user_model->getAllHyper($data['pays']->first_row()->id); + $data['ville'] = $this->user_model->getVilleNetworkByHyper($data['hyper']->first_row()->code_membre); + $this->load->view('header', $data); + $this->load->view('test'); + $this->load->view('footer'); + } + //ok + public function campagne_geocoding_orangemoney(){ + + function get_lat_lng($address){ + + $address_encoding = htmlentities(urlencode($address)); + $api = "AIzaSyClYkvZ3XUD9EKZv3Z2BLzkr7wBoV2aQ98"; + + $url = "https://maps.googleapis.com/maps/api/geocode/json?address=".$address_encoding."&key=".$api; + $contents = file_get_contents($url); + if($contents !== false){ + $contents = utf8_encode($contents); + $results = json_decode($contents); + $data = $results->results; + $lat = $data[0]->geometry->location->lat; + $lng = $data[0]->geometry->location->lng; + $adress = $data[0]->formatted_address; + $ville = $data[0]->address_components[2]->long_name; + $position["lat"] = $lat; + $position["lng"] = $lng; + $position["adresse"] = $address; + $results = $data; + + if ($results[0]) { + $num = sizeof($results[0]->address_components); + for ($i=0; $i<$num; $i++) { + $num2 = sizeof($results[0]->address_components[$i]->types); + for ($b=0;$b<$num2;$b++) { + if ($results[0]->address_components[$i]->types[$b] == "locality") { + $city= $results[0]->address_components[$i]; + break; + } + } + } + } + $position["ville"] = $city->long_name; + return $position; + }else{ + return null; + } + } + $url = 'https://ilink-app.com/mobilebackendtest/interacted/MembersAction.php'; + $row = 1; + $nom = ""; + $address = ""; + $num_contact =""; + $default_num = 33900001018; + + if (($handle = fopen("https://ilink-app.com/backofficeiLinkTest/application/controllers/Orange_money_paris.csv", "r")) !== FALSE) { + while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) { + $num = count($data); + if($row==3){ + echo "

$num fields in line $row:

\n"; + for ($c=0; $c < $num; $c++) { + $infos = explode(";", $data[$c]); + + $network_name = "Orange Money"; + $network_id = 60; + $email = 'orangemoney.fr@ilink-app.com'; + $code_super = "eNz6BDONDs"; + + $nom = $infos[0]; + $address = $infos[1].', '.$infos[2]; + $num_contact = '+33'.$infos[4]; + + $position = get_lat_lng($address); + $lat = $position['lat']; + $lng = $position['lng']; + $ville = $position['ville']; + $address = $position['adresse']; + $town_id = $this->user_model->getTownId($ville); + + $default_num++; + $exist = $this->user_model->checkPosition($lat,$lng); + if($exist == false){ + $fields = array( + "tag" => "member", + "type" => "create_geolocated_user", + "lastname" => addslashes($nom), + "phone" => $num_contact, + "phone_transaction" => '+'.$default_num, + "address" => addslashes($address), + "lang" => "fr", + "email" => $email, + "password" => "1234", + "town" => ["id" => $town_id, "country_id" => 74, "name" => "France", "status" => 1], + "network" => ["id" => $network_id, "country_id" => 74, "name" => $network_name], + "latitude" => $lat, + "longitude" => $lng, + "category" => "geolocated", + "member" => $code_super + ); + }else{ + + } + //echo json_encode($fields)."

\n"; + $this->db->trans_begin(); + $fields_string = http_build_query($fields); + $ch = curl_init(); + curl_setopt($ch, CURLOPT_URL, $url); + curl_setopt($ch, CURLOPT_POST, 1); + curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($fields)); + curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: text/plain')); + $result = curl_exec($ch); + curl_close($ch); + if ($this->db->trans_status() === FALSE) { + $this->db->trans_rollback(); + } else { + $this->db->trans_commit(); + } + + //echo $infos[0] .' -- '.$infos[1].' -- '.$infos[2].' -- '.$infos[3].' ('.$lat.'/'.$lng. ")
\n"; + } + } + $row++; + } + fclose($handle); + } + + /*$address = ""; + $position = get_lat_lng($address); + $lat = $position['lat']; + $lng = $position["lng"];*/ + + + } + //ok + public function campagne_geocoding_western(){ + + function get_lat_lng($address){ + + $address_encoding = htmlentities(urlencode($address)); + $api = "AIzaSyClYkvZ3XUD9EKZv3Z2BLzkr7wBoV2aQ98"; + + $url = "https://maps.googleapis.com/maps/api/geocode/json?address=".$address_encoding."&key=".$api; + $contents = file_get_contents($url); + if($contents !== false){ + $contents = utf8_encode($contents); + $results = json_decode($contents); + $data = $results->results; + $lat = $data[0]->geometry->location->lat; + $lng = $data[0]->geometry->location->lng; + $adress = $data[0]->formatted_address; + $ville = $data[0]->address_components[2]->long_name; + $position["lat"] = $lat; + $position["lng"] = $lng; + $position["adresse"] = $address; + $results = $data; + + if ($results[0]) { + $num = sizeof($results[0]->address_components); + for ($i=0; $i<$num; $i++) { + $num2 = sizeof($results[0]->address_components[$i]->types); + for ($b=0;$b<$num2;$b++) { + if ($results[0]->address_components[$i]->types[$b] == "locality") { + $city= $results[0]->address_components[$i]; + break; + } + } + } + } + $position["ville"] = $city->long_name; + return $position; + }else{ + return null; + } + } + function remove_accent($str) + { + $a = array('À', 'Á', 'Â', 'Ã', 'Ä', 'Å', 'Æ', 'Ç', 'È', 'É', 'Ê', 'Ë', 'Ì', 'Í', 'Î', 'Ï', 'Ð', + 'Ñ', 'Ò', 'Ó', 'Ô', 'Õ', 'Ö', 'Ø', 'Ù', 'Ú', 'Û', 'Ü', 'Ý', 'ß', 'à', 'á', 'â', 'ã', + 'ä', 'å', 'æ', 'ç', 'è', 'é', 'ê', 'ë', 'ì', 'í', 'î', 'ï', 'ñ', 'ò', 'ó', 'ô', 'õ', + 'ö', 'ø', 'ù', 'ú', 'û', 'ü', 'ý', 'ÿ', 'Ā', 'ā', 'Ă', 'ă', 'Ą', 'ą', 'Ć', 'ć', 'Ĉ', + 'ĉ', 'Ċ', 'ċ', 'Č', 'č', 'Ď', 'ď', 'Đ', 'đ', 'Ē', 'ē', 'Ĕ', 'ĕ', 'Ė', 'ė', 'Ę', 'ę', + 'Ě', 'ě', 'Ĝ', 'ĝ', 'Ğ', 'ğ', 'Ġ', 'ġ', 'Ģ', 'ģ', 'Ĥ', 'ĥ', 'Ħ', 'ħ', 'Ĩ', 'ĩ', 'Ī', 'ī', + 'Ĭ', 'ĭ', 'Į', 'į', 'İ', 'ı', 'IJ', 'ij', 'Ĵ', 'ĵ', 'Ķ', 'ķ', 'Ĺ', 'ĺ', 'Ļ', 'ļ', 'Ľ', 'ľ', + 'Ŀ', 'ŀ', 'Ł', 'ł', 'Ń', 'ń', 'Ņ', 'ņ', 'Ň', 'ň', 'ʼn', 'Ō', 'ō', 'Ŏ', 'ŏ', 'Ő', 'ő', 'Œ', + 'œ', 'Ŕ', 'ŕ', 'Ŗ', 'ŗ', 'Ř', 'ř', 'Ś', 'ś', 'Ŝ', 'ŝ', 'Ş', 'ş', 'Š', 'š', 'Ţ', 'ţ', 'Ť', + 'ť', 'Ŧ', 'ŧ', 'Ũ', 'ũ', 'Ū', 'ū', 'Ŭ', 'ŭ', 'Ů', 'ů', 'Ű', 'ű', 'Ų', 'ų', 'Ŵ', 'ŵ', 'Ŷ', + 'ŷ', 'Ÿ', 'ÿ', 'Ź', 'ź', 'Ż', 'ż', 'Ž', 'ž', 'ſ', 'ƒ', 'Ơ', 'ơ', 'Ư', 'ư', 'Ǎ', 'ǎ', 'Ǐ', 'ǐ', + 'Ǒ', 'ǒ', 'Ǔ', 'ǔ', 'Ǖ', 'ǖ', 'Ǘ', 'ǘ', 'Ǚ', 'ǚ', 'Ǜ', 'ǜ', 'Ǻ', 'ǻ', 'Ǽ', 'ǽ', 'Ǿ', 'ǿ'); + + $b = array('A', 'A', 'A', 'A', 'A', 'A', 'AE', 'C', 'E', 'E', 'E', 'E', 'I', 'I', 'I', 'I', 'D', 'N', 'O', + 'O', 'O', 'O', 'O', 'O', 'U', 'U', 'U', 'U', 'Y', 's', 'a', 'a', 'a', 'a', 'a', 'a', 'ae', 'c', + 'e', 'e', 'e', 'e', 'i', 'i', 'i', 'i', 'n', 'o', 'o', 'o', 'o', 'o', 'o', 'u', 'u', 'u', 'u', + 'y', 'y', 'A', 'a', 'A', 'a', 'A', 'a', 'C', 'c', 'C', 'c', 'C', 'c', 'C', 'c', 'D', 'd', 'D', + 'd', 'E', 'e', 'E', 'e', 'E', 'e', 'E', 'e', 'E', 'e', 'G', 'g', 'G', 'g', 'G', 'g', 'G', 'g', + 'H', 'h', 'H', 'h', 'I', 'i', 'I', 'i', 'I', 'i', 'I', 'i', 'I', 'i', 'IJ', 'ij', 'J', 'j', 'K', + 'k', 'L', 'l', 'L', 'l', 'L', 'l', 'L', 'l', 'L', 'l', 'N', 'n', 'N', 'n', 'N', 'n', 'n', 'O', 'o', + 'O', 'o', 'O', 'o', 'OE', 'oe', 'R', 'r', 'R', 'r', 'R', 'r', 'S', 's', 'S', 's', 'S', 's', 'S', + 's', 'T', 't', 'T', 't', 'T', 't', 'U', 'u', 'U', 'u', 'U', 'u', 'U', 'u', 'U', 'u', 'U', 'u', 'W', + 'w', 'Y', 'y', 'y', 'Y', 'Z', 'z', 'Z', 'z', 'Z', 'z', 's', 'f', 'O', 'o', 'U', 'u', 'A', 'a', 'I', 'i', + 'O', 'o', 'U', 'u', 'U', 'u', 'U', 'u', 'U', 'u', 'U', 'u', 'A', 'a', 'AE', 'ae', 'O', 'o'); + return str_replace($a, $b, $str); + } + $url = 'https://ilink-app.com/mobilebackendtest/interacted/MembersAction.php'; + $row = 1; + $nom = ""; + $address = ""; + $num_contact =""; + $n1=1; + $n2=0; + $ok = true; + $ct = 0; + $default_num = 33900004034; + $lastname = ""; + + if (($handle = fopen("https://ilink-app.com/backofficeiLinkTest/application/controllers/western_union_paris.csv", "r")) !== FALSE) { + while (($data = fgetcsv($handle, 10000, ";")) !== FALSE) { + $num = count($data); + //echo "

$num fields in line $row:

\n"; + + for ($c=0; $c < $num; $c++) { + //echo $data[$c] . "
\n"; + if($n1 == 1){ + $lastname = $data[$c]; + $n1++; + }elseif($n1==2){ + $tmp = utf8_encode(str_replace( chr( 194 ) . chr( 160 ), ' ', $data[$c] )); + $inf = explode("+", str_replace( chr( 194 ) . chr( 160 ), ' ', $tmp )); + $address = $inf[0]; + $contact_correct = str_replace('-','',$inf[1]); + $num_contact = '+'.$contact_correct; + $nom = $lastname; + /*echo $lastname. "
\n"; + echo $address. "
\n"; + echo $num_contact. "
\n";*/ + + $network_name = "Western Union"; + $network_id = 84; + $email = 'westernunion.fr@ilink-app.com'; + $code_super = "fDvQe9ZANz"; + + $position = get_lat_lng($address); + $lat = $position['lat']; + $lng = $position['lng']; + $ville = remove_accent($position['ville']); + $ville = str_replace('A¿', 'y', $ville); + $address = $position['adresse']; + /*$town_id = $this->user_model->getTownId(addslashes($ville)); + if($town_id==null){ + $res = $this->user_model->create_town(74,addslashes($ville)); + if($res){ + $town_id = $this->user_model->getTownId(addslashes($ville)); + $ret = $this->user_model->update_town_agent($lat,$lng,$town_id); + if($ret){ + echo "Mise à jour Ok!"; + }else{ + echo "Erreur lors de la mise à jour"; + } + }else{ + echo "Erreur lors de la création de la ville"; + } + }*/ + + + /*if($num_contact == "+33969366050"){ + $num_contact = $default_num; + $default_num++; + } + for($i=10; $i < 34; $i++){ + if($num_contact == '+339000000'.$i){ + $num_contact = $default_num; + $default_num++; + } + } + for($i=0; $i < 10; $i++){ + if($num_contact == '+3390000000'.$i){ + $num_contact = $default_num; + $default_num++; + } + }*/ + + $fields = array( + "tag" => "member", + "type" => "create_geolocated_user", + "lastname" => addslashes($nom), + "phone" => $num_contact, + "phone_transaction" => '+'.$default_num, + "address" => addslashes($address), + "lang" => "fr", + "email" => $email, + "password" => "1234", + "town" => ["id" => 3, "country_id" => 74, "name" => "France", "status" => 1], + "network" => ["id" => $network_id, "country_id" => 74, "name" => $network_name], + "latitude" => $lat, + "longitude" => $lng, + "category" => "geolocated", + "member" => $code_super + ); + $default_num++; + //echo json_encode($fields)."

\n";; + $this->db->trans_begin(); + $fields_string = http_build_query($fields); + $ch = curl_init(); + curl_setopt($ch, CURLOPT_URL, $url); + curl_setopt($ch, CURLOPT_POST, 1); + curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($fields)); + curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: text/plain')); + $result = curl_exec($ch); + curl_close($ch); + if ($this->db->trans_status() === FALSE) { + $this->db->trans_rollback(); + } else { + $this->db->trans_commit(); + } + + $n1 = 1; + } + + /*$data[0] = utf8_encode($data[0]); + $data[0] = str_replace( chr( 194 ) . chr( 160 ), ' ', $data[0] ); + $inf = explode("+", str_replace( chr( 194 ) . chr( 160 ), ' ', $data[0] )); + $address = str_replace( chr( 194 ) . chr( 160 ), ' ', $data[0] ).' '.$inf[0]; + $contact_correct = str_replace('-','',$inf[1]); + $num_contact ='+'.$contact_correct; + echo "

$num fields in line $row:

\n"; + echo $lastname."

\n"; + echo json_encode($data)."

\n";*/ + } + $row++; + } + fclose($handle); + } + + /*$address = ""; + $position = get_lat_lng($address); + $lat = $position['lat']; + $lng = $position["lng"];*/ + + + } + //ok + public function campagne_geocoding_moneygram(){ + + function get_lat_lng($address){ + + $address_encoding = htmlentities(urlencode($address)); + $api = "AIzaSyClYkvZ3XUD9EKZv3Z2BLzkr7wBoV2aQ98"; + + $url = "https://maps.googleapis.com/maps/api/geocode/json?address=".$address_encoding."&key=".$api; + $contents = file_get_contents($url); + if($contents !== false){ + $contents = utf8_encode($contents); + $results = json_decode($contents); + $data = $results->results; + $lat = $data[0]->geometry->location->lat; + $lng = $data[0]->geometry->location->lng; + $adress = $data[0]->formatted_address; + $ville = $data[0]->address_components[2]->long_name; + $position["lat"] = $lat; + $position["lng"] = $lng; + $position["adresse"] = $address; + $results = $data; + + if ($results[0]) { + $num = sizeof($results[0]->address_components); + for ($i=0; $i<$num; $i++) { + $num2 = sizeof($results[0]->address_components[$i]->types); + for ($b=0;$b<$num2;$b++) { + if ($results[0]->address_components[$i]->types[$b] == "locality") { + $city= $results[0]->address_components[$i]; + break; + } + } + } + } + $position["ville"] = $city->long_name; + return $position; + }else{ + return null; + } + } + $url = 'https://ilink-app.com/mobilebackendtest/interacted/MembersAction.php'; + $row = 1; + $nom = ""; + $address = ""; + $num_contact =""; + $n1=1; + $n2=0; + $ok = true; + $ct = 0; + $default_num = 33900003034; + $lastname = ""; + + if (($handle = fopen("https://ilink-app.com/backofficeiLinkTest/application/controllers/MONEYGRAM.csv", "r")) !== FALSE) { + while (($data = fgetcsv($handle, 10000, ";")) !== FALSE) { + $num = count($data); + for ($c=0; $c < $num; $c++) { + //echo $data[$c] . "
\n"; + if($n1 == 1){ + $lastname = $data[$c]; + $n1++; + }elseif($n1==2){ + $adress1 = $data[$c]; + $n1++; + + + /*if($num_contact == "+33969366050"){ + $num_contact = $default_num; + $default_num++; + } + for($i=10; $i < 34; $i++){ + if($num_contact == '+339000000'.$i){ + $num_contact = $default_num; + $default_num++; + } + } + for($i=0; $i < 10; $i++){ + if($num_contact == '+3390000000'.$i){ + $num_contact = $default_num; + $default_num++; + } + }*/ + + /* + */ + + + }elseif($n1 == 3){ + $address = $adress1.' '.$data[$c]; + $n1++; + }elseif($n1 == 4){ + $num_contact = $data[$c]; + /*echo $lastname."

\n"; + echo $address."

\n"; + echo $num_contact."

\n";*/ + + $num_contact = '+33'.$num_contact; + $nom = $lastname; + /*echo $lastname. "
\n"; + echo $address. "
\n"; + echo $num_contact. "
\n";*/ + + $network_name = "MoneyGram"; + $network_id = 97; + $email = 'moneygram.fr@ilink-app.com'; + $code_super = "Q4kVHVRHvo"; + + $position = get_lat_lng($address); + $lat = $position['lat']; + $lng = $position['lng']; + $ville = $position['ville']; + $address = $position['adresse']; + //$town_id = $this->user_model->getTownId($ville); + + $exist = $this->user_model->checkPosition($lat,$lng); + if($exist == false){ + $fields = array( + "tag" => "member", + "type" => "create_geolocated_user", + "lastname" => addslashes($nom), + "phone" => $num_contact, + "phone_transaction" => '+'.$default_num, + "address" => addslashes($address), + "lang" => "fr", + "email" => $email, + "password" => "1234", + "town" => ["id" => 3, "country_id" => 74, "name" => "France", "status" => 1], + "network" => ["id" => $network_id, "country_id" => 74, "name" => $network_name], + "latitude" => $lat, + "longitude" => $lng, + "category" => "geolocated", + "member" => $code_super + ); + }else{ + + } + $default_num++; + //echo json_encode($fields)."

\n"; + $this->db->trans_begin(); + $fields_string = http_build_query($fields); + $ch = curl_init(); + curl_setopt($ch, CURLOPT_URL, $url); + curl_setopt($ch, CURLOPT_POST, 1); + curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($fields)); + curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: text/plain')); + $result = curl_exec($ch); + curl_close($ch); + if ($this->db->trans_status() === FALSE) { + $this->db->trans_rollback(); + } else { + $this->db->trans_commit(); + } + + + $n1 = 1; + } + + /*$data[0] = utf8_encode($data[0]); + $data[0] = str_replace( chr( 194 ) . chr( 160 ), ' ', $data[0] ); + $inf = explode("+", str_replace( chr( 194 ) . chr( 160 ), ' ', $data[0] )); + $address = str_replace( chr( 194 ) . chr( 160 ), ' ', $data[0] ).' '.$inf[0]; + $contact_correct = str_replace('-','',$inf[1]); + $num_contact ='+'.$contact_correct; + echo "

$num fields in line $row:

\n"; + echo $lastname."

\n"; + echo json_encode($data)."

\n";*/ + } + $row++; + } + fclose($handle); + } + + /*$address = ""; + $position = get_lat_lng($address); + $lat = $position['lat']; + $lng = $position["lng"];*/ + + + } + //ok + public function campagne_geocoding_ria(){ + + function get_lat_lng($address){ + + $address_encoding = htmlentities(urlencode($address)); + $api = "AIzaSyClYkvZ3XUD9EKZv3Z2BLzkr7wBoV2aQ98"; + + $url = "https://maps.googleapis.com/maps/api/geocode/json?address=".$address_encoding."&key=".$api; + $contents = file_get_contents($url); + if($contents !== false){ + $contents = utf8_encode($contents); + $results = json_decode($contents); + $data = $results->results; + $lat = $data[0]->geometry->location->lat; + $lng = $data[0]->geometry->location->lng; + $adress = $data[0]->formatted_address; + $ville = $data[0]->address_components[2]->long_name; + $position["lat"] = $lat; + $position["lng"] = $lng; + $position["adresse"] = $address; + $results = $data; + + if ($results[0]) { + $num = sizeof($results[0]->address_components); + for ($i=0; $i<$num; $i++) { + $num2 = sizeof($results[0]->address_components[$i]->types); + for ($b=0;$b<$num2;$b++) { + if ($results[0]->address_components[$i]->types[$b] == "locality") { + $city= $results[0]->address_components[$i]; + break; + } + } + } + } + $position["ville"] = $city->long_name; + return $position; + }else{ + return null; + } + } + $url = 'https://ilink-app.com/mobilebackendtest/interacted/MembersAction.php'; + $row = 1; + $nom = ""; + $address = ""; + $num_contact =""; + $n1=1; + $n2=0; + $ok = true; + $ct = 0; + $default_num = 33900002000; + $lastname = ""; + + if (($handle = fopen("https://ilink-app.com/backofficeiLinkTest/application/controllers/ria_paris.csv", "r")) !== FALSE) { + while (($data = fgetcsv($handle, 10000, ";")) !== FALSE) { + $num = count($data); + $num = 1; + //echo "

$num fields in line $row:

\n"; + for ($c=0; $c < $num; $c++) { + //echo $data[$c] . "
\n"; + if($n1 == 1){ + $adress1 = $data[$c]; + $n1++; + + }elseif($n1==2){ + $address_temp = $adress1.' '.$data[$c]; + $n1++; + }elseif($n1 == 3){ + $phone = $data[$c]; + $inf_ctc = explode("+", $phone); + $num_contact = '+'.$inf_ctc[1]; + $nom = "Boutique Ria"; + + $network_name = "Ria"; + $network_id = 173; + $email = 'ria.fr@ilink-app.com'; + $code_super = "UZ8RdNwd9W"; + + $position = get_lat_lng(utf8_encode($address_temp)); + $lat = $position['lat']; + $lng = $position['lng']; + $ville = $position['ville']; + $address = $position['adresse']; + $town_id = $this->user_model->getTownId($ville); + + $exist = $this->user_model->checkPosition($lat,$lng); + if($exist == false){ + $fields = array( + "tag" => "member", + "type" => "create_geolocated_user", + "lastname" => addslashes($nom), + "phone" => $num_contact, + "phone_transaction" => '+'.$default_num, + "address" => $address, + "lang" => "fr", + "email" => $email, + "password" => "1234", + "town" => ["id" => 3, "country_id" => 74, "name" => "France", "status" => 1], + "network" => ["id" => $network_id, "country_id" => 74, "name" => $network_name], + "latitude" => $lat, + "longitude" => $lng, + "category" => "geolocated", + "member" => $code_super + ); + }else{ + + } + $default_num++; + //echo json_encode($fields)."

\n"; + $this->db->trans_begin(); + $fields_string = http_build_query($fields); + $ch = curl_init(); + curl_setopt($ch, CURLOPT_URL, $url); + curl_setopt($ch, CURLOPT_POST, 1); + curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($fields)); + curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: text/plain')); + $result = curl_exec($ch); + curl_close($ch); + if ($this->db->trans_status() === FALSE) { + $this->db->trans_rollback(); + } else { + $this->db->trans_commit(); + } + $n1 = 1; + } + + /*$data[0] = utf8_encode($data[0]); + $data[0] = str_replace( chr( 194 ) . chr( 160 ), ' ', $data[0] ); + $inf = explode("+", str_replace( chr( 194 ) . chr( 160 ), ' ', $data[0] )); + $address = str_replace( chr( 194 ) . chr( 160 ), ' ', $data[0] ).' '.$inf[0]; + $contact_correct = str_replace('-','',$inf[1]); + $num_contact ='+'.$contact_correct; + echo "

$num fields in line $row:

\n"; + echo $lastname."

\n"; + echo json_encode($data)."

\n";*/ + } + $row++; + } + fclose($handle); + } + + /*$address = ""; + $position = get_lat_lng($address); + $lat = $position['lat']; + $lng = $position["lng"];*/ + + + } + + public function campagne_geocoding_sigue(){ + + function get_lat_lng($address){ + + $address_encoding = htmlentities(urlencode($address)); + $api = "AIzaSyClYkvZ3XUD9EKZv3Z2BLzkr7wBoV2aQ98"; + + $url = "https://maps.googleapis.com/maps/api/geocode/json?address=".$address_encoding."&key=".$api; + $contents = file_get_contents($url); + if($contents !== false){ + $contents = utf8_encode($contents); + $results = json_decode($contents); + $data = $results->results; + $lat = $data[0]->geometry->location->lat; + $lng = $data[0]->geometry->location->lng; + $adress = $data[0]->formatted_address; + $ville = $data[0]->address_components[2]->long_name; + $position["lat"] = $lat; + $position["lng"] = $lng; + $position["adresse"] = $address; + $results = $data; + + if ($results[0]) { + $num = sizeof($results[0]->address_components); + for ($i=0; $i<$num; $i++) { + $num2 = sizeof($results[0]->address_components[$i]->types); + for ($b=0;$b<$num2;$b++) { + if ($results[0]->address_components[$i]->types[$b] == "locality") { + $city= $results[0]->address_components[$i]; + break; + } + } + } + } + $position["ville"] = $city->long_name; + return $position; + }else{ + return null; + } + } + $url = 'https://ilink-app.com/mobilebackendtest/interacted/MembersAction.php'; + $row = 1; + $nom = ""; + $address = ""; + $num_contact =""; + $n1=1; + $n2=0; + $ok = true; + $ct = 0; + $default_num = 33900004000; + $lastname = ""; + + if (($handle = fopen("https://ilink-app.com/backofficeiLinkTest/application/controllers/SIGUE.csv", "r")) !== FALSE) { + while (($data = fgetcsv($handle, 10000, ";")) !== FALSE) { + $num = count($data); + $num = 1; + //echo "

$num fields in line $row:

\n"; + for ($c=0; $c < $num; $c++) { + //echo $data[$c] . "
\n"; + if($n1 == 1){ + $address_temp = $data[$c]; + $n1++; + //echo $address_temp; + }elseif($n1 == 2){ + $infos = utf8_encode($data[$c]); + $inf_ctc = explode("Tél : 0", str_replace( chr( 194 ) . chr( 160 ), ' ', $infos )); + $num_contact = '+33'.str_replace(' ','',$inf_ctc[1]); + $nom = "Sigue ".$inf_ctc[0]; + + $network_name = "Sigue"; + $network_id = 186; + $email = 'sigue.fr@ilink-app.com'; + $code_super = "utC4SjNUHe"; + + $position = get_lat_lng(utf8_encode($address_temp)); + + $adress = $position["adresse"]; + $lat = $position['lat']; + $lng = $position['lng']; + + $fields = array( + "tag" => "member", + "type" => "create_geolocated_user", + "lastname" => addslashes($nom), + "phone" => $num_contact, + "phone_transaction" => '+'.$default_num, + "address" => $adress, + "lang" => "fr", + "email" => $email, + "password" => "1234", + "town" => ["id" => 3, "country_id" => 74, "name" => "France", "status" => 1], + "network" => ["id" => $network_id, "country_id" => 74, "name" => $network_name], + "latitude" => $lat, + "longitude" => $lng, + "category" => "geolocated", + "member" => $code_super + ); + $default_num++; + //echo json_encode($fields)."

\n"; + $this->db->trans_begin(); + $fields_string = http_build_query($fields); + $ch = curl_init(); + curl_setopt($ch, CURLOPT_URL, $url); + curl_setopt($ch, CURLOPT_POST, 1); + curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($fields)); + curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: text/plain')); + $result = curl_exec($ch); + curl_close($ch); + if ($this->db->trans_status() === FALSE) { + $this->db->trans_rollback(); + } else { + $this->db->trans_commit(); + } + $n1 = 1; + } + + /*$data[0] = utf8_encode($data[0]); + $data[0] = str_replace( chr( 194 ) . chr( 160 ), ' ', $data[0] ); + $inf = explode("+", str_replace( chr( 194 ) . chr( 160 ), ' ', $data[0] )); + $address = str_replace( chr( 194 ) . chr( 160 ), ' ', $data[0] ).' '.$inf[0]; + $contact_correct = str_replace('-','',$inf[1]); + $num_contact ='+'.$contact_correct; + echo "

$num fields in line $row:

\n"; + echo $lastname."

\n"; + echo json_encode($data)."

\n";*/ + } + $row++; + } + fclose($handle); + } + + /*$address = ""; + $position = get_lat_lng($address); + $lat = $position['lat']; + $lng = $position["lng"];*/ + + + } + + public function campagne_geocoding_dubai_western(){ + + function get_lat_lng($address){ + + $address_encoding = htmlentities(urlencode($address)); + $api = "AIzaSyClYkvZ3XUD9EKZv3Z2BLzkr7wBoV2aQ98"; + + $url = "https://maps.googleapis.com/maps/api/geocode/json?address=".$address_encoding."&key=".$api; + $contents = file_get_contents($url); + if($contents !== false){ + $contents = utf8_encode($contents); + $results = json_decode($contents); + $data = $results->results; + if($data != []){ + $lat = $data[0]->geometry->location->lat; + $lng = $data[0]->geometry->location->lng; + $adress = $data[0]->formatted_address; + $position["lat"] = $lat; + $position["lng"] = $lng; + $position["adresse"] = $address; + if ($data[0]) { + $num = sizeof($data[0]->address_components); + for ($i=0; $i<$num; $i++) { + $num2 = sizeof($data[0]->address_components[$i]->types); + for ($b=0;$b<$num2;$b++) { + if ($data[0]->address_components[$i]->types[$b] == "locality") { + $city= $data[0]->address_components[$i]; + break; + } + } + } + } + if(isset($city->long_name)){ + $position["ville"] = $city->long_name; + }else{ + $position["ville"] = null; + } + }else{ + $position = null; + } + return $position; + }else{ + return null; + } + } + $url = 'https://ilink-app.com/mobilebackendtest/interacted/MembersAction.php'; + $row = 1; + $nom = ""; + $address = ""; + $num_contact =""; + $n1=1; + $n2=2; + $ok = true; + $ct = 0; + $default_num = 97100001001; + $lastname = ""; + + if (($handle = fopen("https://ilink-app.com/backofficeiLinkTest/application/controllers/western_union_dubai.csv", "r")) !== FALSE) { + while (($data = fgetcsv($handle, 10000, ";")) !== FALSE) { + $num = count($data); + $num = 1; + //echo "

$num fields in line $row:

\n"; + for ($c=0; $c < $num; $c++) { + //echo $data[$c] . "
\n"; + if($n1 == 1){ + $nom = $data[$c]; + $n1++; + //echo $address_temp; + }elseif($n1 == 2){ + $infos = utf8_encode($data[$c]); + $inf_ctc = explode("+", str_replace( chr( 194 ) . chr( 160 ), ' ', $infos )); + + + $network_name = "Western Union"; + $network_id = 94; + $email = 'westernunion.ae@ilink-app.com'; + $code_super = "b4r2uqbyeN"; + //$town_id = $this->user_model->getTownId($town_name); + + $position = get_lat_lng(utf8_encode($inf_ctc[0])); + if($position == null){ + //$n1 = 1; + //break; + }else{ + + //echo $nom."

\n"; + //echo json_encode($inf_ctc)."

\n"; + } + $num_contact = '+'.str_replace('-','',$inf_ctc[1]); + + $adress = $position["adresse"]; + $lat = $position['lat']; + $lng = $position['lng']; + + echo 'Point '.$n2.' '.json_encode($position)."

\n"; + echo $nom."

\n"; + echo json_encode($inf_ctc)."

\n"; + $n2++; + + if($position['ville'] != null && $position['ville'] == 'Dubai'){ + $fields = array( + "tag" => "member", + "type" => "create_geolocated_user", + "lastname" => addslashes($nom), + "phone" => $num_contact, + "phone_transaction" => '+'.$default_num, + "address" => $adress, + "lang" => "fr", + "email" => $email, + "password" => "1234", + "town" => ["id" => 13, "country_id" => 233, "name" => "United Arab Emirates", "status" => 1], + "network" => ["id" => $network_id, "country_id" => 74, "name" => $network_name], + "latitude" => $lat, + "longitude" => $lng, + "category" => "geolocated", + "member" => $code_super + ); + $default_num++; + //echo json_encode($fields)."

\n"; + /*$this->db->trans_begin(); + $fields_string = http_build_query($fields); + $ch = curl_init(); + curl_setopt($ch, CURLOPT_URL, $url); + curl_setopt($ch, CURLOPT_POST, 1); + curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($fields)); + curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: text/plain')); + $result = curl_exec($ch); + curl_close($ch); + if ($this->db->trans_status() === FALSE) { + $this->db->trans_rollback(); + } else { + $this->db->trans_commit(); + }*/ + } + $n1 = 1; + } + + /*$data[0] = utf8_encode($data[0]); + $data[0] = str_replace( chr( 194 ) . chr( 160 ), ' ', $data[0] ); + $inf = explode("+", str_replace( chr( 194 ) . chr( 160 ), ' ', $data[0] )); + $address = str_replace( chr( 194 ) . chr( 160 ), ' ', $data[0] ).' '.$inf[0]; + $contact_correct = str_replace('-','',$inf[1]); + $num_contact ='+'.$contact_correct; + echo "

$num fields in line $row:

\n"; + echo $lastname."

\n"; + echo json_encode($data)."

\n";*/ + } + $row++; + } + fclose($handle); + } + + /*$address = ""; + $position = get_lat_lng($address); + $lat = $position['lat']; + $lng = $position["lng"];*/ + + + } + + public function campagne_geocoding_dubai_moneygram(){ + + function get_lat_lng($address){ + + $address_encoding = htmlentities(urlencode($address)); + $api = "AIzaSyClYkvZ3XUD9EKZv3Z2BLzkr7wBoV2aQ98"; + + $url = "https://maps.googleapis.com/maps/api/geocode/json?address=".$address_encoding."&key=".$api; + $contents = file_get_contents($url); + if($contents !== false){ + $contents = utf8_encode($contents); + $results = json_decode($contents); + $data = $results->results; + if($data != []){ + $lat = $data[0]->geometry->location->lat; + $lng = $data[0]->geometry->location->lng; + $adress = $data[0]->formatted_address; + $position["lat"] = $lat; + $position["lng"] = $lng; + $position["adresse"] = $address; + $position["ville"] = null; + if ($data[0]) { + $num = sizeof($data[0]->address_components); + for ($i=0; $i<$num; $i++) { + $num2 = sizeof($data[0]->address_components[$i]->types); + for ($b=0;$b<$num2;$b++) { + if ($data[0]->address_components[$i]->types[$b] == "locality") { + $city= $data[0]->address_components[$i]; + if($city->long_name){ + echo $address. "
\n"; + echo $city->long_name. "
\n"; + $position["ville"] = $city->long_name; + } + break; + } + } + } + } + + }else{ + $position = null; + } + return $position; + }else{ + return null; + } + } + $url = 'https://ilink-app.com/mobilebackendtest/interacted/MembersAction.php'; + $row = 1; + $nom = ""; + $address = ""; + $num_contact =""; + $n1=1; + $n2=1; + $ok = true; + $ct = 0; + $default_num = 97100006621; + $lastname = ""; + + if (($handle = fopen("https://ilink-app.com/backofficeiLinkTest/application/controllers/moneygram_dubai.csv", "r")) !== FALSE) { + while (($data = fgetcsv($handle, 10000, ";")) !== FALSE) { + $num = count($data); + $num = 1; + //echo "

$num fields in line $row:

\n"; + for ($c=0; $c < $num; $c++) { + //echo $data[$c] . "
\n"; + if($n1 == 1){ + $nom = $data[$c]; + $n1++; + //echo $address_temp; + }elseif($n1 == 2){ + $adress_temp = str_replace( chr( 194 ) . chr( 160 ), ' ',utf8_encode($data[$c])); + $n1++; + }elseif($n1 == 3){ + $adress_temp = $adress_temp.' '.str_replace( chr( 194 ) . chr( 160 ), ' ',utf8_encode($data[$c])); + $n1++; + }elseif($n1 == 4){ + /*$infos = utf8_encode($data[$c]); + $inf_ctc = explode("+", str_replace( chr( 194 ) . chr( 160 ), ' ', $infos ));*/ + + + $network_name = "MoneyGram"; + $network_id = 81; + $email = 'moneygram.ae@ilink-app.com'; + $code_super = "ynSAWooVMT"; + //$town_id = $this->user_model->getTownId($town_name); + echo json_encode(utf8_encode($adress_temp))."

\n"; + + $position = get_lat_lng(utf8_encode($adress_temp)); + + echo json_encode(utf8_encode($position))."

\n"; + + if($position == null){ + $n1 = 1; + break; + }else{ + $num_contact = $data[$c]; + if($num_contact == '971%'){ + $num_contact = '+'.$num_contact; + }else{ + $num_contact = '+971'.$num_contact; + } + } + + $adress = $position["adresse"]; + $lat = $position['lat']; + $lng = $position['lng']; + + + if($position['ville'] != null && $position['ville'] == 'Ajman'){ + $fields = array( + "tag" => "member", + "type" => "create_geolocated_user", + "lastname" => addslashes($nom), + "phone" => $num_contact, + "phone_transaction" => '+'.$default_num, + "address" => $adress, + "lang" => "fr", + "email" => $email, + "password" => "1234", + "town" => ["id" => 31, "country_id" => 233, "name" => "United Arab Emirates", "status" => 1], + "network" => ["id" => $network_id, "country_id" => 233, "name" => $network_name], + "latitude" => $lat, + "longitude" => $lng, + "category" => "geolocated", + "member" => $code_super + ); + //echo json_encode($fields)."

\n"; + $default_num++; + + /*$this->db->trans_begin(); + $fields_string = http_build_query($fields); + $ch = curl_init(); + curl_setopt($ch, CURLOPT_URL, $url); + curl_setopt($ch, CURLOPT_POST, 1); + curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($fields)); + curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: text/plain')); + $result = curl_exec($ch); + curl_close($ch); + if ($this->db->trans_status() === FALSE) { + $this->db->trans_rollback(); + } else { + $this->db->trans_commit(); + }*/ + } + + $n1 = 1; + } + + /*$data[0] = utf8_encode($data[0]); + $data[0] = str_replace( chr( 194 ) . chr( 160 ), ' ', $data[0] ); + $inf = explode("+", str_replace( chr( 194 ) . chr( 160 ), ' ', $data[0] )); + $address = str_replace( chr( 194 ) . chr( 160 ), ' ', $data[0] ).' '.$inf[0]; + $contact_correct = str_replace('-','',$inf[1]); + $num_contact ='+'.$contact_correct; + echo "

$num fields in line $row:

\n"; + echo $lastname."

\n"; + echo json_encode($data)."

\n";*/ + } + $row++; + } + fclose($handle); + } + + /*$address = ""; + $position = get_lat_lng($address); + $lat = $position['lat']; + $lng = $position["lng"];*/ + + + } + + public function campagne_geocoding_wari(){ + + function get_lat_lng($address){ + + $address_encoding = htmlentities(urlencode($address)); + $api = "AIzaSyClYkvZ3XUD9EKZv3Z2BLzkr7wBoV2aQ98"; + + $url = "https://maps.googleapis.com/maps/api/geocode/json?address=".$address_encoding."&key=".$api; + $contents = file_get_contents($url); + if($contents !== false){ + $contents = utf8_encode($contents); + $results = json_decode($contents); + //echo json_encode($results->status). "
\n"; + if($results->status == "OK"){ + $data = $results->results; + //echo json_encode($url). "
\n"; + //echo json_encode($contents). "
\n"; + $lat = $data[0]->geometry->location->lat; + $lng = $data[0]->geometry->location->lng; + $adress = $data[0]->formatted_address; + //$ville = $data[0]->address_components[2]->long_name; + $position["lat"] = $lat; + $position["lng"] = $lng; + $position["adresse"] = $address; + $results = $data; + + /*if ($results[0]) { + $num = sizeof($results[0]->address_components); + for ($i=0; $i<$num; $i++) { + $num2 = sizeof($results[0]->address_components[$i]->types); + for ($b=0;$b<$num2;$b++) { + if ($results[0]->address_components[$i]->types[$b] == "locality") { + $city= $results[0]->address_components[$i]; + break; + } + } + } + }*/ + //$position["ville"] = $city->long_name; + return $position; + }else{ + return null; + } + }else{ + return null; + } + } + $url = 'https://ilink-app.com/mobilebackendtest/interacted/MembersAction.php'; + $row = 1; + $nom = ""; + $address = ""; + $num_contact =""; + $n1=1; + $n2=1; + $ok = true; + $ct = 0; + $default_num = 33900006121; + $lastname = ""; + + if (($handle = fopen("https://ilink-app.com/backofficeiLinkTest/application/controllers/WARI_paris.csv", "r")) !== FALSE) { + while (($data = fgetcsv($handle, 10000, ";")) !== FALSE) { + $num = count($data); + $num = 1; + //echo "

$num fields in line $row:

\n"; + if($row>516){ + for ($c=0; $c < $num; $c++) { + //echo $data[$c] . "
\n"; + + if($n1 == 1){ + $nom = $data[$c]; + $n1++; + + }elseif($n1==2){ + $address_temp = $data[$c]; + $n1++; + }elseif($n1 == 3){ + $n1++; + }elseif($n1 == 4){ + $phone = $data[$c]; + $num_contact = str_replace(' ', '', str_replace('00', '+', $phone)); + + $network_name = "Wari"; + $network_id = 160; + $email = 'wari.fr@ilink-app.com'; + $code_super = "h6pLJn8tcb"; + + $position = get_lat_lng(utf8_encode($address_temp)); + if($position == null){ + $n1 = 1; + break; + } + $lat = $position['lat']; + $lng = $position['lng']; + //$ville = $position['ville']; + $address = $position['adresse']; + //$town_id = $this->user_model->getTownId($ville); + + $fields = array( + "tag" => "member", + "type" => "create_geolocated_user", + "lastname" => addslashes($nom), + "phone" => $num_contact, + "phone_transaction" => '+'.$default_num, + "address" => $address, + "lang" => "fr", + "email" => $email, + "password" => "1234", + "town" => ["id" => 3, "country_id" => 74, "name" => "France", "status" => 1], + "network" => ["id" => $network_id, "country_id" => 74, "name" => $network_name], + "latitude" => $lat, + "longitude" => $lng, + "category" => "geolocated", + "member" => $code_super + ); + + $default_num++; + //echo 'Groupe '.$n2."

\n"; + //echo json_encode($fields)."

\n"; + $n2++; + $this->db->trans_begin(); + $fields_string = http_build_query($fields); + $ch = curl_init(); + curl_setopt($ch, CURLOPT_URL, $url); + curl_setopt($ch, CURLOPT_POST, 1); + curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($fields)); + curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: text/plain')); + $result = curl_exec($ch); + curl_close($ch); + if ($this->db->trans_status() === FALSE) { + $this->db->trans_rollback(); + } else { + $this->db->trans_commit(); + } + $n1 = 1; + } + + /*$data[0] = utf8_encode($data[0]); + $data[0] = str_replace( chr( 194 ) . chr( 160 ), ' ', $data[0] ); + $inf = explode("+", str_replace( chr( 194 ) . chr( 160 ), ' ', $data[0] )); + $address = str_replace( chr( 194 ) . chr( 160 ), ' ', $data[0] ).' '.$inf[0]; + $contact_correct = str_replace('-','',$inf[1]); + $num_contact ='+'.$contact_correct; + echo "

$num fields in line $row:

\n"; + echo $lastname."

\n"; + echo json_encode($data)."

\n";*/ + } + } + $row++; + } + fclose($handle); + } + + /*$address = ""; + $position = get_lat_lng($address); + $lat = $position['lat']; + $lng = $position["lng"];*/ + + + } + + public function campagne_geocoding_express_union(){ + + function get_lat_lng($address){ + + $address_encoding = htmlentities(urlencode($address)); + $api = "AIzaSyClYkvZ3XUD9EKZv3Z2BLzkr7wBoV2aQ98"; + + $url = "https://maps.googleapis.com/maps/api/geocode/json?address=".$address_encoding."&key=".$api; + $contents = file_get_contents($url); + if($contents !== false){ + $contents = utf8_encode($contents); + $results = json_decode($contents); + $data = $results->results; + $lat = $data[0]->geometry->location->lat; + $lng = $data[0]->geometry->location->lng; + $adress = $data[0]->formatted_address; + $ville = $data[0]->address_components[2]->long_name; + $position["lat"] = $lat; + $position["lng"] = $lng; + $position["adresse"] = $address; + $results = $data; + + if ($results[0]) { + $num = sizeof($results[0]->address_components); + for ($i=0; $i<$num; $i++) { + $num2 = sizeof($results[0]->address_components[$i]->types); + for ($b=0;$b<$num2;$b++) { + if ($results[0]->address_components[$i]->types[$b] == "locality") { + $city= $results[0]->address_components[$i]; + break; + } + } + } + } + $position["ville"] = $city->long_name; + return $position; + }else{ + return null; + } + } + $url = 'https://ilink-app.com/mobilebackendtest/interacted/MembersAction.php'; + $row = 1; + $nom = ""; + $address = ""; + $num_contact =""; + $n1=1; + $n2=0; + $ok = true; + $ct = 0; + $default_num = 33900007000; + $lastname = ""; + + if (($handle = fopen("https://ilink-app.com/backofficeiLinkTest/application/controllers/Express_union.csv", "r")) !== FALSE) { + while (($data = fgetcsv($handle, 10000, ";")) !== FALSE) { + $num = count($data); + //echo "

$num fields in line $row:

\n"; + for ($c=0; $c < $num; $c++) { + //echo $data[$c] . "
\n"; + if($n1 == 1){ + $nom = $data[$c]; + $n1++; + //echo $address_temp; + }elseif($n1 == 2){ + $address_temp = $data[$c]; + $n1++; + }elseif($n1 == 3){ + $address_temp = $address_temp.', '.$data[$c]; + $n1++; + }elseif($n1 == 4){ + $num_contact = '+33'.str_replace(' ','',$data[$c]); + + $network_name = "Express Union"; + $network_id = 99; + $email = 'expressunion.fr@ilink-app.com'; + $code_super = "fUdUbrsUcr"; + + $position = get_lat_lng(utf8_encode($address_temp)); + $lat = $position['lat']; + $lng = $position['lng']; + $address = str_replace( chr( 194 ) . chr( 160 ), ' ', $position['adresse']); + + $fields = array( + "tag" => "member", + "type" => "create_geolocated_user", + "lastname" => addslashes($nom), + "phone" => $num_contact, + "phone_transaction" => '+'.$default_num, + "address" => $address, + "lang" => "fr", + "email" => $email, + "password" => "1234", + "town" => ["id" => 3, "country_id" => 74, "name" => "France", "status" => 1], + "network" => ["id" => $network_id, "country_id" => 74, "name" => $network_name], + "latitude" => $lat, + "longitude" => $lng, + "category" => "geolocated", + "member" => $code_super + ); + $default_num++; + //echo var_dump($fields)."

\n"; + $this->db->trans_begin(); + $fields_string = http_build_query($fields); + $ch = curl_init(); + curl_setopt($ch, CURLOPT_URL, $url); + curl_setopt($ch, CURLOPT_POST, 1); + curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($fields)); + curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: text/plain')); + $result = curl_exec($ch); + curl_close($ch); + if ($this->db->trans_status() === FALSE) { + $this->db->trans_rollback(); + } else { + $this->db->trans_commit(); + } + $n1 = 1; + } + + /*$data[0] = utf8_encode($data[0]); + $data[0] = str_replace( chr( 194 ) . chr( 160 ), ' ', $data[0] ); + $inf = explode("+", str_replace( chr( 194 ) . chr( 160 ), ' ', $data[0] )); + $address = str_replace( chr( 194 ) . chr( 160 ), ' ', $data[0] ).' '.$inf[0]; + $contact_correct = str_replace('-','',$inf[1]); + $num_contact ='+'.$contact_correct; + echo "

$num fields in line $row:

\n"; + echo $lastname."

\n"; + echo json_encode($data)."

\n";*/ + } + $row++; + } + fclose($handle); + } + + /*$address = ""; + $position = get_lat_lng($address); + $lat = $position['lat']; + $lng = $position["lng"];*/ + + + } + + public function campagne_geocoding_juba_dubai(){ + + function get_lat_lng($address){ + + $address_encoding = htmlentities(urlencode($address)); + $api = "AIzaSyClYkvZ3XUD9EKZv3Z2BLzkr7wBoV2aQ98"; + + $url = "https://maps.googleapis.com/maps/api/geocode/json?address=".$address_encoding."&key=".$api; + $contents = file_get_contents($url); + if($contents !== false){ + $contents = utf8_encode($contents); + $results = json_decode($contents); + $data = $results->results; + $lat = $data[0]->geometry->location->lat; + $lng = $data[0]->geometry->location->lng; + $adress = $data[0]->formatted_address; + $ville = $data[0]->address_components[2]->long_name; + $position["lat"] = $lat; + $position["lng"] = $lng; + $position["adresse"] = $address; + $results = $data; + + if ($results[0]) { + $num = sizeof($results[0]->address_components); + for ($i=0; $i<$num; $i++) { + $num2 = sizeof($results[0]->address_components[$i]->types); + for ($b=0;$b<$num2;$b++) { + if ($results[0]->address_components[$i]->types[$b] == "locality") { + $city= $results[0]->address_components[$i]; + break; + } + } + } + } + $position["ville"] = $city->long_name; + return $position; + }else{ + return null; + } + } + $url = 'https://ilink-app.com/mobilebackendtest/interacted/MembersAction.php'; + $row = 1; + $nom = ""; + $address = ""; + $num_contact =""; + $default_num = 97100002002; + + $network_name = "Juba"; + $network_id = 157; + $email = 'juba.ae@ilink-app.com'; + $code_super = "PoGOE9Fn2J"; + + $nom = 'INTERNATIONAL DEVELOPMENT EXCHANGE'; + $address = 'Sharjah dawara saaa, United Arab Emirates'; + $num_contact = '+971505547229'; + + $position = get_lat_lng($address); + $lat = $position['lat']; + $lng = $position['lng']; + $ville = $position['ville']; + $address = $position['adresse']; + //$town_id = $this->user_model->getTownId($ville); + + + $fields = array( + "tag" => "member", + "type" => "create_geolocated_user", + "lastname" => addslashes($nom), + "phone" => $num_contact, + "phone_transaction" => '+'.$default_num, + "address" => addslashes($address), + "lang" => "fr", + "email" => $email, + "password" => "1234", + "town" => ["id" => 30, "country_id" => 233, "name" => "United Arab Emirates", "status" => 1], + "network" => ["id" => $network_id, "country_id" => 233, "name" => $network_name], + "latitude" => $lat, + "longitude" => $lng, + "category" => "geolocated", + "member" => $code_super + ); + $default_num++; + //echo json_encode($fields)."

\n"; + $this->db->trans_begin(); + $fields_string = http_build_query($fields); + $ch = curl_init(); + curl_setopt($ch, CURLOPT_URL, $url); + curl_setopt($ch, CURLOPT_POST, 1); + curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($fields)); + curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: text/plain')); + $result = curl_exec($ch); + curl_close($ch); + if ($this->db->trans_status() === FALSE) { + $this->db->trans_rollback(); + } else { + $this->db->trans_commit(); + } + + } + + public function campagne_geocoding_dubai_ria(){ + + function get_lat_lng($address){ + + $address_encoding = htmlentities(urlencode($address)); + $api = "AIzaSyClYkvZ3XUD9EKZv3Z2BLzkr7wBoV2aQ98"; + + $url = "https://maps.googleapis.com/maps/api/geocode/json?address=".$address_encoding."&key=".$api; + $contents = file_get_contents($url); + if($contents !== false){ + $contents = utf8_encode($contents); + $results = json_decode($contents); + $data = $results->results; + if($data != []){ + $lat = $data[0]->geometry->location->lat; + $lng = $data[0]->geometry->location->lng; + $adress = $data[0]->formatted_address; + $position["lat"] = $lat; + $position["lng"] = $lng; + $position["adresse"] = $address; + $position["ville"] = null; + if ($data[0]) { + $num = sizeof($data[0]->address_components); + for ($i=0; $i<$num; $i++) { + $num2 = sizeof($data[0]->address_components[$i]->types); + for ($b=0;$b<$num2;$b++) { + if ($data[0]->address_components[$i]->types[$b] == "locality") { + $city= $data[0]->address_components[$i]; + if($city->long_name){ + //echo $city->long_name. "
\n"; + $position["ville"] = $city->long_name; + } + break; + } + } + } + } + + }else{ + $position = null; + } + return $position; + }else{ + return null; + } + } + $url = 'https://ilink-app.com/mobilebackendtest/interacted/MembersAction.php'; + $row = 1; + $nom = ""; + $address = ""; + $num_contact =""; + $n1=1; + $n2=1; + $ok = true; + $ct = 0; + $default_num = 97100003010; + $lastname = ""; + + if (($handle = fopen("https://ilink-app.com/backofficeiLinkTest/application/controllers/ria_dubai.csv", "r")) !== FALSE) { + while (($data = fgetcsv($handle, 10000, ";")) !== FALSE) { + $num = count($data); + $num = 1; + //echo "

$num fields in line $row:

\n"; + for ($c=0; $c < $num; $c++) { + //echo $data[$c] . "
\n"; + if($n1 == 1){ + $nom = $data[$c]; + $n1++; + //echo $address_temp; + }elseif($n1 == 2){ + $infos = utf8_encode($data[$c]); + $adress1 = str_replace( chr( 194 ) . chr( 160 ), ' ', $infos ); + $n1++; + }elseif($n1 == 3){ + $infos = utf8_encode($data[$c]); + $adress_temp = $adress1.' '.str_replace( chr( 194 ) . chr( 160 ), ' ', $infos ); + + + $network_name = "Ria"; + $network_id = 183; + $email = 'ria.ae@ilink-app.com'; + $code_super = "z3GRV23fOV"; + //$town_id = $this->user_model->getTownId($town_name); + + $position = get_lat_lng($adress_temp); + $num_contact = '+'.$default_num; + $adress = $position["adresse"]; + $lat = $position['lat']; + $lng = $position['lng']; + + if($position['ville'] != null && $position['ville'] == 'Sharjah'){ + //echo "

fields number $n2:

\n"; + $n2++; + $fields = array( + "tag" => "member", + "type" => "create_geolocated_user", + "lastname" => addslashes($nom), + "phone" => $num_contact, + "phone_transaction" => '+'.$default_num, + "address" => $adress, + "lang" => "fr", + "email" => $email, + "password" => "1234", + "town" => ["id" => 30, "country_id" => 233, "name" => "United Arab Emirates", "status" => 1], + "network" => ["id" => $network_id, "country_id" => 74, "name" => $network_name], + "latitude" => $lat, + "longitude" => $lng, + "category" => "geolocated", + "member" => $code_super + ); + $default_num++; + + //echo json_encode($fields)."

\n"; + $this->db->trans_begin(); + $fields_string = http_build_query($fields); + $ch = curl_init(); + curl_setopt($ch, CURLOPT_URL, $url); + curl_setopt($ch, CURLOPT_POST, 1); + curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($fields)); + curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: text/plain')); + $result = curl_exec($ch); + curl_close($ch); + if ($this->db->trans_status() === FALSE) { + $this->db->trans_rollback(); + } else { + $this->db->trans_commit(); + } + } + $n1 = 1; + } + + /*$data[0] = utf8_encode($data[0]); + $data[0] = str_replace( chr( 194 ) . chr( 160 ), ' ', $data[0] ); + $inf = explode("+", str_replace( chr( 194 ) . chr( 160 ), ' ', $data[0] )); + $address = str_replace( chr( 194 ) . chr( 160 ), ' ', $data[0] ).' '.$inf[0]; + $contact_correct = str_replace('-','',$inf[1]); + $num_contact ='+'.$contact_correct; + echo "

$num fields in line $row:

\n"; + echo $lastname."

\n"; + echo json_encode($data)."

\n";*/ + } + $row++; + } + fclose($handle); + } + + /*$address = ""; + $position = get_lat_lng($address); + $lat = $position['lat']; + $lng = $position["lng"];*/ + + + } + + public function campagne_geocoding_dubai_small_world(){ + + function get_lat_lng($address){ + + $address_encoding = htmlentities(urlencode($address)); + $api = "AIzaSyClYkvZ3XUD9EKZv3Z2BLzkr7wBoV2aQ98"; + + $url = "https://maps.googleapis.com/maps/api/geocode/json?address=".$address_encoding."&key=".$api; + $contents = file_get_contents($url); + if($contents !== false){ + $contents = utf8_encode($contents); + $results = json_decode($contents); + $data = $results->results; + if($data != []){ + $lat = $data[0]->geometry->location->lat; + $lng = $data[0]->geometry->location->lng; + $adress = $data[0]->formatted_address; + $position["lat"] = $lat; + $position["lng"] = $lng; + $position["adresse"] = $address; + $position["ville"] = null; + if ($data[0]) { + $num = sizeof($data[0]->address_components); + for ($i=0; $i<$num; $i++) { + $num2 = sizeof($data[0]->address_components[$i]->types); + for ($b=0;$b<$num2;$b++) { + if ($data[0]->address_components[$i]->types[$b] == "locality") { + $city= $data[0]->address_components[$i]; + if($city->long_name){ + //echo $address. "
\n"; + //echo $city->long_name. "
\n"; + $position["ville"] = $city->long_name; + } + break; + } + } + } + } + + }else{ + $position = null; + } + return $position; + }else{ + return null; + } + } + $url = 'https://ilink-app.com/mobilebackendtest/interacted/MembersAction.php'; + $row = 1; + $nom = ""; + $address = ""; + $num_contact =""; + $n1=1; + $n2=1; + $ok = true; + $ct = 0; + $default_num = 97100005301; + $lastname = ""; + + if (($handle = fopen("https://ilink-app.com/backofficeiLinkTest/application/controllers/small_world_dubai.csv", "r")) !== FALSE) { + while (($data = fgetcsv($handle, 10000, ";")) !== FALSE) { + $num = count($data); + $num = 1; + //echo "

$num fields in line $row:

\n"; + for ($c=0; $c < $num; $c++) { + //echo $data[$c] . "
\n"; + if($n1 == 1){ + $nom = $data[$c]; + $n1++; + //echo $address_temp; + }elseif($n1 == 2){ + $infos = utf8_encode($data[$c]); + $adress_temp = str_replace( chr( 194 ) . chr( 160 ), ' ', $infos ); + $n1++; + }elseif($n1 == 3){ + $infos = utf8_encode($data[$c]); + $inf = explode('/',$infos); + if(isset($inf[1])){ + $infos = $inf[0]; + }else{ + + } + $num_contact = str_replace('-','',str_replace( 'CONTACT00', '+', $infos )); + $num_contact = str_replace( 'CONTACT04', '+9714', $num_contact); + $num_contact = str_replace( 'CONTACT06', '+9716', $num_contact); + $num_contact = str_replace( 'CONTACT+9', '+9', $num_contact); + $num_contact = str_replace( 'CONTACT9', '+9', $num_contact); + $num_contact = str_replace( 'CONTACTEZ LE00', '+', $num_contact); + $num_contact = str_replace( ' ', '', $num_contact); + + + $network_name = "Small World"; + $network_id = 146; + $email = 'smallworld.ae@ilink-app.com'; + $code_super = "L6WtcGgYrh"; + //$town_id = $this->user_model->getTownId($town_name); + + $position = get_lat_lng($adress_temp); + $adress = $position["adresse"]; + $lat = $position['lat']; + $lng = $position['lng']; + + if($position['ville'] != null && $position['ville'] == 'Ajman'){ + //echo "

fields number $n2:

\n"; + //echo $position['ville']."

\n"; + $n2++; + $fields = array( + "tag" => "member", + "type" => "create_geolocated_user", + "lastname" => addslashes($nom), + "phone" => $num_contact, + "phone_transaction" => '+'.$default_num, + "address" => $adress, + "lang" => "fr", + "email" => $email, + "password" => "1234", + "town" => ["id" => 31, "country_id" => 233, "name" => "United Arab Emirates", "status" => 1], + "network" => ["id" => $network_id, "country_id" => 74, "name" => $network_name], + "latitude" => $lat, + "longitude" => $lng, + "category" => "geolocated", + "member" => $code_super + ); + $default_num++; + + //echo json_encode($fields)."

\n"; + //var_dump($fields); + $this->db->trans_begin(); + $fields_string = http_build_query($fields); + $ch = curl_init(); + curl_setopt($ch, CURLOPT_URL, $url); + curl_setopt($ch, CURLOPT_POST, 1); + curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($fields)); + curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: text/plain')); + $result = curl_exec($ch); + curl_close($ch); + if ($this->db->trans_status() === FALSE) { + $this->db->trans_rollback(); + } else { + $this->db->trans_commit(); + } + } + $n1 = 1; + } + + /*$data[0] = utf8_encode($data[0]); + $data[0] = str_replace( chr( 194 ) . chr( 160 ), ' ', $data[0] ); + $inf = explode("+", str_replace( chr( 194 ) . chr( 160 ), ' ', $data[0] )); + $address = str_replace( chr( 194 ) . chr( 160 ), ' ', $data[0] ).' '.$inf[0]; + $contact_correct = str_replace('-','',$inf[1]); + $num_contact ='+'.$contact_correct; + echo "

$num fields in line $row:

\n"; + echo $lastname."

\n"; + echo json_encode($data)."

\n";*/ + } + $row++; + } + fclose($handle); + } + + /*$address = ""; + $position = get_lat_lng($address); + $lat = $position['lat']; + $lng = $position["lng"];*/ + + + } + + public function anbg(){ + $url = "https://www.anbg.ga/Result-CT/traitement-recherche.php?recherche=FRA&choix=Pays"; + $contents = file_get_contents($url); + echo($contents); + } + + +} diff --git a/application/language/french/message_lang.php b/application/language/french/message_lang.php index 4b0e2d39..9e8ec804 100755 --- a/application/language/french/message_lang.php +++ b/application/language/french/message_lang.php @@ -480,4 +480,6 @@ $lang['interest_rates'] = 'Taux d\'intérêts'; $lang['interest_rates_period'] = 'Période (en mois)'; $lang['nano_credit_update'] = 'Mise à jour du nano crédit'; $lang['transaction_nano_credit'] = 'Taxes sur le nano crédit'; +$lang['edit_nano_credit'] = 'Configuration du nano credit'; +$lang['edit_savings'] = 'Configuration de l\'épargne' ?> diff --git a/application/models/User_model.php b/application/models/User_model.php index 2f8806a1..3a04d616 100755 --- a/application/models/User_model.php +++ b/application/models/User_model.php @@ -2576,13 +2576,14 @@ class User_model extends CI_Model } public function getIlinkTransactions($debut , $fin , $id_network){ - $chain = $debut ? " AND date BETWEEN '".$debut."' AND '".$fin."'" : ""; + $chain = $debut ? " AND date BETWEEN '" . $debut . "' AND '" . $fin . "'" : ""; $query = $this->db->query("SELECT * FROM infos_ilink_transaction - WHERE `network_emetteur`=".$id_network.$chain); - if($query->num_rows()>0){ + WHERE `network_emetteur`=" . $id_network . $chain); + var_dump($query->result_array()); + if ($query->num_rows() > 0) { return $query; - }else{ + } else { return false; } } @@ -2703,10 +2704,10 @@ class User_model extends CI_Model } } - public function getNanoCreditRates($idConfig) + public function getNanoCreditRates($idConfig, $type = 'nano_credit') { - $sql = "SELECT * FROM `paliersConfigNanoCredit` WHERE (`idConfig` = ? );"; - $query = $this->db->query($sql, array($idConfig)); + $sql = "SELECT * FROM `paliersConfigNanoCredit` WHERE (`idConfig` = ? AND `type` = ? );"; + $query = $this->db->query($sql, array($idConfig, $type)); if ($query->num_rows() > 0) { return $query; } else { @@ -2714,17 +2715,30 @@ class User_model extends CI_Model } } - public function deleteNanoCreditRates($idConfig) + public function deleteNanoCreditRates($idConfig, $type = 'nano_credit') { - $sql = "DELETE FROM `paliersConfigNanoCredit` WHERE (`idConfig` = ? );"; - $query = $this->db->query($sql, array($idConfig)); + $sql = "DELETE FROM `paliersConfigNanoCredit` WHERE (`idConfig` = ? AND `type` = ? );"; + $query = $this->db->query($sql, array($idConfig, $type)); return $query; } - public function addNanoCreditRates($idConfig, $duree, $valeur) + public function addNanoCreditRates($idConfig, $duree, $valeur, $type = 'nano_credit') { - $sql = "INSERT INTO `paliersConfigNanoCredit` (`duree_mois`, `taux`, `idConfig`) VALUES (?,?,?);"; - $query = $this->db->query($sql, array($duree, $valeur, $idConfig)); + $sql = "INSERT INTO `paliersConfigNanoCredit` (`duree_mois`, `taux`, `idConfig` ,`type`) VALUES (?,?,?,?);"; + $query = $this->db->query($sql, array($duree, $valeur, $idConfig, $type)); return $query; } + + public function getUserDemandesCredit($debut, $fin, $id_network) + { + $chain = $debut ? " AND date_creation BETWEEN '" . $debut . "' AND '" . $fin . "'" : ""; + $query = $this->db->query("SELECT * + FROM infos_users_demandes_credits + WHERE `id_network`='" . $id_network . "'" . $chain); + if ($query->num_rows() > 0) { + return $query; + } else { + return false; + } + } } diff --git a/application/views/header_hyp.php b/application/views/header_hyp.php index 4fb9fb0d..117102a1 100755 --- a/application/views/header_hyp.php +++ b/application/views/header_hyp.php @@ -146,7 +146,8 @@ echo "active "; } ?>"> - lang->line('Demandes adhésion'); ?> + + lang->line('Demandes adhésion'); ?> " style="height: auto;"> - + lang->line('wallet_management'); ?> @@ -197,7 +198,7 @@ echo "active"; } ?>"> - Nano credit + Nano credit diff --git a/application/views/historique_transactions_ilink.php b/application/views/historique_transactions_ilink.php index 8c263533..c8667b5f 100755 --- a/application/views/historique_transactions_ilink.php +++ b/application/views/historique_transactions_ilink.php @@ -161,18 +161,12 @@ use Brick\Money\Money; first_row(); + foreach ($transactions->result() as $row) { $num++; $net = 0; $banque = 0; -// if($row->type_transaction == 'depot'){ -// $net = $row->montant_depot; -// $banque = $row->montant * (1 - ($config->taux_com_client_depot / 100)); -// }else{ -// $net = $row->montant_retrait ; -// } $moneyNetInit = Money::of(round($row->montant_net ,2), $row->init_currency,$context); if($row->destinataire_phone){ $destinataire = $row->destinataire_phone.' | '.$row->destinataire_name; diff --git a/application/views/nano_credit/config_nano_credit.php b/application/views/nano_credit/config_nano_credit.php new file mode 100755 index 00000000..587a5278 --- /dev/null +++ b/application/views/nano_credit/config_nano_credit.php @@ -0,0 +1,664 @@ + + + + + + + + + + + + +
+ +
+ +

+ lang->line('edit_nano_credit') . ' - ' . $network . ' - ' . $country; ?> +

+ +
+ +

Erreur!

+ +
+ + +
+ +

Success!

+ +
+ + + +
+ +
+
+
+
+ +
+
+
+
+ +
+
+
+ +
+
+
+
+

lang->line('interest_rates'); ?>

+
+
+ + + + + + + + + result() as $row) { + echo " + + " . ' + '; + } + } + ?> + +
lang->line('interest_rates_period'); ?> lang->line('rate'); ?>
" . $row->duree_mois . "" . $row->taux . "
+
+
+
+
+
+
+

lang->line('transaction_nano_credit'); ?>

+
+
+ + + + + + + + + + result() as $row) { + echo " + + + " . ' + '; + } + } + ?> + +
lang->line('Nom'); ?> TypeValeur
" . $row->nom . "" . $row->type . "" . $row->valeur . "
+
+
+
+
+ + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/application/views/nano_credit/config_savings.php b/application/views/nano_credit/config_savings.php new file mode 100755 index 00000000..f07a269e --- /dev/null +++ b/application/views/nano_credit/config_savings.php @@ -0,0 +1,666 @@ + + + + + + + + + + + + +
+ +
+ +

+ lang->line('edit_savings') . ' - ' . $network . ' - ' . $country; ?> +

+ +
+ +

Erreur!

+ +
+ + +
+ +

Success!

+ +
+ + + +
+ +
+
+
+
+ +
+
+
+
+ +
+
+
+ +
+
+
+
+

lang->line('interest_rates'); ?>

+
+
+ + + + + + + + + result() as $row) { + echo " + + " . ' + '; + } + } + ?> + +
lang->line('interest_rates_period'); ?> lang->line('rate'); ?>
" . $row->duree_mois . "" . $row->taux . "
+
+
+
+
+
+
+

lang->line('transaction_nano_credit'); ?>

+
+
+ + + + + + + + + + result() as $row) { + echo " + + + " . ' + '; + } + } + ?> + +
lang->line('Nom'); ?> TypeValeur
" . $row->nom . "" . $row->type . "" . $row->valeur . "
+
+
+
+
+ + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/application/views/nano_credit/gestion_nano_credit_hyp.php b/application/views/nano_credit/gestion_nano_credit_hyp.php index 766d4e88..2af409d4 100755 --- a/application/views/nano_credit/gestion_nano_credit_hyp.php +++ b/application/views/nano_credit/gestion_nano_credit_hyp.php @@ -9,106 +9,6 @@ -
- + lang->line('edit_nano_credit') ?>
- -
-
- - -
-
-
-
-

lang->line('interest_rates'); ?>

-
-
- - - - - - - - - result() as $row) { - echo " - - " . ' - '; - } - } - ?> - -
lang->line('interest_rates_period'); ?> lang->line('rate'); ?>
" . $row->duree_mois . "" . $row->taux . "
-
-
-
-
-
-
-

lang->line('transaction_nano_credit'); ?>

-
-
- - - - - - - - - - result() as $row) { - echo " - - - " . ' - '; - } - } - ?> - -
lang->line('Nom'); ?> TypeValeur
" . $row->nom . "" . $row->type . "" . $row->valeur . "
-
+ lang->line('edit_savings') ?>
@@ -375,140 +214,6 @@ $context = new \Brick\Money\Context\AutoContext(); - - @@ -617,257 +322,6 @@ $context = new \Brick\Money\Context\AutoContext(); } }); - - $('#saveRates').click(function () { - const network_id = $(this).data('network-id'); - const id_config = $(this).data('id-config'); - // Paliers - var rates = []; - - $('#rates tr').has('td').each(function () { - var arrayItem = {}; - $('td', $(this)).each(function (index, item) { - if (index < 2) { - if (index == 1) - arrayItem[index] = parseFloat($(item).html()); - arrayItem[index] = parseInt($(item).html()); - } - }); - rates.push(arrayItem); - }); - - if ($('#ratesForm')[0].checkValidity()) { - - console.log(rates) - $.ajax({ - url: '', - type: 'POST', - dataType: 'json', - data: { - "id_config": id_config, - "rates": rates, - }, - success: function (data) { - if (data == '200') { - Swal.fire({ - icon: 'success', - title: "lang->line('nano_credit_update')?>", - text: "lang->line('informations_updated')?>", - timer: 3000 - }).then(() => { - location.reload(); - }); - - } else { - toastr.error("lang->line('error_message')?>", "lang->line('request_error')?>"); - } - }, - - error: function (resultat, statut, error) { - console.log(resultat + " " + error); - toastr.error("lang->line('error_message')?>", "lang->line('request_error')?>"); - } - }); - - } else { - $('#ratesForm')[0].reportValidity(); - } - - }); - - $('#saveTaxes').click(function () { - const network_id = $(this).data('network-id'); - const id_config = $(this).data('id-config'); - // Paliers - var taxes = []; - - $('#nano_credit_taxes tr').has('td').each(function () { - var arrayItem = {}; - $('td', $(this)).each(function (index, item) { - if (index < 3) { - if (index == 2) - arrayItem[index] = parseFloat($(item).html()); - arrayItem[index] = $(item).html(); - } - }); - taxes.push(arrayItem); - }); - - if ($('#taxForm')[0].checkValidity()) { - - $.ajax({ - url: '', - type: 'POST', - dataType: 'json', - data: { - "categorie": 'nano_credit', "id_config": id_config, - "taxes": taxes, - }, - success: function (data) { - if (data == '200') { - Swal.fire({ - icon: 'success', - title: "lang->line('nano_credit_update')?>", - text: "lang->line('informations_updated')?>", - timer: 3000 - }).then(() => { - location.reload(); - }); - - } else { - toastr.error("lang->line('error_message')?>", "lang->line('request_error')?>"); - } - }, - - error: function (resultat, statut, error) { - console.log(resultat + " " + error); - toastr.error("lang->line('error_message')?>", "lang->line('request_error')?>"); - } - }); - - - } else { - $('#taxForm')[0].reportValidity(); - } - - }); - - - diff --git a/application/views/nano_credit/historique_nano_credit.php b/application/views/nano_credit/historique_nano_credit.php new file mode 100755 index 00000000..5701d7c0 --- /dev/null +++ b/application/views/nano_credit/historique_nano_credit.php @@ -0,0 +1,351 @@ + + + + + +
+ setTimezone($timezone); + return $carbon->toDateTimeString(); + } + return $date; + } + + ?> + +
+ +

+ lang->line('Gestion des wallets'); + echo ' ' . $network . ' - ' . $country + . ' :: ' . $this->lang->line('Historique des transactions'); ?> + + +

+ +
+ +

Erreur!

+ +
+ + +
+ +

Success!

+ +
+ + db->hostname . ';dbname=' . $this->db->database, $this->db->username, $this->db->password); + + $configuration = new PDOProviderConfiguration(); + + $configuration->tableName = 'exchange_rate'; + $configuration->exchangeRateColumnName = 'exchange_rate'; + $configuration->targetCurrencyColumnName = 'target_currency'; + $configuration->sourceCurrencyCode = $baseCurrency; + + // this provider loads exchange rates from your database + $provider = new PDOProvider($pdo, $configuration); + + // this provider calculates exchange rates relative to the base currency + $provider = new BaseCurrencyProvider($provider, $baseCurrency); + + // this currency converter can now handle any currency pair + $converter = new CurrencyConverter($provider); + $context = new AutoContext(); + ?> +
+
+
+
+
+ +
+ lang->line('Période') ?> + + + + + Format : session->userdata('site_lang') === 'french' ? 'Jour - Mois - Année ' : 'Year - Month - Day' ?> +
+
+
+ +
+
+
+
+
+

lang->line('export_transaction_history') ?>

+
+
+ num_rows(); + $num = 0; + if ($numrows > 0) { + $fmt = new NumberFormatter('fr_FR', NumberFormatter::DECIMAL); + ?> + + + + + + + + + + + + + + + + + + + + + + result() as $row) { + $num++; + if ($row->user_phone) { + $emetteur = $row->user_phone . ' | ' . $row->user; + } else { + $emetteur = ($row->nom_emetteur ? $row->nom_emetteur : '') . (' ' . $row->prenom_emetteur ? $row->prenom_emetteur : ''); + } + $moneyNet = Money::of(round($row->montant, 2), $currency_code, $context); + if ($row->type_caution == 'individuel') + $retrait = $row->retrait_cash ? 'OUI' : 'NON'; + else + $retrait = ""; + echo " + + + + + + + + + + + + + "; + ?> + + + + + + lang->line('Aucune demande'); + } + } else { + echo $this->lang->line('Aucune demande'); + } + ?> + +
IDEtatCautionDuree (en mois)lang->line('Montant') ?>lang->line('fees') ?>lang->line('tax') ?>lang->line('agent_name') ?>lang->line('issuer_id') ?>Retrait en cashDate de la demandeDate de remboursementDate
$row->id_demande" . strtoupper($row->etat) . "" . strtoupper($row->type_caution) . "" . strtoupper($row->duree_mois) . "" . $moneyNet->formatTo('fr_FR') . "" . Money::of(round($row->frais, 2), $currency_code, $context)->formatTo('fr_FR') . "" . Money::of(round($row->taxe, 2), $currency_code, $context)->formatTo('fr_FR') . "" . $row->agent . "" . $emetteur . "" . $retrait . "" . toLocateDate($row->date_demande, $this->session->userdata('timezone')) . "" . toLocateDate($row->date_remboursement, $this->session->userdata('timezone')) . "" . toLocateDate($row->date_creation, $this->session->userdata('timezone')) . "
+ +
+
+
+
+
+ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +