public function confirmRegister($regr, $module_status)
 {
     /* print_r($regr);
        die(); */
     $this->load->model('board_registersubmit');
     $reg = new board_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']);
     // echo  $regr['fatherid'];die();
     $regr['referral_id'] = $reg->obj_vali->userNameToID($regr['referral_name']);
     if ($this->validateRegisterData($regr, $module_status)) {
         $child_node = $reg->obj_vali->getChildNodeId($regr['fatherid'], $regr['position']);
         $reg->begin();
         $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']);
                 $pin_status = $module_status['pin_status'];
                 $pin_status;
                 //                    if ($pin_status == "yes") {
                 //
                 //                        $updt_pin_status_res = $pin_upd_res = $reg->updatePinNumber($regr['passcode'], $regr['username']);
                 //                    }
                 $regr['userid'] = $last_insert_id;
                 $unilevel_arr['order_id'] = $next_order_id;
                 $unilevel_arr['position'] = $regr['position'];
                 $unilevel_arr['user_level'] = $user_level;
                 $updt_ft_uni = $reg->insertToUnilevelTree($regr, $unilevel_arr);
                 $insert_user_det_res = $reg->insertUserDetails($regr, $unilevel_arr);
                 $insert_tmp1_res = $reg->tmpInsert($last_insert_id, '1');
                 $new_position = $reg->getNewPositionOfUser($last_insert_id) + 1;
                 $insert_tmp2_res = $reg->tmpInsert($regr['fatherid'], $new_position);
             }
         }
         $board_no = 1;
         $user_name_for_board_split = $regr['username'];
         $active = "yes";
         $auto_goc_table_name_next = "auto_board_";
         $shuffle_status = $module_status['shuffle_status'];
         $shuffle_status . $this->obj_autofilling->addBoard($last_insert_id, $user_name_for_board_split, $active, $auto_goc_table_name_next, $board_no, $shuffle_status, "", $regr['referral_id']);
         $referal_amount = 0;
         $boardno = '';
         $amount_type = 'referal';
         $referal_status = $module_status['referal_status'];
         if ($referal_status == "yes") {
             $referal_amount = $this->getReferalAmount();
         }
         $referal_id = $this->obj_autofilling->getReferalId($last_insert_id);
         if ($referal_amount > 0) {
             $this->obj_autofilling->insertAmount($referal_id, $boardno, $amount_type, $referal_amount);
         }
         //            $leadership_bonus = $this->getLeaderShipBonus();
         //            $leadership_users = $this->getLeaderShipUsers($child_node);
         //            for ($i = 0; $i < count($leadership_users); $i++) {
         //                $leader_bonus = $leadership_bonus["leader$i"];
         //                $leader_user = $leadership_users[$i];
         //                $this->obj_autofilling->insertLeaderShipBonus($leader_user, $boardno, 'leadership_bonus', $leader_bonus, $child_node);
         //            }
         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'];
             //$mobid = $regr['mobid'];
             $tran_code = $reg->getRandTransPasscode(8);
             //$tran_code = $password;
             $reg->savePassCodes($last_insert_id, $tran_code);
             if ($regr['email'] != "" && $regr['email'] != null) {
                 $mailBodyDetails = '<html>
                   <head>
                   <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
                   </head>
                   <body >
                   <table id="Table_01" width="700"   border="0" cellpadding="0" cellspacing="0">
                   <tr><td colspan="2">
                   <table width="400"   border="0" cellpadding="0" cellspacing="0">
                   <tr><td colspan="2"><b>Account Details</b></td></tr>
                   <tr><td>Username :</td><td><b>' . $username . '</b></td></tr>
                   <tr><td>Password :</td><td><b>' . $password . '</b></td></tr>
                   <tr><td>Transaction Passcode :</td><td><b>' . $tran_code . '</b></td></tr>
                   </table>
                   </td></tr>
                   <tr><td colspan="2" >Welcome ' . $username . ',<br />Your account has successfully registered.
                   </td></tr>
                   <tr><td colspan="2">Regards,<br />In</td></tr>
                   <tr><td colspan="2">www.ventures99.com</td></tr>
                   </table>
                   </body></html>';
                 $this->sendEmail($mailBodyDetails, $regr['email']);
             }
             $reg->insertBalanceAmount($regr['userid']);
             $encript_id = $this->session->userdata('user_id');
             $encr_id = $this->getEncrypt($encript_id);
             $reg->commit();
             $msg['user'] = $username;
             $msg['pwd'] = $password;
             $msg['id'] = $encr_id;
             $msg['status'] = true;
             $msg['tran'] = $tran_code;
             return $msg;
         } else {
             $reg->rollBack();
             $encript_id = $this->session->userdata('user_id');
             $encr_id = $this->getEncrypt($encript_id);
             $msg['user'] = "";
             $msg['pwd'] = "";
             $msg['id'] = "";
             $msg['status'] = false;
             $msg['tran'] = "";
             return $msg;
         }
     }
 }