function pay() { if (!$this->input->get('list_id') || !$this->input->get('status')) { echo '[{"status":"Required All Fields"}]'; } else { $list_id = $this->input->get('list_id'); $list['list_id'] = $list_id; $token = $_GET["token"]; $playerid = $_GET["PayerID"]; $status = $this->input->get('status'); //$httpParsedResponseAr = $this->PPHttpPost('GetExpressCheckoutDetails', $padata, $api_user, $api_pwd, $api_key, $PayPalMode); // print_r($httpParsedResponseAr['ACK']);exit; if ($status == 'success') { //print_r($_REQUEST['ItemName']);exit; //echo "<script> alert(''success');</script>"; $custom = $this->session->userdata('custom'); //print_r($custom); //exit; $data = array(); $list = array(); $data = explode('@', $custom); $contact_key = $data[9]; $list['list_id'] = $data[0]; $list['userby'] = $data[1]; $query1 = $this->Common_model->getTableData('list', array('id' => $list['list_id'])); $buyer_id = $query1->row()->user_id; $list['userto'] = $buyer_id; $list['checkin'] = $data[2]; $list['checkout'] = $data[3]; $list['no_quest'] = $data[4]; $amt = explode('%', $httpParsedResponseAr['AMT']); $list['price'] = $amt[0]; $currency = $httpParsedResponseAr['CURRENCYCODE']; $list['payment_id'] = 2; $list['credit_type'] = 1; $list['transaction_id'] = 0; $is_travelCretids = $data[5]; $user_travel_cretids = $data[6]; $list['topay'] = get_currency_value2($currency, $query1->row()->currency, $data[7]); $list['currency'] = $query1->row()->currency; $list['admin_commission'] = $data[8]; //Entering into it $list['status'] = 3; $this->db->select_max('group_id'); $group_id = $this->db->get('calendar')->row()->group_id; if (empty($group_id)) { echo $countJ = 0; } else { $countJ = $group_id; } $insertData['list_id'] = $list['list_id']; $insertData['group_id'] = $countJ + 1; $insertData['availability'] = 'Booked'; $insertData['booked_using'] = 'Other'; $checkin = date('m/d/Y', $list['checkin']); $checkout = date('m/d/Y', $list['checkout']); $days = getDaysInBetween($checkin, $checkout); $count = count($days); $i = 1; foreach ($days as $val) { if ($count == 1) { $insertData['style'] = 'single'; } else { if ($count > 1) { if ($i == 1) { $insertData['style'] = 'left'; } else { if ($count == $i) { $insertData['notes'] = ''; $insertData['style'] = 'right'; } else { $insertData['notes'] = ''; $insertData['style'] = 'both'; } } } } $insertData['booked_days'] = $val; $this->Trips_model->insert_calendar($insertData); $i++; } if ($list['price'] > 75) { $user_id = $list['userby']; $details = $this->Referrals_model->get_details_by_Iid($user_id); $row = $details->row(); $count = $details->num_rows(); if ($count > 0) { $details1 = $this->Referrals_model->get_details_refamount($row->invite_from); if ($details1->num_rows() == 0) { $insertData = array(); $insertData['user_id'] = $row->invite_from; $insertData['count_trip'] = 1; $insertData['amount'] = 25; $this->Referrals_model->insertReferralsAmount($insertData); } else { $count_trip = $details1->row()->count_trip; $amount = $details1->row()->amount; $updateKey = array('id' => $row->id); $updateData = array(); $updateData['count_trip'] = $count_trip + 1; $updateData['amount'] = $amount + 25; $this->Referrals_model->updateReferralsAmount($updateKey, $updateData); } } } $q = $query1->result(); $row_list = $query1->row(); $iUser_id = $q[0]->user_id; $details2 = $this->Referrals_model->get_details_by_Iid($iUser_id); $row = $details2->row(); $count = $details2->num_rows(); if ($count > 0) { $details3 = $this->Referrals_model->get_details_refamount($row->invite_from); if ($details3->num_rows() == 0) { $insertData = array(); $insertData['user_id'] = $row->invite_from; $insertData['count_book'] = 1; $insertData['amount'] = 75; $this->Referrals_model->insertReferralsAmount($insertData); } else { $count_book = $details3->row()->count_book; $amount = $details3->row()->amount; $updateKey = array('id' => $row->id); $updateData = array(); $updateData['count_trip'] = $count_book + 1; $updateData['amount'] = $amount + 75; $this->Referrals_model->updateReferralsAmount($updateKey, $updateData); } } $admin_email = $this->dx_auth->get_site_sadmin(); $admin_name = $this->dx_auth->get_site_title(); $query3 = $this->Common_model->getTableData('users', array('id' => $list['userby'])); $rows = $query3->row(); $username = $rows->username; $user_id = $rows->id; $email_id = $rows->email; $query4 = $this->Users_model->get_user_by_id($buyer_id); $buyer_name = $query4->row()->username; $buyer_email = $query4->row()->email; //Check md5('No Travel Cretids') || md5('Yes Travel Cretids') if ($is_travelCretids == '7c4f08a53f4454ea2a9fdd94ad0c2eeb') { $query5 = $this->Referrals_model->get_details_refamount($user_id); $amount = $query5->row()->amount; $updateKey = array('user_id ' => $user_id); $updateData = array(); $updateData['amount'] = $amount - $user_travel_cretids; $this->Referrals_model->updateReferralsAmount($updateKey, $updateData); $list['credit_type'] = 2; $list['ref_amount'] = $user_travel_cretids; $row = $query4->row(); //sent mail to administrator $email_name = 'tc_book_to_admin'; $splVars = array("{site_name}" => $this->dx_auth->get_site_title(), "{traveler_name}" => ucfirst($username), "{list_title}" => $row_list->title, "{book_date}" => date('m/d/Y'), "{book_time}" => date('g:i A'), "{traveler_email_id}" => $email_id, "{checkin}" => date('d-m-Y', $list['checkin']), "{checkout}" => date('d-m-Y', $list['checkout']), "{market_price}" => $user_travel_cretids + $list['price'], "{payed_amount}" => $list['price'], "{travel_credits}" => $user_travel_cretids, "{host_name}" => ucfirst($buyer_name), "{host_email_id}" => $buyer_email); //Send Mail $this->Email_model->sendMail($admin_email, $email_id, ucfirst($username), $email_name, $splVars); //sent mail to buyer $email_name = 'tc_book_to_host'; $splVars = array("{site_name}" => $this->dx_auth->get_site_title(), "{username}" => ucfirst($buyer_name), "{traveler_name}" => ucfirst($username), "{list_title}" => $row_list->title, "{book_date}" => date('m/d/Y'), "{book_time}" => date('g:i A'), "{traveler_email_id}" => $email_id, "{checkin}" => date('d-m-Y', $list['checkin']), "{checkout}" => date('d-m-Y', $list['checkout']), "{market_price}" => $list['price']); //Send Mail if ($buyer_email != '0') { $this->Email_model->sendMail($buyer_email, $admin_email, ucfirst($admin_name), $email_name, $splVars); } } $list['book_date'] = local_to_gmt(); //Actual insertion into the database $this->Common_model->insertData('reservation', $list); $reservation_id = $this->db->insert_id(); //Send Message Notification $insertData = array('list_id' => $list['list_id'], 'reservation_id' => $reservation_id, 'userby' => $list['userby'], 'userto' => $list['userto'], 'message' => 'You have a new reservation request from ' . ucfirst($username), 'created' => local_to_gmt(), 'message_type' => 1); $this->Message_model->sentMessage($insertData, ucfirst($buyer_name), ucfirst($username), $row_list->title, $reservation_id); $message_id = $this->db->insert_id(); $actionurl = site_url('trips/request/' . $reservation_id); //Reservation Notification To Host $email_name = 'host_reservation_notification'; $splVars = array("{site_name}" => $this->dx_auth->get_site_title(), "{username}" => ucfirst($buyer_name), "{traveler_name}" => ucfirst($username), "{list_title}" => $row_list->title, "{book_date}" => date('m/d/Y'), "{book_time}" => date('g:i A'), "{traveler_email_id}" => $email_id, "{checkin}" => date('d-m-Y', $list['checkin']), "{checkout}" => date('d-m-Y', $list['checkout']), "{market_price}" => $list['price'], "{action_url}" => $actionurl); //Send Mail // if ($buyer_email != '0') { $this->Email_model->sendMail($buyer_email, $admin_email, ucfirst($admin_name), $email_name, $splVars); } //Reservation Notification To Traveller $email_name = 'traveller_reservation_notification'; $splVars = array("{site_name}" => $this->dx_auth->get_site_title(), "{traveler_name}" => ucfirst($username)); //Send Mail $this->Email_model->sendMail($email_id, $admin_email, ucfirst($admin_name), $email_name, $splVars); //Reservation Notification To Administrator $email_name = 'admin_reservation_notification'; $splVars = array("{site_name}" => $this->dx_auth->get_site_title(), "{traveler_name}" => ucfirst($username), "{list_title}" => $row_list->title, "{book_date}" => date('m/d/Y'), "{book_time}" => date('g:i A'), "{traveler_email_id}" => $email_id, "{checkin}" => date('d-m-Y', $list['checkin']), "{checkout}" => date('d-m-Y', $list['checkout']), "{market_price}" => $user_travel_cretids + $list['price'], "{payed_amount}" => $list['price'], "{travel_credits}" => $user_travel_cretids, "{host_name}" => ucfirst($buyer_name), "{host_email_id}" => $buyer_email); //Send Mail $this->Email_model->sendMail($admin_email, $email_id, ucfirst($username), $email_name, $splVars); // if($is_block == 'on') // { $this->db->select_max('group_id'); $group_id = $this->db->get('calendar')->row()->group_id; if (empty($group_id)) { echo $countJ = 0; } else { $countJ = $group_id; } $insertData1['list_id'] = $list['list_id']; //$insertData['reservation_id'] = $reservation_id; $insertData1['group_id'] = $countJ + 1; $insertData1['availability'] = 'Not Available'; $insertData1['booked_using'] = 'Other'; $checkin = date('m/d/Y', $list['checkin']); $checkout = date('m/d/Y', $list['checkout']); $days = getDaysInBetween($checkin, $checkout); $count = count($days); $i = 1; foreach ($days as $val) { if ($count == 1) { $insertData1['style'] = 'single'; } else { if ($count > 1) { if ($i == 1) { $insertData1['style'] = 'left'; } else { if ($count == $i) { $insertData1['notes'] = ''; $insertData1['style'] = 'right'; } else { $insertData1['notes'] = ''; $insertData1['style'] = 'both'; } } } } $insertData1['booked_days'] = $val; $this->Trips_model->insert_calendar($insertData1); $i++; } } $referral_amount = $this->db->where('id', $this->dx_auth->get_user_id())->get('users')->row()->referral_amount; if ($referral_amount > 100) { $this->db->set('referral_amount', $referral_amount - 100)->where('id', $this->dx_auth->get_user_id())->update('users'); } else { $this->db->set('referral_amount', 0)->where('id', $this->dx_auth->get_user_id())->update('users'); } echo '[{"status":"SUCCESS updated"}]'; } }
$total = get_currency_value2($currency, $current, $fixed_amt); } else { $default = $this->Common_model->getTableData('currency', array('default' => 1))->row()->currency_code; $total = get_currency_value2($currency, $default, $fixed_amt); } if ($type == 1) { $trip_amt0 = $trip_amt; $rent_amt0 = $rent_amt; $current = $this->session->userdata("locale_currency"); if ($current != '') { $trip = get_currency_value2($currency, $current, $trip_amt); $rent = get_currency_value2($currency, $current, $rent_amt); } else { $default = $this->Common_model->getTableData('currency', array('default' => 1))->row()->currency_code; $trip = get_currency_value2($currency, $default, $trip_amt); $rent = get_currency_value2($currency, $default, $rent_amt); } } if ($type == 0) { $trip = round($trip_per / 100 * $total, 2); $rent = round($rent_per / 100 * $total, 2); $current = $this->session->userdata("locale_currency"); } ?> <div class="container_referral referral"> <h1 class="invite_friend"><?php echo translate('Invite Your Friends'); ?> </h1> <div class="shelf_wrapper">
public function accept_without_pay() { $refer = $this->db->query("select * from `referral_management` where `id`=1 ")->row(); //$data['fixed_status']=$refer->fixed_status; $refamt = $refer->fixed_amt; $refcur = $refer->currency; $type = $refer->type; $trip_amt = $refer->trip_amt; $trip_per = $refer->trip_per; $rent_amt = $refer->rent_amt; $rent_per = $refer->rent_per; $ref_total = get_currency_value2($refcur, 'USD', $refamt); if ($type == 1) { $trip_amt0 = $trip_amt; $rent_amt0 = $rent_amt; $trip = get_currency_value2($refcur, 'USD', $trip_amt); $rent = get_currency_value2($refcur, 'USD', $rent_amt); } if ($type == 0) { $trip = $trip_per / 100 * $ref_total; $rent = $rent_per / 100 * $ref_total; $current = $this->session->userdata("locale_currency"); } $reservation_id = $this->session->userdata('reservation_id'); $is_block = $this->session->userdata('is_block'); $comment = $this->session->userdata('comment'); $checkin = $this->session->userdata('checkin'); $checkout = $this->session->userdata('checkout'); $admin_email = $this->dx_auth->get_site_sadmin(); $admin_name = $this->dx_auth->get_site_title(); $conditions = array('reservation.id' => $reservation_id); $row = $this->Trips_model->get_reservation($conditions)->row(); /*$query1 = $this->Users_model->get_user_by_id($row->userby); $traveler_name = $query1->row()->username; $traveler_email = $query1->row()->email;*/ $query1 = $this->db->where('id', $row->userby)->get('users'); $traveler_name = $query1->row()->username; $traveler_email = $query1->row()->email; //$query2 = $this->Users_model->get_user_by_id($row->userto); $query2 = $this->db->where('id', $row->userto)->get('users'); $host_name = $query2->row()->username; $host_email = $query2->row()->email; $list_title = $this->Common_model->getTableData('list', array('id' => $row->list_id))->row()->title; $traveler = $this->Common_model->getTableData('profiles', array('id' => $row->userby))->row(); $host = $this->Common_model->getTableData('profiles', array('id' => $row->userto))->row(); //Traveller Info if (!empty($traveler)) { $FnameT = $traveler->Fname; $LnameT = $traveler->Lname; $liveT = $traveler->live; $phnumT = $traveler->phnum; } else { $FnameT = ''; $LnameT = ''; $liveT = ''; $phnumT = ''; } //Host Info if (!empty($host)) { $FnameH = $host->Fname; $LnameH = $host->Lname; $liveH = $host->live; $phnumH = $host->phnum; } else { $FnameH = ''; $LnameH = ''; $liveH = ''; $phnumH = ''; } //for calendar if ($is_block == 'on') { $this->db->select_max('group_id'); $group_id = $this->db->get('calendar')->row()->group_id; if (empty($group_id)) { echo $countJ = 0; } else { $countJ = $group_id; } $insertData['list_id'] = $row->list_id; $insertData['group_id'] = $countJ + 1; $insertData['availability'] = 'Booked'; $insertData['booked_using'] = 'Other'; $checkin = date('m/d/Y', $checkin); $checkout = date('m/d/Y', $checkout); $days = getDaysInBetween($checkin, $checkout); $count = count($days); $i = 1; foreach ($days as $val) { if ($count == 1) { $insertData['style'] = 'single'; } else { if ($count > 1) { if ($i == 1) { $insertData['style'] = 'left'; } else { if ($count == $i) { $insertData['notes'] = ''; $insertData['style'] = 'right'; } else { $insertData['notes'] = ''; $insertData['style'] = 'both'; } } } } $insertData['booked_days'] = $val; $this->Trips_model->insert_calendar($insertData); $i++; } } $list_data = $this->db->where('id', $row->list_id)->get('list')->row(); //Send Message Notification To Traveler $insertData = array('list_id' => $row->list_id, 'reservation_id' => $reservation_id, 'userby' => $row->userto, 'userto' => $row->userby, 'message' => "Congratulation, Your reservation request is granted by" . $host_name . " for " . $list_title, 'created' => local_to_gmt(), 'message_type' => 3); $this->Message_model->sentMessage($insertData, 1); $updateData['is_respond'] = 1; $updateKey['reservation_id'] = $reservation_id; $updateKey['userto'] = $row->userto; $this->Message_model->updateMessage($updateKey, $updateData); $referral_code_check1 = $this->db->where('id', $row->userto)->get('users'); if ($referral_code_check1->row()->list_referral_code) { $own_referral_code = $referral_code_check1->row()->list_referral_code; $referral_code_check2 = $this->db->where('referral_code', $own_referral_code)->get('users'); if ($referral_code_check2->num_rows() != 0) { $insertData = array('list_id' => $row->list_id, 'reservation_id' => $reservation_id, 'userby' => $row->userto, 'userto' => $referral_code_check2->row()->id, 'message' => "Congratulation, You have earned \$" . $rent . " by " . $host_name, 'created' => local_to_gmt(), 'message_type' => 9); $this->Message_model->sentMessage($insertData, 1); $this->db->set('list_referral_code', '')->where('id', $referral_code_check1->row()->id)->update('users'); // $this->db->set('cancel_list_referral_code',$own_referral_code)->where('id',$referral_code_check1->row()->id)->update('users'); $amt_check = $this->db->where('id', $referral_code_check2->row()->id)->get('users'); $rent1 = $referral_code_check1->row()->ref_rent; $trip1 = $referral_code_check1->row()->ref_trip; if ($amt_check->row()->referral_amount) { $amt = $rent1 + $amt_check->row()->referral_amount; } else { $amt = $rent1; } $this->db->set('referral_amount', $amt)->where('id', $referral_code_check2->row()->id)->update('users'); $email_name = 'referral_credit'; $splVars = array("{site_name}" => $this->dx_auth->get_site_title(), "{friend_name}" => $host_name, "{user_name}" => $referral_code_check2->row()->username, '{amount}' => '$' . $rent); $this->Email_model->sendMail($referral_code_check2->row()->email, $admin_email, ucfirst($admin_name), $email_name, $splVars); } } $referral_code_check3 = $this->db->where('id', $row->userby)->get('users'); if ($referral_code_check3->row()->trips_referral_code) { $own_referral_code = $referral_code_check3->row()->trips_referral_code; // echo $own_referral_code; // exit; $referral_code_check4 = $this->db->where('referral_code', $own_referral_code)->get('users'); if ($referral_code_check4->num_rows() != 0) { $insertData = array('list_id' => $row->list_id, 'reservation_id' => $reservation_id, 'userby' => $row->userby, 'userto' => $referral_code_check4->row()->id, 'message' => "Congratulation, You have earned \$" . $trip . " by " . $referral_code_check3->row()->username, 'created' => local_to_gmt(), 'message_type' => 9); $this->Message_model->sentMessage($insertData, 1); $this->db->set('trips_referral_code', '')->where('id', $referral_code_check3->row()->id)->update('users'); // $this->db->set('cancel_trips_referral_code',$own_referral_code)->where('id',$referral_code_check3->row()->id)->update('users'); $amt_check1 = $this->db->where('id', $referral_code_check4->row()->id)->get('users'); $rent2 = $referral_code_check3->row()->ref_rent; $trip2 = $referral_code_check3->row()->ref_trip; $amt_check1 = $this->db->where('id', $referral_code_check4->row()->id)->get('users'); if ($amt_check1->row()->referral_amount) { $amt1 = $trip2 + $amt_check1->row()->referral_amount; } else { $amt1 = $trip2; } $this->db->set('referral_amount', $amt1)->where('id', $referral_code_check4->row()->id)->update('users'); $email_name = 'referral_credit'; $splVars = array("{site_name}" => $this->dx_auth->get_site_title(), "{friend_name}" => $referral_code_check3->row()->username, "{username}" => $referral_code_check4->row()->username, "{amount}" => '$' . $trip); $this->Email_model->sendMail($referral_code_check4->row()->email, $admin_email, ucfirst($admin_name), $email_name, $splVars); } } $updateKey = array('id' => $reservation_id); $updateData = array(); $updateData['status '] = 3; $updateData['is_payed'] = 0; $this->Trips_model->update_reservation($updateKey, $updateData); if ($list_data->optional_address == '') { $optional_address = ' -'; } else { $optional_address = $list_data->optional_address; } if ($list_data->state == '') { $state = ' -'; } else { $state = $list_data->state; } //Send Mail To Traveller $email_name = 'traveler_reservation_granted'; $splVars = array("{site_name}" => $this->dx_auth->get_site_title(), "{traveler_name}" => ucfirst($traveler_name), "{list_name}" => $list_title, "{host_name}" => ucfirst($host_name), "{Fname}" => $FnameH, "{Lname}" => $LnameH, "{livein}" => $liveH, "{phnum}" => $phnumH, "{comment}" => $comment, "{street_address}" => $list_data->street_address, "{optional_address}" => $optional_address, "{city}" => $list_data->city, "{state}" => $state, "{country}" => $list_data->country, "{zipcode}" => $list_data->zip_code); $this->Email_model->sendMail($traveler_email, $host_email, ucfirst($admin_name), $email_name, $splVars); //Send Mail To Host $email_name = 'host_reservation_granted'; $splVars = array("{site_name}" => $this->dx_auth->get_site_title(), "{traveler_name}" => ucfirst($traveler_name), "{list_title}" => $list_title, "{host_name}" => ucfirst($host_name), "{Fname}" => $FnameT, "{Lname}" => $LnameT, "{livein}" => $liveT, "{phnum}" => $phnumT, "{comment}" => $comment); $this->Email_model->sendMail($host_email, $admin_email, ucfirst($admin_name), $email_name, $splVars); //Send Mail To Administrator $email_name = 'admin_reservation_granted'; $splVars = array("{site_name}" => $this->dx_auth->get_site_title(), "{traveler_name}" => ucfirst($traveler_name), "{list_title}" => $list_title, "{host_name}" => ucfirst($host_name)); $this->Email_model->sendMail($admin_email, $admin_email, ucfirst($admin_name), $email_name, $splVars); redirect('trips/request/' . $reservation_id); }
function google_signin() { extract($this->input->post()); $user = $name; /* if(!$this->_check_user_name($user)) { $user_name = explode('@',$email); $user = $user_name[0]; } */ $google_id = $id; $email = $email; $query = $this->Users_model->getUserInfobyemail_id($email); $fbid = $query['fb_id']; $googleid = $query['google_id']; $userid = $query['id']; $username = $query['username']; $remember_me = 1; if ($fbid) { $name = $query['username']; //echo $fb_id; $user_info = $this->Users_model->getUserInfobyfb_username($name); $this->Users_model->FacebookUserLast($id); $user = array('DX_user_id' => $user_info['id'], 'DX_username' => $user_info['username'], 'DX_emailId' => $user_info['email'], 'DX_role_id' => $user_info['role_id'], 'DX_logged_in' => TRUE); $this->session->set_userdata($user); $this->Common_model->updateTableData('login_history', 0, array('session_id' => $this->session->userdata('session_id')), array('user_id' => $this->dx_auth->get_user_id())); $condition = array("id" => $this->dx_auth->get_user_id()); $data['fb_id'] = $id; $data['via_login'] = "******"; $this->Common_model->updateTableData('users', NULL, $condition, $data); echo 'users/signup'; } else { if ($this->dx_auth->login($user, $email)) { // Redirect to homepage $newdata = array('user' => $this->dx_auth->get_user_id(), 'username' => $this->dx_auth->get_username(), 'logged_in' => TRUE); $this->session->set_userdata($newdata); $this->Common_model->updateTableData('login_history', 0, array('session_id' => $this->session->userdata('session_id')), array('user_id' => $this->dx_auth->get_user_id())); $condition = array("id" => $this->dx_auth->get_user_id()); $data_via['via_login'] = "******"; $this->Common_model->updateTableData('users', NULL, $condition, $data_via); if ($this->session->userdata('redirect_to')) { $redirect_to = $this->session->userdata('redirect_to'); $this->session->unset_userdata('redirect_to'); //redirect($redirect_to, 'refresh'); echo $redirect_to; exit; } else { $this->session->set_flashdata('flash_message', $this->Common_model->flash_message('success', translate('Logged in successfully.'))); //redirect('home/dashboard/', 'refresh'); echo 'home/dashboard'; exit; } } else { if ($this->_check_user_name($user) && $this->_check_user_email($email)) { $data = $this->dx_auth->register($user, $email, $email); $this->dx_auth->login($user, $email, 'TRUE'); $this->Common_model->updateTableData('login_history', 0, array('session_id' => $this->session->userdata('session_id')), array('user_id' => $this->dx_auth->get_user_id())); $condition = array("id" => $this->dx_auth->get_user_id()); $data_via['via_login'] = "******"; $data_via['google_id'] = $google_id; $this->Common_model->updateTableData('users', NULL, $condition, $data_via); //To check user come by reference if ($this->session->userdata('ref_id')) { $ref_id = $this->session->userdata('ref_id'); } else { $ref_id = ""; } if (!empty($ref_id)) { $details = $this->Referrals_model->get_user_by_refId($ref_id); $invite_from = $details->row()->id; $insertData = array(); $insertData['invite_from'] = $invite_from; $insertData['invite_to'] = $this->dx_auth->get_user_id(); $insertData['join_date'] = local_to_gmt(); $this->Referrals_model->insertReferrals($insertData); $this->session->unset_userdata('ref_id'); } //referral amount $referral_code['referral_code'] = $this->session->userdata('referral_code'); $refer = $this->db->query("select * from `referral_management` where `id`=1 ")->row(); $refamt = $refer->fixed_amt; $refcur = $refer->currency; $type = $refer->type; $trip_amt = $refer->trip_amt; $trip_per = $refer->trip_per; $rent_amt = $refer->rent_amt; $rent_per = $refer->rent_per; $ref_total = get_currency_value2($refcur, 'USD', $refamt); if ($type == 1) { $trip_amt0 = $trip_amt; $rent_amt0 = $rent_amt; $trip = get_currency_value2($refcur, 'USD', $trip_amt); $rent = get_currency_value2($refcur, 'USD', $rent_amt); } if ($type == 0) { $trip = $trip_per / 100 * $ref_total; $rent = $rent_per / 100 * $ref_total; $current = $this->session->userdata("locale_currency"); } $this->db->set('trips_referral_code', $referral_code['referral_code'])->where('id', $this->dx_auth->get_user_id())->update('users'); $this->db->set('list_referral_code', $referral_code['referral_code'])->where('id', $this->dx_auth->get_user_id())->update('users'); $this->db->set('ref_total', $ref_total)->where('id', $this->dx_auth->get_user_id())->update('users'); $this->db->set('ref_trip', $trip)->where('id', $this->dx_auth->get_user_id())->update('users'); $this->db->set('ref_rent', $rent)->where('id', $this->dx_auth->get_user_id())->update('users'); $this->session->unset_userdata('referral_code'); $this->session->unset_userdata('referral_code'); $notification = array(); $notification['user_id'] = $this->dx_auth->get_user_id(); $notification['new_review '] = 1; $notification['leave_review'] = 1; $this->Common_model->insertData('user_notification', $notification); //Need to add this data to user profile too $add['Fname'] = $first_name; $add['Lname'] = $last_name; $add['id'] = $this->dx_auth->get_user_id(); $add['email'] = $email; $this->Common_model->insertData('profiles', $add); //mail send to referred $referralcode = $referral_code['referral_code']; if ($referralcode != "") { $this->Referrals_model->get_user_refId($referralcode); $user = $this->Referrals_model->get_user_refId($referralcode)->result(); foreach ($user as $us) { $email_user = $us->email; $user_name = $us->username; } $admin_email = $this->dx_auth->get_site_sadmin(); $admin_name = $this->dx_auth->get_site_title(); $email_name = 'User_join_to_Referal_mail'; $splVars = array("{site_name}" => $this->dx_auth->get_site_title(), "{friend_name}" => $first, "{user_name}" => $email_user, "{refer_name}" => $user_name); $this->Email_model->sendMail($email_user, $admin_email, ucfirst($admin_name), $email_name, $splVars); } //End of adding it //$this->session->set_flashdata('flash_message', $this->Common_model->flash_message('success',translate('Logged in successfully.'))); //redirect('home/dashboard','refresh'); echo 'home/dashboard'; exit; } else { //echo $pass; //$password= $this->encrypt->decode($pass); //echo $password; //exit; $user = array('DX_user_id' => $query['id'], 'DX_username' => $query['username'], 'DX_emailId' => $query['email'], 'DX_role_id' => $query['role_id'], 'DX_logged_in' => TRUE); $this->session->set_userdata($user); echo 'home/dashboard'; location . reload(); } } } }
function paypal_success() { $token = $_GET['token']; $payer_id = $_GET['PayerID']; // GetExpressCheckoutDetails $get_ec_return = $this->paypal_ec->get_ec($token); if (isset($get_ec_return['ec_status']) && $get_ec_return['ec_status'] === true) { // at this point, you have all of the data for the transaction. // you may want to save the data for future action. what's left to // do is to collect the money -- you do that by call DoExpressCheckoutPayment // via $this->paypal_ec->do_ec(); // // I suggest to save all of the details of the transaction. You get all that // in $get_ec_return array $currency_code = $this->session->userdata('currency_code_payment'); if ($currency_code == 'INR' || $currency_code == 'MYR' || $currency_code == 'ARS' || $currency_code == 'CNY' || $currency_code == 'IDR' || $currency_code == 'KRW' || $currency_code == 'VND' || $currency_code == 'ZAR') { $currency_code = 'USD'; //$currency_code = $this->session->userdata('booking_currency_symbol'); $amt = get_currency_value_lys($currency_code, $currency_code, $amt); } else { //$currency_code = $this->session->userdata('booking_currency_symbol'); $currency_code = $currency_code; $amt = $amt; } $ec_details = array('token' => $token, 'payer_id' => $payer_id, 'currency' => $currency_code, 'amount' => $get_ec_return['PAYMENTREQUEST_0_AMT'], 'IPN_URL' => site_url('payments/ipn'), 'type' => 'sale'); // DoExpressCheckoutPayment $do_ec_return = $this->paypal_ec->do_ec($ec_details); if (isset($do_ec_return['ec_status']) && $do_ec_return['ec_status'] === true) { // at this point, you have collected payment from your customer // you may want to process the order now. /* echo "<h1>Thank you. We will process your order now.</h1>"; echo "<pre>"; echo "\nGetExpressCheckoutDetails Data\n" . print_r($get_ec_return, true); echo "\n\nDoExpressCheckoutPayment Data\n" . print_r($do_ec_return, true); echo "</pre>";exit; */ if (isset($do_ec_return['L_SHORTMESSAGE0']) && $do_ec_return['L_SHORTMESSAGE0'] === 'Duplicate Request') { redirect('home'); } $refer = $this->db->query("select * from `referral_management` where `id`=1 ")->row(); //$data['fixed_status']=$refer->fixed_status; $refamt = $refer->fixed_amt; $refcur = $refer->currency; $type = $refer->type; $trip_amt = $refer->trip_amt; $trip_per = $refer->trip_per; $rent_amt = $refer->rent_amt; $rent_per = $refer->rent_per; $ref_total = get_currency_value2($refcur, 'USD', $refamt); if ($type == 1) { $trip_amt0 = $trip_amt; $rent_amt0 = $rent_amt; $trip = get_currency_value2($refcur, 'USD', $trip_amt); $rent = get_currency_value2($refcur, 'USD', $rent_amt); } if ($type == 0) { $trip = $trip_per / 100 * $ref_total; $rent = $rent_per / 100 * $ref_total; $current = $this->session->userdata("locale_currency"); } $custom = $this->session->userdata('custom'); $data = array(); $list = array(); $data = explode('@', $custom); $contact_key = $data[9]; $list['list_id'] = $data[0]; $list['userby'] = $data[1]; $query1 = $this->Common_model->getTableData('list', array('id' => $list['list_id'])); $buyer_id = $query1->row()->user_id; $list['userto'] = $buyer_id; $list['checkin'] = $data[2]; $list['checkout'] = $data[3]; $list['no_quest'] = $data[4]; $date1 = new DateTime(date('Y-m-d H:i:s', $list['checkin'])); $date2 = new DateTime(date('Y-m-d H:i:s', $list['checkout'])); $interval = $date1->diff($date2); if ($interval->days >= 28) { $list['policy'] = 5; } else { $list['policy'] = $query1->row()->cancellation_policy; } $amt = $data[14]; $list['price'] = $data[14]; $currency = $data[15]; $list['payment_id'] = 2; $list['credit_type'] = 1; $list['transaction_id'] = 0; $is_travelCretids = $data[5]; $user_travel_cretids = $data[6]; $list['currency'] = get_currency_code(); if ($currency != 'USD') { $list['admin_commission'] = $data[8]; $list['cleaning'] = $data[10]; $list['security'] = $data[11]; $list['topay'] = $this->session->userdata('subtotal'); } else { $list['admin_commission'] = $data[8]; $list['cleaning'] = $data[10]; $list['security'] = $data[11]; $list['topay'] = $this->session->userdata('subtotal'); } $list['guest_count'] = $data[13]; if ($list['no_quest'] > $list['guest_count']) { if ($currency != 'USD') { $list['extra_guest_price'] = $data[12]; } else { $list['extra_guest_price'] = $data[12]; } } if ($this->session->userdata('contact_key') != '') { $updateKey = array('contact_key' => $this->session->userdata('contact_key')); $updateData = array(); $updateData['status'] = 10; $list['contacts_offer'] = $this->session->userdata('contacts_offer'); $this->Contacts_model->update_contact($updateKey, $updateData); } if ($contact_key != "None") { $list['status'] = 1; $this->db->select_max('group_id'); $group_id = $this->db->get('calendar')->row()->group_id; if (empty($group_id)) { echo $countJ = 0; } else { $countJ = $group_id; } $insertData['list_id'] = $list['list_id']; $insertData['group_id'] = $countJ + 1; $insertData['availability'] = 'Booked'; $insertData['booked_using'] = 'Other'; $checkin = date('m/d/Y', $list['checkin']); $checkout = date('m/d/Y', $list['checkout']); $days = getDaysInBetween($checkin, $checkout); $count = count($days); $i = 1; foreach ($days as $val) { if ($count == 1) { $insertData['style'] = 'single'; } else { if ($count > 1) { if ($i == 1) { $insertData['style'] = 'left'; } else { if ($count == $i) { $insertData['notes'] = ''; $insertData['style'] = 'right'; } else { $insertData['notes'] = ''; $insertData['style'] = 'both'; } } } } $insertData['booked_days'] = $val; $this->Trips_model->insert_calendar($insertData); $i++; } } else { $listid1 = $list['list_id']; $instance_book = $this->db->where('id', $listid1)->get('list')->row()->instance_book; //echo $this->db->last_query(); if ($instance_book == 1) { $list['status'] = 3; } else { $list['status'] = 1; } } if ($list['price'] > $rent) { $user_id = $list['userby']; $details = $this->Referrals_model->get_details_by_Iid($user_id); $row = $details->row(); $count = $details->num_rows(); if ($count > 0) { $user = $this->Users_model->get_user_by_id($this->dx_auth->get_user_id())->row(); $trip1 = $user->ref_trip; $rent1 = $user->ref_rent; $details1 = $this->Referrals_model->get_details_refamount($row->invite_from); $amt_check = $this->db->where('id', $row->invite_from)->get('users'); if ($amt_check->num_rows() == 0) { $insertData = array(); $insertData['user_id'] = $row->invite_from; $insertData['count_trip'] = 1; $insertData['amount'] = $trip1; $this->Referrals_model->insertReferralsAmount($insertData); } else { $count_trip = $details1->row()->count_trip; $amount = $amt_check->row()->amount; $updateKey = array('id' => $row->id); $updateData = array(); $updateData['count_trip'] = $count_trip + 1; $updateData['amount'] = $amount + $trip1; $this->Referrals_model->updateReferralsAmount($updateKey, $updateData); } } } $q = $query1->result(); $row_list = $query1->row(); $iUser_id = $q[0]->user_id; $details2 = $this->Referrals_model->get_details_by_Iid($iUser_id); $row = $details2->row(); $count = $details2->num_rows(); if ($count > 0) { $user = $this->Users_model->get_user_by_id($this->dx_auth->get_user_id())->row(); $trip1 = $user->ref_trip; $rent1 = $user->ref_rent; $details3 = $this->Referrals_model->get_details_refamount($row->invite_from); $amt_check1 = $this->db->where('id', $row->invite_from)->get('users'); if ($amt_check1->num_rows() == 0) { $insertData = array(); $insertData['user_id'] = $row->invite_from; $insertData['count_book'] = 1; $insertData['amount'] = $rent1; $this->Referrals_model->insertReferralsAmount($insertData); } else { $count_book = $amt_check1->row()->count_book; $amount = $amt_check1->row()->amount; $updateKey = array('id' => $row->id); $updateData = array(); $updateData['count_trip'] = $count_book + 1; $updateData['amount'] = $amount + $rent1; $this->Referrals_model->updateReferralsAmount($updateKey, $updateData); } } $admin_email = $this->dx_auth->get_site_sadmin(); $admin_name = $this->dx_auth->get_site_title(); $query3 = $this->Common_model->getTableData('users', array('id' => $list['userby'])); $rows = $query3->row(); $username = $rows->username; $user_id = $rows->id; $email_id = $rows->email; $query4 = $this->Users_model->get_user_by_id($buyer_id); $buyer_name = $query4->row()->username; $buyer_email = $query4->row()->email; //Check md5('No Travel Cretids') || md5('Yes Travel Cretids') if ($is_travelCretids == '7c4f08a53f4454ea2a9fdd94ad0c2eeb') { $query5 = $this->Referrals_model->get_details_refamount($user_id); $amount = $query5->row()->amount; $updateKey = array('user_id ' => $user_id); $updateData = array(); $updateData['amount'] = $amount - $user_travel_cretids; $this->Referrals_model->updateReferralsAmount($updateKey, $updateData); $list['credit_type'] = 2; $list['ref_amount'] = $user_travel_cretids; $row = $query4->row(); //sent mail to administrator $email_name = 'tc_book_to_admin'; $splVars = array("{site_name}" => $this->dx_auth->get_site_title(), "{traveler_name}" => ucfirst($username), "{list_title}" => $row_list->title, "{book_date}" => date('m/d/Y'), "{book_time}" => date('g:i A'), "{traveler_email_id}" => $email_id, "{checkin}" => date('d-m-Y', $list['checkin']), "{checkout}" => date('d-m-Y', $list['checkout']), "{market_price}" => $user_travel_cretids + $list['price'], "{payed_amount}" => $list['price'], "{travel_credits}" => $user_travel_cretids, "{host_name}" => ucfirst($buyer_name), "{host_email_id}" => $buyer_email); //Send Mail $this->Email_model->sendMail($admin_email, $email_id, ucfirst($username), $email_name, $splVars); //sent mail to buyer $email_name = 'tc_book_to_host'; $splVars = array("{site_name}" => $this->dx_auth->get_site_title(), "{username}" => ucfirst($buyer_name), "{traveler_name}" => ucfirst($username), "{list_title}" => $row_list->title, "{book_date}" => date('m/d/Y'), "{book_time}" => date('g:i A'), "{traveler_email_id}" => $email_id, "{checkin}" => date('d-m-Y', $list['checkin']), "{checkout}" => date('d-m-Y', $list['checkout']), "{market_price}" => $list['price']); //Send Mail if ($buyer_email != '0') { $this->Email_model->sendMail($buyer_email, $admin_email, ucfirst($admin_name), $email_name, $splVars); } } $list['book_date'] = local_to_gmt(); if ($this->session->userdata('coupon_code_used') == 1) { $list['coupon'] = $this->session->userdata('coupon_code'); $this->db->where('couponcode', $list['coupon'])->update('coupon', array('status' => 1)); $this->db->where('used_coupon_code', $list['coupon'])->update('coupon_users', array('status' => 1)); $this->session->unset_userdata('coupon_code'); $this->session->unset_userdata('coupon_code_used'); } else { $list['coupon'] = 0; } //Actual insertion into the database $this->Common_model->insertData('reservation', $list); $reservation_id = $this->db->insert_id(); $reservation_result = $this->Common_model->getTableData('reservation', array('id' => $reservation_id))->row(); $currency_symbol = $this->Common_model->getTableData('currency', array('currency_code' => $reservation_result->currency))->row()->currency_symbol; $price = $reservation_result->currency . ' ' . $currency_symbol . $reservation_result->price; $host_price = $reservation_result->currency . ' ' . $currency_symbol . $reservation_result->topay; if ($interval->days >= 28) { $conversation = $this->db->where('userto', $list['userto'])->where('userby', $list['userby'])->order_by('id', 'desc')->get('messages'); $conversation1 = $this->db->where('userto', $list['userby'])->where('userby', $list['userto'])->order_by('id', 'desc')->get('messages'); if ($conversation->num_rows() != 0) { $conversation_id = $conversation->row()->id; } elseif ($conversation1->num_rows() != 0) { $conversation_id = $conversation1->row()->id; } else { $conversation_id = $reservation_id . '1'; } //Send Message Notification $insertData = array('list_id' => $list['list_id'], 'reservation_id' => $reservation_id, 'conversation_id' => $conversation_id, 'userby' => 1, 'userto' => $list['userby'], 'message' => "Your reservation is 28 days or more. So, Long Term cancellation policy applied for " . $row_list->title, 'created' => local_to_gmt(), 'message_type' => 3); $this->Message_model->sentMessage($insertData, ucfirst($buyer_name), ucfirst($username), $row_list->title, $reservation_id); //Send Message Notification $insertData = array('list_id' => $list['list_id'], 'reservation_id' => $reservation_id, 'conversation_id' => $conversation_id, 'userby' => 1, 'userto' => $list['userto'], 'message' => ucfirst($username) . " reservation is 28 days or more. So, Long Term cancellation policy applied for " . $row_list->title, 'created' => local_to_gmt(), 'message_type' => 3); $this->Message_model->sentMessage($insertData, ucfirst($buyer_name), ucfirst($username), $row_list->title, $reservation_id); } //Send Message Notification if ($instance_book == 1) { $insertData = array('list_id' => $list['list_id'], 'reservation_id' => $reservation_id, 'conversation_id' => $reservation_id, 'userby' => $list['userto'], 'userto' => $list['userby'], 'message' => 'Your reservation is successfully done ', 'created' => local_to_gmt(), 'message_type' => 3); $this->Message_model->sentMessage($insertData, ucfirst($username), ucfirst($buyer_name), $row_list->title, $reservation_id); $message_id = $this->db->insert_id(); $insertData = array('list_id' => $list['list_id'], 'reservation_id' => $reservation_id, 'conversation_id' => $reservation_id, 'userby' => $list['userby'], 'userto' => $list['userto'], 'message' => 'You have a new reservation from ' . ucfirst($username), 'created' => local_to_gmt(), 'message_type' => 1); } else { $insertData = array('list_id' => $list['list_id'], 'reservation_id' => $reservation_id, 'userby' => $list['userby'], 'userto' => $list['userto'], 'message' => 'You have a new reservation request from ' . ucfirst($username), 'created' => local_to_gmt(), 'message_type' => 1); } $this->Message_model->sentMessage($insertData, ucfirst($buyer_name), ucfirst($username), $row_list->title, $reservation_id); $message_id = $this->db->insert_id(); $actionurl = site_url('trips/request/' . $reservation_id); //date_default_timezone_set('Asia/Kolkata'); //Reservation Notification To Host $email_name = 'host_reservation_notification'; $splVars = array("{site_name}" => $this->dx_auth->get_site_title(), "{username}" => ucfirst($buyer_name), "{traveler_name}" => ucfirst($username), "{list_title}" => $row_list->title, "{book_date}" => date('m/d/Y'), "{book_time}" => date('g:i A', time()), "{traveler_email_id}" => $email_id, "{checkin}" => date('m/d/Y', $list['checkin']), "{checkout}" => date('m/d/Y', $list['checkout']), "{market_price}" => $host_price, "{action_url}" => $actionurl); //Send Mail // if ($buyer_email != '0') { $this->Email_model->sendMail($buyer_email, $admin_email, ucfirst($admin_name), $email_name, $splVars); } //Reservation Notification To Traveller $email_name = 'traveller_reservation_notification'; $splVars = array("{site_name}" => $this->dx_auth->get_site_title(), "{traveler_name}" => ucfirst($username)); //Send Mail $this->Email_model->sendMail($email_id, $admin_email, ucfirst($admin_name), $email_name, $splVars); //Reservation Notification To Administrator $email_name = 'admin_reservation_notification'; $splVars = array("{site_name}" => $this->dx_auth->get_site_title(), "{traveler_name}" => ucfirst($username), "{list_title}" => $row_list->title, "{book_date}" => date('m/d/Y'), "{book_time}" => date('g:i A', time()), "{traveler_email_id}" => $email_id, "{checkin}" => date('m/d/Y', $list['checkin']), "{checkout}" => date('m/d/Y', $list['checkout']), "{market_price}" => $price, "{payed_amount}" => $list['price'], "{travel_credits}" => $user_travel_cretids, "{host_name}" => ucfirst($buyer_name), "{host_email_id}" => $buyer_email); //Send Mail $this->Email_model->sendMail($admin_email, $email_id, ucfirst($username), $email_name, $splVars); // if($is_block == 'on') // { $this->db->select_max('group_id'); $group_id = $this->db->get('calendar')->row()->group_id; if (empty($group_id)) { echo $countJ = 0; } else { $countJ = $group_id; } $insertData1['list_id'] = $list['list_id']; //$insertData['reservation_id'] = $reservation_id; $insertData1['group_id'] = $countJ + 1; $insertData1['availability'] = 'Not Available'; $insertData1['booked_using'] = 'Other'; $checkin = date('m/d/Y', $list['checkin']); $checkout = date('m/d/Y', $list['checkout']); $days = getDaysInBetween($checkin, $checkout); // print_r($days);exit; $count = count($days); $i = 1; foreach ($days as $val) { if ($count == 1) { $insertData1['style'] = 'single'; } else { if ($count > 1) { if ($i == 1) { $insertData1['style'] = 'left'; } else { if ($count == $i) { $insertData1['notes'] = ''; $insertData1['style'] = 'right'; } else { $insertData1['notes'] = ''; $insertData1['style'] = 'both'; } } } } $insertData1['booked_days'] = $val; $this->Trips_model->insert_calendar($insertData1); $i++; } $referral_amount = $this->db->where('id', $this->dx_auth->get_user_id())->get('users')->row()->referral_amount; if ($referral_amount > $ref_total) { $this->db->set('referral_amount', $referral_amount - $ref_total)->where('id', $this->dx_auth->get_user_id())->update('users'); } // else // { // $this->db->set('referral_amount',0)->where('id',$this->dx_auth->get_user_id())->update('users'); // } if ($this->session->userdata('call_back') == 'mobile') { $message_element = 'payments/paypal_success_mobile'; } else { // Advertisement popup 2 start $data['PagePopupContent'] = GetPagePopupContent('step4'); // Advertisement popup 2 end $message_element = 'payments/paypal_success'; } $data['title'] = "Payment Success !"; $data['message_element'] = $message_element; $this->load->view('template', $data); } else { $this->_error($do_ec_return); } } else { $this->_error($get_ec_return); } }
public function Facebook_MailId() { $fb_id = $this->session->userdata('fb_id'); $src = $this->session->userdata('src'); $mailId = $this->session->userdata('email'); $username = $this->session->userdata('username'); $user_id = $this->Users_model->createFacebookUserEmail($fb_id, $username, $mailId, $src); // $query_users = $this->db->query('UPDATE users SET email="'.$mailId.'" WHERE fb_id="'.$fb_id.'"'); //$query_profiles = $this->db->query('UPDATE profiles SET email="'.$mailId.'" WHERE id="'.$user_id.'"'); $referral_code['referral_code'] = $this->session->userdata('referral_code'); $refer = $this->db->query("select * from `referral_management` where `id`=1 ")->row(); $refamt = $refer->fixed_amt; $refcur = $refer->currency; $type = $refer->type; $trip_amt = $refer->trip_amt; $trip_per = $refer->trip_per; $rent_amt = $refer->rent_amt; $rent_per = $refer->rent_per; $ref_total = get_currency_value2($refcur, 'USD', $refamt); if ($type == 1) { $trip_amt0 = $trip_amt; $rent_amt0 = $rent_amt; $trip = get_currency_value2($refcur, 'USD', $trip_amt); $rent = get_currency_value2($refcur, 'USD', $rent_amt); } if ($type == 0) { $trip = $trip_per / 100 * $ref_total; $rent = $rent_per / 100 * $ref_total; $current = $this->session->userdata("locale_currency"); } $this->db->set('trips_referral_code', $referral_code['referral_code'])->where('fb_id', $fb_id)->update('users'); $this->db->set('list_referral_code', $referral_code['referral_code'])->where('fb_id', $fb_id)->update('users'); $this->db->set('ref_total', $ref_total)->where('fb_id', $fb_id)->update('users'); $this->db->set('ref_trip', $trip)->where('fb_id', $fb_id)->update('users'); $this->db->set('ref_rent', $rent)->where('fb_id', $fb_id)->update('users'); $add2['email'] = $mailId; $add2['src'] = $src; $this->Common_model->insertData('profile_picture', $add2); //$reference =substr(number_format(time() * rand(),0,'',''),0,6); $reference = md5($username); $data2 = array("photo_status" => 2); $this->db->where('fb_id', $fb_id); $this->db->update('users', $data2); $user = array('DX_user_id' => $user_id, 'DX_username' => $username, 'DX_emailId' => $mailId, 'DX_logged_in' => TRUE); $this->session->set_userdata($user); $this->Common_model->updateTableData('login_history', 0, array('session_id' => $this->session->userdata('session_id')), array('user_id' => $this->dx_auth->get_user_id())); $condition = array("id" => $this->dx_auth->get_user_id()); $data['via_login'] = "******"; $data['ref_id'] = $reference; $this->Common_model->updateTableData('users', NULL, $condition, $data); $admin_email = $this->dx_auth->get_site_sadmin(); $referralcode = $this->session->userdata('referral_code'); if ($referralcode != "") { $this->Referrals_model->get_user_refId($referralcode); $user = $this->Referrals_model->get_user_refId($referralcode)->result(); foreach ($user as $us) { $email_user = $us->email; $user_name = $us->username; } $admin_name = $this->dx_auth->get_site_title(); $email_name = 'User_join_to_Referal_mail'; $splVars = array("{site_name}" => $this->dx_auth->get_site_title(), "{friend_name}" => $username, "{user_name}" => $email_user, "{refer_name}" => $user_name); $this->Email_model->sendMail($email_user, $admin_email, ucfirst($admin_name), $email_name, $splVars); } echo 'home/dashboard'; //redirect('users/signup'); }