diff --git a/application/config/autoload.php b/application/config/autoload.php
index a3932e38..09e51264 100644
--- a/application/config/autoload.php
+++ b/application/config/autoload.php
@@ -103,7 +103,7 @@ $autoload['helper'] = array('url', 'file');
| config files. Otherwise, leave it blank.
|
*/
-$autoload['config'] = array();
+$autoload['config'] = array('email');
/*
| -------------------------------------------------------------------
diff --git a/application/config/email.php b/application/config/email.php
new file mode 100644
index 00000000..cd090bae
--- /dev/null
+++ b/application/config/email.php
@@ -0,0 +1,14 @@
+ 'smtp', // 'mail', 'sendmail', or 'smtp'
+ 'smtp_host' => 'mail.ilink-app.com',
+ 'smtp_port' => 587,
+ 'smtp_user' => 'noreply@ilink-app.com',
+ 'smtp_pass' => 'ilink2017GA',
+ 'smtp_crypto' => 'tls', //can be 'ssl' or 'tls' for example
+ 'mailtype' => 'text', //plaintext 'text' mails or 'html'
+ 'smtp_timeout' => '5', //in seconds
+ 'charset' => 'iso-8859-1',
+ 'wordwrap' => TRUE
+);
diff --git a/application/controllers/Gestion.php b/application/controllers/Gestion.php
index 5fe4f807..bd9b26f1 100644
--- a/application/controllers/Gestion.php
+++ b/application/controllers/Gestion.php
@@ -1550,7 +1550,7 @@ class Gestion extends CI_Controller
$network_id = $this->input->get('id');
if($this->input->get('history')){
- $this->historique($network_id,$this->input->get('d'),$this->input->get('f'));
+ $this->historique($network_id,$this->input->get('d'),$this->input->get('f'),$this->input->get('history'));
}else{
$taux = $this->user_model->getTaux($network_id);
if ($taux != null) {
@@ -1596,6 +1596,8 @@ class Gestion extends CI_Controller
$data['country'] = $networkDetails->first_row()->country;
}
// $data['agentWalletInfos'] = $this->user_model->getInfosWalletAgentForHyper($network_id);
+ $res = $this->user_model->getWalletPassword($network_id) ;
+ $data['walletPassword'] = $res ? $res->first_row() : null ;
$data['active'] = "wallet";
$data['alert'] = "";
$data['game_pays'] = $this->user_model->getGameCountry();
@@ -1713,14 +1715,18 @@ class Gestion extends CI_Controller
await($pool);
}
- private function historique($network_id ,$startDate ,$endDate)
+ private function historique($network_id ,$startDate ,$endDate, $type)
{
$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['transactions'] = $this->user_model->getTransactions($startDate , $endDate ,$network_id);
+ if($type == 'transaction')
+ $data['transactions'] = $this->user_model->getTransactions($startDate , $endDate ,$network_id);
+ else
+ $data['transactions'] = $this->user_model->getRecharges($startDate , $endDate ,$network_id);
+
$data['active'] = "wallet";
$data['alert'] = "";
$data['networks'] = $this->user_model->getAllActivatedNetworks();
@@ -1732,9 +1738,149 @@ class Gestion extends CI_Controller
$data['country'] = $networkDetails->first_row()->country;
}
$this->load->view('header_gestion', $data);
- $this->load->view('historique_transactions');
+ if($type == 'transaction')
+ $this->load->view('historique_transactions');
+ else
+ $this->load->view('historique_recharges');
$this->load->view('footer');
}
+ public function walletPassword(){
+ if($this->isLogged()){
+ $data['active'] = "wallet_password";
+ $data['alert'] = "";
+ $data['game_pays'] = $this->user_model->getGameCountry();
+ $data['networks'] = $this->user_model->getAllActivatedWalletNetworks();
+ $this->load->view('header_gestion', $data);
+ $this->load->view('wallet_password');
+ $this->load->view('footer');
+ }
+ }
+
+ public function generate_wallet_password(){
+ if($this->isLogged()){
+ if (isset($_POST)) {
+ $network_id = isset($_POST['network_id']) ? $_POST['network_id'] : null;
+ $email = $_POST['email'];
+// $size = $_POST['size'];
+ $wallet_password_id = isset($_POST['wallet_password_id']) ? $_POST['wallet_password_id'] : null ;
+ $network = $_POST['network'];
+ $country = $_POST['country'];
+
+ $password = $this->generate_string();
+ $hash = $this->hashSSHA($password);
+ $encrypted_password = $hash['encrypted'] ;
+ $salt = $hash['salt'] ;
+
+ $this->load->library('email');
+ $this->email->from('noreply@ilink-app.com', 'iLink World');
+ $this->email->to($email);
+
+ $this->email->subject($this->lang->line('wallet_password').' '.$network . ' - '.$country);
+ $this->email->message($this->lang->line('mot de passe').' : '.$password);
+
+ if ($this->email->send()) {
+ if($wallet_password_id == null)
+ $this->user_model->addWalletPassword($network_id,$encrypted_password,$salt,$email);
+ else
+ $this->user_model->updateWalletPassword($wallet_password_id,$encrypted_password,$salt,$email);
+ $res = true;
+ } else {
+// show_error($this->email->print_debugger());
+ $res = false;
+ }
+
+ if ($res) {
+ echo json_encode("200");
+ } else {
+ echo json_encode("500");
+ }
+ }
+ }
+ }
+
+ private function generate_string($length = 10){
+ $chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'.
+ '0123456789-=~!@#$%^&*()_+,./<>?;:[]{}\|';
+
+ $str = '';
+ $max = strlen($chars) - 1;
+
+ for ($i=0; $i < $length; $i++)
+ $str .= $chars[mt_rand(0, $max)];
+
+ return $str;
+ }
+
+ private function hashSSHA($password) {
+ $salt = sha1(rand());
+ $salt = substr($salt, 0, 10);
+ $encrypted = base64_encode(sha1($password . $salt, true) . $salt);
+ $hash = array("salt" => $salt, "encrypted" => $encrypted);
+ return $hash;
+ }
+
+ public function resetWalletPassword(){
+ if($this->isLogged()){
+ if (isset($_POST)) {
+ $email = $_POST['email'];
+ $wallet_password_id = isset($_POST['wallet_password_id']) ? $_POST['wallet_password_id'] : null ;
+ $network = $_POST['network'];
+ $country = $_POST['country'];
+
+ $password = $this->generate_string();
+ $hash = $this->hashSSHA($password);
+ $encrypted_password = $hash['encrypted'] ;
+ $salt = $hash['salt'] ;
+
+ $this->load->library('email');
+ $this->email->from('noreply@ilink-app.com', 'iLink World');
+ $this->email->to($email);
+
+ $this->email->subject($this->lang->line('reset_wallet_password').' '.$network . ' - '.$country);
+ $this->email->message($this->lang->line('mot de passe').' : '.$password);
+
+ if ($this->email->send()) {
+ $this->user_model->updateWalletPassword($wallet_password_id,$encrypted_password,$salt,$email);
+ $res = true;
+ } else {
+// show_error($this->email->print_debugger());
+ $res = false;
+ }
+
+ if ($res) {
+ echo json_encode("200");
+ } else {
+ echo json_encode("500");
+ }
+ }
+ }
+ }
+
+ public function recharge_wallet(){
+ if($this->isLogged()){
+ if (isset($_POST)) {
+ $password = $_POST['password'];
+ $wallet_id = $_POST['wallet_id'];
+ $salt = $_POST['salt'] ;
+ $encrypted_password = $_POST['encrypted_password'];
+ $montant = $_POST['montant'];
+
+ $hash = base64_encode(sha1($password . $salt, true) . $salt);
+
+ if($encrypted_password == $hash){
+ $this->user_model->updateWalletBalance($montant,$wallet_id);
+ $res = $this->user_model->addWalletRecharge($montant,$wallet_id);
+ $code = $res ? '200' : '500' ;
+ }else{
+ $code = '400';
+ }
+
+ echo json_encode($code);
+
+ }
+ }
+ }
+
}
diff --git a/application/language/english/message_lang.php b/application/language/english/message_lang.php
index 649121cc..19fbffae 100644
--- a/application/language/english/message_lang.php
+++ b/application/language/english/message_lang.php
@@ -4,8 +4,8 @@
$lang['agent'] = 'agent';
$lang['Membre'] = 'Member';
$lang['mot de passe oublié'] = 'Forgot your password';
- $lang['identifiant'] = 'login';
- $lang['mot de passe'] = 'password';
+ $lang['identifiant'] = 'Login';
+ $lang['mot de passe'] = 'Password';
$lang['Choix de la langue'] = 'Choice of language';
$lang['Superviseur'] = 'Supervisor';
$lang['Superviseurs'] = 'Supervisors';
@@ -261,4 +261,41 @@ $lang['Solde Principal'] = 'Main Balance';
$lang['Solde Commission'] = 'Commission balance';
$lang['Commission banque'] = 'Bank commission';
$lang['Total commission de la banque'] = 'Total bank commission';
+
+// Mot de passe du wallet
+$lang['menu_wallet_password'] = 'Wallet Password' ;
+$lang['header_wallet_password'] = 'Wallet password management' ;
+$lang['activated_wallets'] = 'Wallets actifs' ;
+$lang['generated'] = 'Generated';
+$lang['not_generated'] = 'Not generated';
+$lang['generate'] = 'Generate';
+$lang['reset'] = 'Reset';
+$lang['no_wallet'] = 'No wallet';
+$lang['generate_password'] = 'Generate password';
+$lang['email'] = 'Mail address';
+$lang['password_generated'] = 'Password generated';
+$lang['informations_updated'] = 'Information has been updated';
+$lang['request_error'] = 'Request error';
+$lang['error_message'] = 'An error has occurred.';
+$lang['wallet_password'] = 'Wallet password';
+$lang['wallet_update'] = 'Wallet update';
+$lang['recharge_hypervisor_account'] = 'Reload virtual currency in the hypervisor account';
+$lang['recharge'] = 'Recharge';
+$lang['click_here'] = 'Click here';
+$lang['no_wallet_password'] = 'No password exists for this wallet, please generate a password! ';
+$lang['i_forgot_password'] = 'I forgot my password';
+$lang['transactions_historic'] = 'Transaction history';
+$lang['recharge_historic'] = 'Recharge history';
+$lang['no_recharge'] = 'No recharge';
+$lang['reset_wallet_password'] = 'Wallet password reset';
+$lang['incorrect_password'] = 'Incorrect password';
+$lang['account_recharged'] = 'Account reloaded';
+$lang['password_has_been_reset'] = 'Your password has been reset';
+$lang['management_rule'] = 'Management rules';
+$lang['first_rule'] = 'The sum of the % of the agent and supervisor withdrawals must be less than 100.';
+$lang['second_rule'] = 'The sum of the % of agent and supervisor deposits must be less than 100.';
+$lang['third_rule'] = 'The sum of the % of withdrawals must be lower than the customer withdrawal rate.';
+$lang['fourth_rule'] = 'The sum of the % of deposits must be less than 100.';
+$lang['wallet_created'] = 'New wallet created';
+$lang['wallet_deleted'] = 'Wallet deleted';
?>
diff --git a/application/language/french/message_lang.php b/application/language/french/message_lang.php
index c45b408e..a52f269c 100644
--- a/application/language/french/message_lang.php
+++ b/application/language/french/message_lang.php
@@ -4,8 +4,8 @@
$lang['agent'] = 'agent';
$lang['Membre'] = 'Membre';
$lang['mot de passe oublié'] = 'Mot de passe oublié';
- $lang['identifiant'] = 'identifiant';
- $lang['mot de passe'] = 'mot de passe';
+ $lang['identifiant'] = 'Identifiant';
+ $lang['mot de passe'] = 'Mot de passe';
$lang['Choix de la langue'] = 'Choix de la langue';
$lang['Superviseur'] = 'Superviseur';
$lang['Superviseurs'] = 'Superviseurs';
@@ -273,4 +273,41 @@
$lang['Solde Commission'] = 'Solde commission';
$lang['Commission banque'] = 'Commission de la banque';
$lang['Total commission de la banque'] = 'Total commission de la banque';
+
+ // Mot de passe du wallet
+ $lang['menu_wallet_password'] = 'Mot de passe Wallet' ;
+ $lang['header_wallet_password'] = 'Gestion des mots de passe des wallets' ;
+ $lang['activated_wallets'] = 'Wallets actifs' ;
+ $lang['generated'] = 'Généré';
+ $lang['not_generated'] = 'Non généré';
+ $lang['generate'] = 'Générer';
+ $lang['reset'] = 'Réinitialiser';
+ $lang['no_wallet'] = 'Aucun wallet';
+ $lang['generate_password'] = 'Générer le mot de passe';
+ $lang['email'] = 'Adresse mail';
+ $lang['password_generated'] = 'Mot de passe généré';
+ $lang['informations_updated'] = 'Les informations ont été mises à jour';
+ $lang['request_error'] = 'Erreur requete';
+ $lang['error_message'] = 'Une erreur s\'est produite.';
+ $lang['wallet_password'] = 'Mot de passe du wallet';
+ $lang['wallet_update'] = 'Mise à jour du wallet';
+ $lang['recharge_hypervisor_account'] = 'Recharger de la monnaie virtuelle dans le compte de l\'hyperviseur';
+ $lang['recharge'] = 'Recharger';
+ $lang['click_here'] = 'Cliquez ici';
+ $lang['no_wallet_password'] = 'Aucun mot de passe n\'existe pour ce wallet, veuillez generer un mot de passe ! ';
+ $lang['i_forgot_password'] = 'J\'ai oublié mon mot de passe';
+ $lang['transactions_historic'] = 'Historique des transactions';
+ $lang['recharge_historic'] = 'Historique des recharges';
+ $lang['no_recharge'] = 'Aucune recharge';
+ $lang['reset_wallet_password'] = 'Réinitialisation du mot de passe du wallet';
+ $lang['incorrect_password'] = 'Mot de passe incorrect';
+ $lang['account_recharged'] = 'Compte rechargé';
+ $lang['password_has_been_reset'] = 'Votre mot de passe a été réinitialisé';
+ $lang['management_rule'] = 'Règle de gestion';
+ $lang['first_rule'] = 'La somme des % des retraits de l\'agent et du superviseur doit être inférieur à 100.';
+ $lang['second_rule'] = 'La somme des % des dépots de l\'agent et du superviseur doit être inférieur à 100.';
+ $lang['third_rule'] = 'La somme des % des retraits doit être inférieur au taux client de retrait.';
+ $lang['fourth_rule'] = 'La somme des % des dépots doit être inférieur à 100.';
+ $lang['wallet_created'] = 'Nouveau wallet créé';
+ $lang['wallet_deleted'] = 'Wallet supprimé';
?>
diff --git a/application/models/User_model.php b/application/models/User_model.php
index b9ca5eab..74122389 100644
--- a/application/models/User_model.php
+++ b/application/models/User_model.php
@@ -2157,4 +2157,61 @@ class User_model extends CI_Model
return $query;
}
+ // Mot de passe du wallet
+ public function getAllActivatedWalletNetworks(){
+ $query = $this->db->query("SELECT n.name AS network,n.status AS status,n.id,c.name AS country, wp.id AS wallet_password FROM networks n
+ INNER JOIN countries c ON n.country_id=c.id INNER JOIN configWallet cw ON cw.id_network = n.id
+ LEFT JOIN walletsPassword wp ON wp.network_id = n.id WHERE status = 1;");
+ if($query->num_rows()>0){
+ return $query;
+ }else{
+ return false;
+ }
+ }
+
+ public function addWalletPassword($network_id,$encrypted_password,$salt,$email){
+ $sql = "INSERT INTO `walletsPassword` (`network_id`, `encrypted_password`, `salt`, `email`) VALUES ( ?, ?, ?, ?);";
+ $query = $this->db->query($sql , array($network_id,$encrypted_password,$salt,$email));
+ return $query;
+ }
+
+ public function updateWalletPassword($wallet_password_id,$encrypted_password,$salt,$email){
+ $sql = "UPDATE `walletsPassword` SET `encrypted_password` = ? , `salt` = ? , `email` = ? WHERE (`id` = ?);";
+ $query = $this->db->query($sql , array($encrypted_password,$salt,$email,$wallet_password_id));
+ return $query;
+ }
+
+ public function getWalletPassword($network_id){
+ $sql= "SELECT * FROM walletsPassword WHERE network_id = ?";
+ $query = $this->db->query($sql , array($network_id));
+ if($query->num_rows()>0){
+ return $query;
+ }else{
+ return false;
+ }
+ }
+
+ public function getRecharges($debut , $fin , $id_network){
+ $chain = $debut ? " AND date BETWEEN '".$debut."' AND '".$fin."'" : "";
+ $query = $this->db->query("SELECT *
+ FROM infos_recharges
+ WHERE `network_id`=".$id_network.$chain);
+ if($query->num_rows()>0){
+ return $query;
+ }else{
+ return false;
+ }
+ }
+
+ public function addWalletRecharge($montant,$wallet_id){
+ $sql = "INSERT INTO `wallet_recharge` (`montant`, `wallet_id`) VALUES (?, ?);";
+ $query = $this->db->query($sql , array($montant,$wallet_id));
+ return $query;
+ }
+
+ public function updateWalletBalance($montant,$wallet_id){
+ $sql = "UPDATE `wallets` SET balance_princ = balance_princ + ? WHERE (`id` = ? );";
+ $query = $this->db->query($sql , array($montant,$wallet_id));
+ return $query;
+ }
}
diff --git a/application/views/gestion_wallet.php b/application/views/gestion_wallet.php
index 8113e0e8..c7ef2029 100644
--- a/application/views/gestion_wallet.php
+++ b/application/views/gestion_wallet.php
@@ -177,9 +177,11 @@ if ($transactions != false) {
style="width: 100%">lang->line('Modifier la configuration') ?>
-
-
+
+
+
+
%
@@ -305,8 +307,12 @@ if ($transactions != false) {
lang->line('Historique des 12 derniers mois'); ?>
@@ -444,6 +450,48 @@ if ($transactions != false) {
+
@@ -474,12 +522,14 @@ if ($transactions != false) {
+
diff --git a/application/views/gestion_wallets.php b/application/views/gestion_wallets.php
index 64e6b84d..4b621d93 100755
--- a/application/views/gestion_wallets.php
+++ b/application/views/gestion_wallets.php
@@ -123,11 +123,11 @@
@@ -245,14 +245,13 @@
var sommeDepot = taux_ag_d + taux_sup_d + taux_bq_d ;
if((taux_ag_r + taux_sup_r) > 100){
- toastr.error("La somme des % des retraits de l'agent et du superviseur doit être inférieur à 100.", 'Règle de gestion');
+ toastr.error('lang->line('first_rule')?>', 'lang->line('management_rule')?>');
}else if((taux_ag_d + taux_sup_d) > 100){
- toastr.error("La somme des % des dépots de l'agent et du superviseur doit être inférieur à 100.", 'Règle de gestion');
+ toastr.error('lang->line('second_rule')?>', 'lang->line('management_rule')?>');
}else if(sommeRetrait >= taux_client_r){
- // alert("La somme des % des retraits doit être inférieur au taux client de retrait.");
- toastr.error('La somme des % des retraits doit être inférieur au taux client de retrait.', 'Règle de gestion')
+ toastr.error('lang->line('third_rule')?>', 'lang->line('management_rule')?>')
}else if(sommeDepot >= 100){
- toastr.error("La somme des % des dépots doit être inférieur à 100.", 'Règle de gestion');
+ toastr.error('lang->line('fourth_rule')?>', 'lang->line('management_rule')?>');
}else{
$.ajax({
url : '',
@@ -265,15 +264,15 @@
Swal.fire({
icon: 'success',
- title: 'Nouveau wallet',
- text:'Les informations ont été mises à jour',
+ title: 'lang->line('wallet_created')?>',
+ text:'lang->line('informations_updated')?>',
timer: 3000
}).then(()=>{
location.reload();
});
// alert("Les informations ont été mises à jour.") ? "" :
}else{
- toastr.error("Une erreur s'est produite." , 'Erreur requete');
+ toastr.error("lang->line('error_message')?>" , 'lang->line('request_error')?>');
}
},
error : function(resultat, statut, error){
@@ -312,15 +311,15 @@
Swal.fire({
icon: 'success',
- title: 'Suppression wallet',
- text: 'Les informations ont été mises à jour',
+ title: 'lang->line('wallet_deleted')?>',
+ text:'lang->line('informations_updated')?>',
timer: 3000
}).then(()=>{
location.reload();
});
// alert("Les informations ont été mises à jour.") ? "" : location.reload();
}else{
- toastr.error("Une erreur s'est produite.", 'Erreur requete');
+ toastr.error("lang->line('error_message')?>" , 'lang->line('request_error')?>');
}
},
diff --git a/application/views/header_gestion.php b/application/views/header_gestion.php
index 98fb685c..a3b2d3e3 100644
--- a/application/views/header_gestion.php
+++ b/application/views/header_gestion.php
@@ -144,9 +144,14 @@
">
- Walletlang->line('Game'); ?>
+ Wallet
+
">
+
+ lang->line('menu_wallet_password'); ?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ lang->line('Période') ?>
+
+
+
+
+ Format : session->userdata('site_lang') === 'french' ? 'Jour - Mois - Année ' : 'Year - Month - Day'?>
+
+
+
+
+
+
+
+
+
+
+ num_rows();
+ $num = 0;
+ if ($numrows > 0) {
+ $fmt = new NumberFormatter( 'fr_FR', NumberFormatter::DECIMAL );
+ ?>
+
+
+
+
+ N° |
+ lang->line('Montant') ?> |
+ Date |
+
+
+
+
+ result() as $row) {
+ $num++;
+ echo "
+ $num |
+ ".$fmt->format($row->montant)." |
+ $row->date |
+
";
+ }
+ ?>
+
+
+ lang->line('no_recharge');
+ }
+ }else {
+ echo $this->lang->line('no_recharge');
+ }
+ ?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/application/views/historique_transactions.php b/application/views/historique_transactions.php
index 4bb95d36..c1df7543 100755
--- a/application/views/historique_transactions.php
+++ b/application/views/historique_transactions.php
@@ -182,14 +182,14 @@
}, function (start, end, label) {
const debut = start.format('YYYY-MM-DD');
const fin = end.format('YYYY-MM-DD');
- window.location = "" + "?id=118&history=true" + "&d=" + debut + "&f=" + fin;
+ window.location = "" + "?id=118&history=transaction" + "&d=" + debut + "&f=" + fin;
});
$('input[name="daterange"]').on('cancel.daterangepicker', function(ev, picker) {
//do something, like clearing an input
$('#daterange').val('');
- window.location = "" + "?id=118&history=true";
+ window.location = "" + "?id=118&history=transaction";
});
});
diff --git a/application/views/wallet_password.php b/application/views/wallet_password.php
new file mode 100755
index 00000000..d982915a
--- /dev/null
+++ b/application/views/wallet_password.php
@@ -0,0 +1,218 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ num_rows();
+ $num = 0;
+ if ($numrows > 0) {
+ ?>
+
+
+
+ N° |
+ lang->line('Reseau'); ?> |
+ lang->line('Pays'); ?> |
+ lang->line('mot de passe'); ?> |
+ Action |
+
+
+
+ result() as $row) {
+ $num ++;
+ //$member_code = randomString1(10);
+ echo "
+ $num |
+ $row->network |
+ $row->country | ";
+ ?>
+ wallet_password){
+ ?>
+ lang->line('generated'); ?> |
+ |
+
+ lang->line('not_generated'); ?> |
+ |
+
+
+
+
+
+ lang->line('no_wallet');
+ }
+ }else {
+ echo $this->lang->line('no_wallet');
+ }
+ ?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+