public function updateFTDetails($ft_details, $regr, $child_node, $set_active_status = '') { if ($set_active_status == "") { $active_status = $ft_details['active']; } else { $active_status = $set_active_status; } $id = $ft_details['id']; $order_id = $ft_details['order_id']; $user_name = $ft_details['user_name']; $product_id = $ft_details['product_id']; $time_now = $ft_details['date_of_joining']; $user_level = $ft_details['user_level']; $father_id = $regr['father_id']; $position = $regr['position']; $this->db->set('father_id', $father_id); $this->db->set('order_id', $order_id); $this->db->set('position', $position); $this->db->set('user_name', $user_name); $this->db->set('active', "{$active_status}"); $this->db->set('date_of_joining', $time_now); $this->db->set('user_level', $user_level); $this->db->set('product_id', $product_id); $this->db->set('id', $id); $this->db->where('id', $child_node); $result = $this->db->update('ft_individual'); // echo "<br>ft placement changed=>" . $this->db->last_query(); if ($result) { if ($set_active_status == "") { $this->load->model('registersubmit'); $reg = new registersubmit(); $res1 = $reg->tmpInsert($id, 'L'); $res2 = $reg->tmpInsert($id, 'R'); } } return $result; }
public function clean($mlm_plan) { require_once 'registersubmit.php'; $obj_reg = new registersubmit(); require_once 'validation.php'; $obj_val = new validation(); require_once 'board_registersubmit.php'; $obj_board = new board_registersubmit(); $session_data = $this->session->userdata('logged_in'); $admin_pass = $obj_val->getAdminPassword(); $admin_id = $obj_val->getAdminId(); $details = $this->getUserDetail($admin_id); //to get details of admin //$logged_user_id = $details['user_detail_refid']; $logged_user_id = 12345; $table_prefix = $session_data['table_prefix']; $user_name = $session_data['user_name']; $this->begin(); $res1 = $this->db->truncate('amount_paid'); $res2 = $this->db->truncate('complaint_query_table'); $res3 = $this->db->truncate('complaint_ticket_table'); $res4 = $this->db->truncate('events'); $res5 = $this->db->truncate('feedback'); $res6 = $this->db->truncate('ft_individual'); $res7 = $this->db->truncate('ft_individual_unilevel'); $res8 = $this->db->truncate('fund_transfer_details'); $res9 = $this->db->truncate('investment'); $res10 = $this->db->truncate('leg_amount'); $res11 = $this->db->truncate('leg_carry_forward'); $res12 = $this->db->truncate('login_user'); $res13 = $this->db->truncate('mailtoadmin'); $res14 = $this->db->truncate('mailtouser'); $res15 = $this->db->truncate('news'); $res16 = $this->db->truncate('password_reset_table'); $res17 = $this->db->truncate('pin_numbers'); $res18 = $this->db->truncate('pin_request'); $res19 = $this->db->truncate('payout_release_requests'); $res20 = $this->db->truncate('sms_history'); $res21 = $this->db->truncate('tran_password'); $res22 = $this->db->truncate('user_balance_amount'); $res23 = $this->db->truncate('user_details'); $res24 = $this->db->truncate('leg_details'); $res25 = $this->db->truncate('product_image_table'); $res26 = $this->db->truncate('rank_history'); $res27 = $this->db->truncate('sales_order'); $res28 = $this->db->truncate('activity_history'); $res29 = $this->db->truncate('live_account_registration_details'); $res30 = $this->db->truncate('credit_card_purchase_details'); $res31 = $this->db->truncate('pin_used'); $res31 = $this->db->truncate('username_change_history'); $res61 = $this->db->truncate('payment_registration_details'); $res62 = $this->db->truncate('authorize_payment_details'); $res63 = $this->db->truncate('employee_details'); $res64 = $this->db->truncate('login_employee'); $res65 = $this->db->truncate('cron_history'); $res66 = $this->db->truncate('exact_payment_history'); $res66 = $this->db->truncate('cookie_user'); $login_user = $this->table_prefix . "login_user"; $set_auto_increment_login_user = "******"; $res32 = $this->db->query($set_auto_increment_login_user); $ft_individual = $this->table_prefix . "ft_individual"; $set_auto_increment_ft_individual = "ALTER TABLE {$ft_individual} AUTO_INCREMENT={$logged_user_id}"; $res33 = $this->db->query($set_auto_increment_ft_individual); $login_data = array('user_id' => $logged_user_id, 'user_type' => 'admin', 'addedby' => 'code', 'user_name' => $user_name, 'password' => $admin_pass); $res37 = $this->db->insert('login_user', $login_data); $current_date = date("Y-m-d H:i:s"); $ft_details = array('id' => $logged_user_id, 'father_id' => '0', 'position' => '', 'user_name' => $user_name, 'active' => 'yes', 'date_of_joining' => $current_date, 'product_id' => '1'); $res38 = $this->db->insert('ft_individual', $ft_details); $ft_details_ul = array('id' => $logged_user_id, 'father_id' => '0', 'position' => '0', 'user_name' => $user_name, 'active' => 'yes', 'date_of_joining' => $current_date, 'product_id' => '1'); $res39 = $this->db->insert('ft_individual_unilevel', $ft_details_ul); $leg_details = array('id' => $logged_user_id); $res40 = $this->db->insert('leg_details', $leg_details); ///////////////////code added by amrutha $date = date("Y-m-d H:i:s"); $user_details = array('user_detail_refid' => $logged_user_id, 'user_detail_name' => $details['user_detail_name'], 'user_detail_address' => $details['user_detail_address'], 'user_detail_town' => $details['user_detail_town'], 'user_detail_country' => $details['user_detail_country'], 'user_detail_state' => $details['user_detail_state'], 'user_detail_pin' => $details['user_detail_pin'], 'user_detail_passcode' => $details['user_detail_passcode'], 'user_detail_mobile' => $details['user_detail_mobile'], 'user_detail_land' => $details['user_detail_land'], 'user_detail_email' => $details['user_detail_email'], 'user_detail_dob' => $details['user_detail_dob'], 'user_detail_gender' => $details['user_detail_gender'], 'user_detail_nominee' => $details['user_detail_nominee'], 'user_detail_relation' => $details['user_detail_relation'], 'user_detail_acnumber' => $details['user_detail_acnumber'], 'user_detail_nbank' => $details['user_detail_nbank'], 'user_photo' => $details['user_photo'], 'join_date' => $date, 'user_detail_nbranch' => $details['user_detail_nbranch']); $res41 = $this->db->insert('user_details', $user_details); $this->db->select_max('user_id', 'user_id'); $this->db->from('login_user'); $query = $this->db->get(); foreach ($query->result() as $row) { $get_id = $row->user_id; } if ($mlm_plan == 'Board') { $res42 = $obj_board->tmpInsert($get_id, "1"); } else { $res42 = $obj_reg->tmpInsert($get_id, "L"); $res43 = $obj_reg->tmpInsert($get_id, "R"); } $user_balance_details = array('user_id' => $get_id, 'balance_amount' => '0'); $res44 = $this->db->insert('user_balance_amount', $user_balance_details); $tran_password_details = array('user_id' => $logged_user_id, 'tran_password' => '12345678'); $res45 = $this->db->insert('tran_password', $tran_password_details); if ($mlm_plan == "Board") { /////////////////////////////////////////////////////////////for board plan $res46 = $this->db->truncate("board_split_status"); $res47 = $this->db->truncate("board_user_detail"); $res48 = $this->db->truncate("auto_board_1"); $res49 = $this->db->truncate("board_view"); $res50 = $this->db->truncate("board_referral_count"); $auto_board = $this->table_prefix . "auto_board_1"; $set_auto_increment_auto_board = "ALTER TABLE {$auto_board} AUTO_INCREMENT={$logged_user_id}"; $res51 = $this->db->query($set_auto_increment_auto_board); $board_split_status = $this->table_prefix . "board_split_status"; $set_auto_increment_board_split_status = "ALTER TABLE {$board_split_status} AUTO_INCREMENT=1"; $res52 = $this->db->query($set_auto_increment_board_split_status); $board_user_detail = $this->table_prefix . "board_user_detail"; $set_auto_increment_board_user_detail = "ALTER TABLE {$board_user_detail} AUTO_INCREMENT=1"; $res53 = $this->db->query($set_auto_increment_board_user_detail); $board_view = $this->table_prefix . "board_view"; $set_auto_increment_board_view = "ALTER TABLE {$board_view} AUTO_INCREMENT = 1"; $res54 = $this->db->query($set_auto_increment_board_view); $board_view = $this->table_prefix . "board_referral_count"; $set_auto_increment_board_referral_count = "ALTER TABLE {$board_view} AUTO_INCREMENT = 1"; $res55 = $this->db->query($set_auto_increment_board_referral_count); $board_user_details = array("board_table_name" => '1', "user_id" => $logged_user_id, "board_serial_no" => '1', "date_of_join" => $date); $res56 = $this->db->insert('board_user_detail', $board_user_details); $board_split_status_det = array("user_ref_id" => $logged_user_id, "board_number" => '1', "status" => 'no', "date_of_update" => $date); $res57 = $this->db->insert('board_split_status', $board_split_status_det); $auto_board_det = array("user_ref_id" => $logged_user_id, "user_name" => $user_name, "position" => '', "active" => 'yes', "father_id" => '0', "date_of_joining" => $date, "user_level" => '0'); $res58 = $this->db->insert('auto_board_1', $auto_board_det); $board_view_det = array("board_top_id" => $logged_user_id, "board_table_name" => '1', "board_no" => '1', "board_split_status" => 'no', "date_of_join" => $date); $res59 = $this->db->insert('board_view', $board_view_det); $board_referral_count_det = array("board_id" => $logged_user_id, "user_ref_id" => $logged_user_id, "referral_count" => '0'); $res60 = $this->db->insert('board_referral_count', $board_referral_count_det); /* ///////////////////////////////if auto_board_2 exists $res61 = $this->db->truncate("auto_board_2"); $auto_board2 = $this->table_prefix . "auto_board_2"; $set_auto_increment_auto_board = "ALTER TABLE $auto_board2 AUTO_INCREMENT=$logged_user_id"; $res62 = $this->db->query($set_auto_increment_auto_board); $board_user_details = array( "board_table_name" => '2', "user_id" => $logged_user_id, "board_serial_no" => '1', "date_of_join" => $date ); $res63 = $this->db->insert('board_user_detail', $board_user_details); $auto_board_det = array( "user_ref_id" => $logged_user_id, "user_name" => $user_name, "position" => '', "active" => 'yes', "father_id" => '0', "date_of_joining" => $date, "user_level" => '0' ); $res64 = $this->db->insert('auto_board_2', $auto_board_det); $board_view_det = array( "board_top_id" => $logged_user_id, "board_table_name" => '2', "board_no" => '1', "board_split_status" => 'no', "date_of_join" => $date ); $res65 = $this->db->insert('board_view', $board_view_det); */ //////////////////////////////////////////////////// } if ($res45) { $this->commit(); } else { $this->rollBack(); } return $res45; }
public function confirmRegisterNew($regr, $module_status) { $this->load->model('configuration_model'); $this->load->model('registersubmit'); $reg = new registersubmit(); $max_nod_id = $reg->getMaxOrderID(); $next_order_id = $max_nod_id + 1; if ($regr['user_name_type'] == 'dynamic') { $regr['username'] = $reg->getUsername(); } else { $regr['username'] = $regr['user_name_entry']; } $regr['fatherid'] = $reg->obj_vali->userNameToID($regr['fatherid']); $regr['referral_id'] = $reg->obj_vali->userNameToID($regr['referral_name']); if ($regr['state'] != "") { $regr['state'] = $reg->getStateName($this->input->post('state')); } if ($this->validateRegisterData($regr, $module_status)) { $child_node = $reg->obj_vali->getChildNodeId($regr['fatherid'], $regr['position']); $updt_login_res = $res_login_update = $reg->updateLoginUser($regr['username'], md5($regr['pswd']), $child_node); if ($res_login_update) { $user_level = $reg->getLevel($regr['fatherid']) + 1; $updt_ft_res = $res_ftindi_update = $reg->updateFTIndividual($regr['fatherid'], $regr['position'], $regr['username'], $child_node, $next_order_id, $regr['by_using'], $user_level, $regr['prodcut_id']); if ($res_ftindi_update) { $last_insert_id = $reg->obj_vali->userNameToID($regr['username']); //echo "......vvv";die(); $pin_status = $module_status['pin_status']; $pin_status; $regr['userid'] = $last_insert_id; $updt_ft_uni = $reg->insertToUnilevelTree($regr); $insert_user_det_res = $res = $reg->insertUserDetails($regr); $id = $insert_tmp1_res = $res1 = $reg->tmpInsert($last_insert_id, 'L'); $insert_tmp2_res = $res1 = $reg->tmpInsert($last_insert_id, 'R'); } } $rank_status = $module_status['rank_status']; $product_status = $module_status['product_status']; $first_pair = $module_status['first_pair']; $referal_status = $module_status['referal_status']; $balance_amount = 0; if ($product_status == "yes" && $first_pair == "1:1") { require_once 'Calculation11Product.php'; } else { if ($product_status == "no" && $first_pair == "1:1") { require_once 'Calculation11WithOutProduct.php'; } else { if ($product_status == "yes" && $first_pair == "2:1") { require_once 'Calculation21Product.php'; } else { if ($product_status == "no" && $first_pair == "2:1") { require_once 'Calculation21WithOutProduct.php'; } } } } $obj_calc = new Calculation(); if ($rank_status == "yes") { $referal_count = $reg->obj_vali->getReferalCount($regr['referral_id']); $old_rank = $reg->obj_vali->getUserRank($regr['referral_id']); $regr['rank'] = $reg->obj_vali->getCurrentRankFromRankConfig($referal_count); $new_rank = $regr['rank']; $this->updateUserRank($regr['referral_id'], $new_rank); if ($old_rank != $new_rank) { $rank_bonuss = array(); $rank_bonuss = $this->configuration_model->getAllRankDetails($new_rank); $this->insertIntoRankHistory($old_rank, $regr['rank'], $regr['referral_id']); $date_of_sub = date("Y-m-d H:i:s"); $amount_type = "rank_bonus"; //$level = $this->getUserLevel($regr['referral_id']); $obj_arr = $this->getSettings(); $tds_db = $obj_arr["tds"]; $service_charge_db = $obj_arr["service_charge"]; $rank_amount = $rank_bonuss[0]['rank_bonus']; $tds_amount = $rank_amount * $tds_db / 100; $service_charge = $rank_amount * $service_charge_db / 100; $amount_payable = $rank_amount - ($tds_amount + $service_charge); $obj_calc->insertInToLegAmount($regr['referral_id'], 0, 0, 0, $rank_amount, $amount_payable, $tds_amount, $service_charge, $date_of_sub, $amount_type); } } $product_status = $module_status['product_status']; $first_pair = $module_status['first_pair']; $referal_status = $module_status['referal_status']; if ($referal_status == "yes") { $referal_amount = $this->getReferalAmount(); $referal_id = $obj_calc->getReferalId($last_insert_id); if ($referal_amount > 0) { $raferal_amount = ($balance_amount + $referal_amount) * $regr['quantity']; $ref_amt = $obj_calc->insertReferalAmount($referal_id, $raferal_amount, $regr['userid']); } } if ($product_status == "yes") { if ($first_pair == "2:1") { require_once 'Calculation21Product.php'; $obj_calc = new Calculation(); $obj_calc->calculateLegCount($regr['userid'], $regr['fatherid'], $regr['prodcut_id'], $regr['position'], $regr['userid']); } else { require_once 'Calculation11Product.php'; $obj_calc = new Calculation(); $obj_calc->calculateLegCount($regr['userid'], $regr['fatherid'], $regr['prodcut_id'], $regr['position'], $regr['userid'], $regr['quantity']); } } else { if ($first_pair == "2:1") { require_once 'Calculation21WithOutProduct.php'; $obj_calc = new Calculation(); $obj_calc->calculateLegCount($regr['userid'], $regr['fatherid'], $regr['position'], $regr['userid']); } else { require_once 'Calculation11WithOutProduct.php'; $obj_calc = new Calculation(); $obj_calc->calculateLegCount($regr['userid'], $regr['fatherid'], $regr['position'], $regr['referral_id'], $regr['userid']); } } $level_count = $this->getLevelCount(); if ($level_count > 0) { if ($module_status['sponsor_commission_status'] == 'yes') { $obj_calc->calculateLevelCommission($regr['userid'], $referal_id, $regr['prodcut_id']); } } if ($updt_ft_res && $updt_login_res && $insert_user_det_res && $insert_tmp1_res && $insert_tmp2_res) { $mobile = $regr['mobile']; $username = $regr['username']; $password = $regr['pswd']; $full_name = $regr['full_name']; $site_info = $this->obj_config->getSiteConfiguration(); $site_name = $site_info['co_name']; $site_logo = $site_info['logo']; $base_url = base_url(); $tran_code = $reg->getRandTransPasscode(8); $reg->savePassCodes($last_insert_id, $tran_code); if ($regr['email'] != "" && $regr['email'] != null) { $reg_mail = $this->checkMailStatus(); if ($reg_mail['reg_mail_status'] == 'yes') { $email = $regr['email']; $mail_content = $this->obj_vali->getMailBody(); $subject = "{$site_name} Registration Notification"; $mailBodyDetails = '<html xmlns="https://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link href="https://fonts.googleapis.com/css?family=Droid+Serif" rel="stylesheet" type="text/css"> <style> margin:0px; padding:0px; </style> </head> <body> <div style="width:80%;padding:40px;border: solid 10px #D0D0D0;margin:50px auto;"> <div style="min-height: 62px;border: solid 1px #d0d0d0;background: url(' . $base_url . 'public_html/images/head-bg.png) no-repeat center center;padding: 0px!important;"> <img src="' . $base_url . 'public_html/images/logos/' . $site_logo . '" alt="logo" style="width: 114px;margin-top: 10px;margin-left: 10px;"/> </div> <div style="width:100%;margin:15px 0 0 0;"> <h1 style="font: normal 20px Tahoma, Geneva, sans-serif;">Dear <font color="#e10000">' . $full_name . ',</font></h1> <p style="font: normal 12px Tahoma, Geneva, sans-serif;text-align:justify;color:#212121;line-height:23px;">' . $mail_content . '</p> <div style="width:400px;height:225px;margin:16px auto;background:url(' . $base_url . 'public_html/images/page.png);border: solid 1px #d0d0d0;border-radius: 10px;"> <h2 style="color:#C70716;font:normal 16px Tahoma, Geneva, sans-serif;line-height:34px;background:url(' . $base_url . 'public_html/images/login-icons.png) center left no-repeat;background-size: 35px 35px;margin:10px 0 0 22px;float:left;padding-left: 54px;">LOGIN DETAILS</h2> <div style="clear:both;"></div> <ul style="display:block;margin:14px 0 0 0;float:left;"> <li style="list-style:none;font:normal 15px Tahoma, Geneva, sans-serif;color:#212121;margin:5px 0 0 20px;border:1px solid #ccc;background:#fff;width:300px;padding:5px;"><span style="width:150px;float:left;">Login Link</span><font color="#025BB9"> : <a href="http://infinitemlmsoftware.com/soft/binary/login/index/user/' . $username . '" target="_blank">Click Here</a></font></li> <li style="list-style:none;font:normal 15px Tahoma, Geneva, sans-serif;color:#212121;margin:5px 0 0 20px;border:1px solid #ccc;background:#fff;width:300px;padding:5px;"><span style="width:150px;float:left;">Your UserName</span><font color="#e10000"> : ' . $username . '</font></li> <li style="list-style:none;font:normal 15px Tahoma, Geneva, sans-serif;color:#212121;margin:5px 0 0 20px;border:1px solid #ccc;background:#fff;width:300px;padding:5px;"><span style="width:150px;float:left;">Your Password</span><font color="#e10000"> : ' . $password . '</font></li> </ul> </div> </div> </div> </body> </html>'; $this->obj_vali->sendEmail($mailBodyDetails, $last_insert_id, $subject); } } $reg->insertBalanceAmount($regr['userid']); $encr_id = $this->session->userdata('user_id'); $encr_id = $this->getEncrypt($encr_id); $msg['user'] = $username; $msg['pwd'] = $password; $msg['id'] = $encr_id; $msg['status'] = true; $msg['tran'] = $tran_code; //if($using=='exact'){ $user = $msg['user']; $pass = $msg['pwd']; $tran_code = $msg['tran']; $product_status = $module_status['product_status']; $payment_method = 'e-xact'; $user_id = $this->userNameToID($user); if ($product_status == "yes") { $insert_into_sales = $this->insertIntoSalesOrder($user_id, $regr['prodcut_id'], $payment_method, $regr['quantity'], $regr['x_trans_id'], "register"); //$this->insertExactHistory($regr); $reg->commit(); } //} return $msg; } else { $reg->rollBack(); $encr_id = $this->session->userdata('user_id'); $encr_id = $this->getEncrypt($encr_id); $msg['user'] = ""; $msg['pwd'] = ""; $msg['id'] = ""; $msg['status'] = false; $msg['tran'] = ""; return $msg; } if ($msg['status']) { //mail('*****@*****.**','commit', ' starting' );//unc //$reg->commit(); //mail('*****@*****.**','commit', ' ending' );//unc } } }