| Server IP : 103.234.187.230 / Your IP : 216.73.216.216 Web Server : Apache System : Linux lserver42043-ind.megavelocity.net 3.10.0-1160.108.1.el7.x86_64 #1 SMP Thu Jan 25 16:17:31 UTC 2024 x86_64 User : apache ( 48) PHP Version : 7.4.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /var/www/html/b2bzend/ |
Upload File : |
<?php
//$baseUrl = 'http://local.b2bzend.com/';
//$baseUrl = 'http://st.tb.tripsbank.com/';
//$baseUrl = 'https://globaltravelexchange.com/';
if ($_SERVER['HTTP_HOST'] == 'local.b2bzend.com') {
$baseUrl = 'http://local.b2bzend.com/';
} else if ($_SERVER['HTTP_HOST'] == 'crm.ineedtrip.com') {
$baseUrl = 'https://crm.ineedtrip.com/';
} else if ($_SERVER['HTTP_HOST'] == 'st.globaltravelexchange.com') {
$baseUrl = 'http://st.globaltravelexchange.com/';
} else {
$baseUrl = 'https://globaltravelexchange.com/';
}
if ($_POST) {
if ($_POST['leadsend'] == 0) {
try {
$_POST['Noofdays'] = (int)$_POST['Noofdays'];
$curl = curl_init($baseUrl . "gtxwebservices/lead"); // b2c site url
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($_POST));
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
$response = curl_exec($curl);
// echo "<pre>";print_r($response);die;
curl_close($curl);
$responseArr = json_decode($response, 1);
// echo "<pre>";print_r($responseArr);die('query');
if ($responseArr['status'] == 'success') {
echo json_encode(array('status' => true, 'message'=>'', 'queryType' => 'lead', 'leadID' => $responseArr['leadID'], 'BookingType' => $responseArr['BookingType'], 'PkgType' => $responseArr['PkgType'], 'DestinationValue' => $responseArr['DestinationValue'], 'DestinationId' => $responseArr['DestinationId'], 'byopacktypeCat' => $responseArr['byopacktypeCat'], 'noofday' => $responseArr['noofday']));
} else {
echo json_encode(array('status' => false, 'message'=>$response, 'queryType' => 'lead'));
}
} catch (Exception $ex) {
echo $message = $ex->getMessage();
exit;
}
} else {
if($_POST['PlanType'] == 6){
try {
$apiData = [
'AgencySysId' => (int) ($_POST['AgencySysId']),
'AgentSysId' => (int) ($_POST['AgentSysId']),
'leadsend' => (int) ($_POST['leadsend']),
'PlanType' => (int) (isset($_POST['PlanType']) && $_POST['PlanType'] !='') ? $_POST['PlanType'] : 1,
'leadID' => (int) ($_POST['leadID']),
'multivisacountry' => sanitize_data($_POST['DestinationValue']),
'search_multi_visa' => sanitize_data($_POST['DestinationId']),
'email' => sanitize_data($_POST['Email']),
'phone' => sanitize_data($_POST['MobileNumber']),
'salutation' => 0,
'fname' => sanitize_data($_POST['FirstName']),
'visa_firstname' => sanitize_data($_POST['FirstName']),
'lname' => sanitize_data($_POST['LastName']),
'visa_lastname' => sanitize_data($_POST['LastName']),
'salution' => 0,
'visa_category' => '',
'visa_type' => '',
'visa_aplicants' => (int) ($_POST['NoofTraveler']),
'visa_travel_date' => sanitize_data($_POST['PKGCheckInDate']),
'visa_duration' => '',
'selectNationality' => (int)sanitize_data($_POST['FromDestinationId']),
'visa_pax_type' => '',
'visaInventoryId' => (int) ($_POST['packageSysId']),
'MPType' => 1,
'leadsource' => isset($_POST['leadsource'])?sanitize_data($_POST['leadsource']):'',
];
$curl = curl_init($baseUrl . "gtxwebservices/visa"); // b2c site url
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($apiData));
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
$response = curl_exec($curl);
// echo "<pre>";print_r($response);die('query');
curl_close($curl);
$responseArr = json_decode($response, 1);
echo json_encode(array('status' => true, 'queryType' => 'query','data'=>$responseArr));
} catch (Exception $ex) {
echo $message = $ex->getMessage();
exit;
}
}else if (isset($_POST['BookingType']) && $_POST['BookingType'] == 1 && isset($_POST['PkgType']) && $_POST['PkgType'] == 1) {
try {
$roominfojson = [];
$countRooms = (int) $_POST['room'];
for ($i = 0, $k = 1; $k <= $countRooms; $k++, $i++) {
$roominfojson[$k]['Adult'] = (int) $_POST['adult'][$i];
$roominfojson[$k]['Child'] = (int) $_POST['child'][$i];
$roominfojson[$k]['Infant'] = (int) $_POST['infant'][$i];
if ($_POST['adult'][$i] == 3) {
$roominfojson[$k]['bedtype'] = $_POST['adult_bed_type'][$i];
}
if ($_POST['child'][$i] > 0) {
for ($c = 1; $c <= $_POST['child'][$i]; $c++) {
$roominfojson[$k]['ChildBedType_' . $c] = $_POST['child' . $c . '_bed_type'][$i];
$roominfojson[$k]['ChildAge_' . $c] = '';
}
}
}
$PKGCheckInDate = explode('/', @$_POST['PKGCheckInDate']);
$PKGCheckInDate1 = $PKGCheckInDate[2] . '-' . $PKGCheckInDate[1] . '-' . $PKGCheckInDate[0];
$Noofdays = (int)$_POST['Noofdays'];
$PKGCheckOutDate = date('d/m/Y', strtotime($PKGCheckInDate1 . ' + ' . $Noofdays . ' days'));
$Destination = isset($_POST['Destination']) ? sanitize_data($_POST['Destination']) : '';
$FromDestinationId = isset($_POST['FromDestinationId'])?sanitize_data($_POST['FromDestinationId']):'';
if(trim($Destination) == ''){
$FromDestinationIdEx = explode('~~',$FromDestinationId);
$Destination = isset($FromDestinationIdEx[1]) ? trim($FromDestinationIdEx[1]) : '';
$FromDestinationId = (int)$FromDestinationIdEx[0];
}
//$roominfojson = array(1=>array('Adult'=>2,'Child'=>0,'Infant'=>0));
$apiData = [
'AgencySysId' => (int) ($_POST['AgencySysId']),
'AgentSysId' => (int) ($_POST['AgentSysId']),
'leadsend' => (int) ($_POST['leadsend']),
'PlanType' => (int) (isset($_POST['PlanType']) && $_POST['PlanType'] !='') ? $_POST['PlanType'] : 1,
'leadID' => (int) ($_POST['leadID']),
'BookingType' => (int) ($_POST['BookingType']),
'PkgType' => isset($_POST['PkgType'])?(int)$_POST['PkgType']:0,
'FirstName' => sanitize_data($_POST['FirstName']),
'LastName' => sanitize_data($_POST['LastName']),
'Email' => sanitize_data($_POST['Email']),
'CountryCode' => sanitize_data($_POST['CountryCode']),
'MobileNumber' => sanitize_data($_POST['MobileNumber']),
'TravelPlanId' => (int) sanitize_data($_POST['packageSysId']),
'PKGCheckInDate' => sanitize_data($_POST['PKGCheckInDate']),
'PKGCheckOutDate' => sanitize_data($PKGCheckOutDate),
'NoofTraveler' => (int) ($_POST['NoofTraveler']),
'Noofdays' => (int) ($_POST['Noofdays']),
'DestinationID' => isset($_POST['DestinationId'])?(int)$_POST['DestinationId']:0,
'Destination' => isset($_POST['DestinationValue'])?sanitize_data($_POST['DestinationValue']):'',
'FromDestination' => trim($Destination),
'FromDestinationId' => (int)$FromDestinationId,
'leadsource' => isset($_POST['leadsource'])?sanitize_data($_POST['leadsource']):'',
'Currency' => isset($_POST['Currency']) ? (int)($_POST['Currency']):'',
'pickupLocation' => '',
'PickupTime' => '',
'IsBusRoutePackage' => '',
'roomjson' => json_encode($roominfojson),
'emailsubject' => trim($_POST['FirstName']) . ' ' . trim($_POST['LastName']) . ' your proposal detail for ' . isset($_POST['DestinationValue'])?sanitize_data(trim($_POST['DestinationValue'])):''
];
if(trim($apiData['AgencySysId']) == 4995) {
$apiData["PMNS"] = "TYRYUEH";
}
//echo "<pre>";print_r($apiData);die('query');
//$curl = curl_init($baseUrl."gtxwebservices/lending-page-query"); // b2c site url
$curl = curl_init($baseUrl . "gtxwebservices/query-proposal"); // b2c site url
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($apiData));
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
$response = curl_exec($curl);
// echo "<pre>";print_r($response);die('query');
curl_close($curl);
$responseArr = json_decode($response, 1);
echo json_encode(array('status' => true, 'queryType' => 'query','data'=>$responseArr));
} catch (Exception $ex) {
echo $message = $ex->getMessage();
exit;
}
} else if (isset($_POST['BookingType']) && $_POST['BookingType'] == 1 && isset($_POST['PkgType']) && $_POST['PkgType'] == 2) {
try {
$roominfojson = [];
$countRooms = $_POST['room'];
for ($i = 0, $k = 1; $k <= $countRooms; $k++, $i++) {
$roominfojson[$k]['Adult'] = (int) $_POST['adult'][$i];
$roominfojson[$k]['Child'] = (int) $_POST['child'][$i];
$roominfojson[$k]['Infant'] = (int) $_POST['infant'][$i];
if ($_POST['adult'][$i] == 3) {
$roominfojson[$k]['bedtype'] = $_POST['adult_bed_type'][$i];
}
if ($_POST['child'][$i] > 0) {
for ($c = 1; $c <= $_POST['child'][$i]; $c++) {
$roominfojson[$k]['ChildBedType_' . $c] = $_POST['child' . $c . '_bed_type'][$i];
$roominfojson[$k]['ChildAge_' . $c] = '';
}
}
}
$PKGCheckInDate = explode('/', @$_POST['PKGCheckInDate']);
$PKGCheckInDate1 = $PKGCheckInDate[2] . '-' . $PKGCheckInDate[1] . '-' . $PKGCheckInDate[0];
$Noofdays = (int)$_POST['Noofdays'];
$PKGCheckOutDate = date('d/m/Y', strtotime($PKGCheckInDate1 . ' + ' . $Noofdays . ' days'));
$apiData = [];
$DestinationId = explode(',', $_POST['DestinationId']);
$DestinationValue = explode(',', $_POST['DestinationValue']);
$destinationArray = array();
foreach ($DestinationId as $ddKey => $ddVal) {
$destinationArray[$ddVal] = $DestinationValue[$ddKey];
}
$Destination = isset($_POST['Destination']) ? $_POST['Destination'] : '';
$apiData['packid'] = (int) ($_POST['packageSysId']);
$apiData['leadID'] = (int) ($_POST['leadID']);
$apiData['TravelPlanId'] = (int) ($_POST['packageSysId']);
$apiData['minpax'] = 2;
$apiData['catID'] = (int) ($_POST['byopacktypeCat']);
$apiData['tourID'] = 1;
$apiData['FirstName'] = sanitize_data($_POST['FirstName']);
$apiData['TotalNights'] = (int) $_POST['Noofdays'] - 1;
$apiData['DestinationPlaces'] = base64_encode(json_encode($destinationArray)); // 'eyI3NzAxIjoiRGVsaGkiLCIxMDU3NiI6IkdvYSJ9';
$apiData['search_going_to'] = $DestinationId[0] . '__' . sanitize_data($DestinationValue[0]); // '7701__Delhi';
$apiData['pkgCheckInDate'] = sanitize_data($_POST['PKGCheckInDate']);
$apiData['pkgCheckOutDate'] = sanitize_data($PKGCheckOutDate);
$apiData['tripstartdate'] = sanitize_data($_POST['PKGCheckInDate']);
$apiData['custemail'] = sanitize_data($_POST['Email']);
$apiData['custname'] = sanitize_data($_POST['FirstName'] . ' ' . $_POST['LastName']);
$apiData['custphone'] = sanitize_data($_POST['MobileNumber']);
$apiData['tripaddress'] = str_replace(',', ';', sanitize_data($Destination));
$apiData['aboutpackage'] = '';
$apiData['pricetype'] = 'wp';
$apiData['AgencySysId'] = (int) ($_POST['AgencySysId']);
$apiData['AgentSysId'] = (int) ($_POST['AgentSysId']);
$apiData['Email'] = sanitize_data($_POST['Email']);
$apiData['MobileNumber'] = sanitize_data($_POST['MobileNumber']);
$apiData['leadsource'] = isset($_POST['leadsource'])?sanitize_data($_POST['leadsource']):'';
$apiData['EmailTemplateType'] = 1;
$apiData['FromDestination'] = isset($_POST['Destination'])?sanitize_data($_POST['Destination']):'';
$apiData['FromDestinationId'] = isset($_POST['FromDestinationId'])?sanitize_data($_POST['FromDestinationId']):'';
$apiData['emailsubject'] = trim($_POST['FirstName']) . ' ' . trim($_POST['LastName']) . ' your proposal detail for ' . trim($_POST['DestinationValue']);
for ($k = 1; $k <= count($roominfojson); $k++) {
$roominfojson[$k]['departuredate'] = $_POST['PKGCheckInDate'];
$roominfojson[$k]['returndate'] = $_POST['PKGCheckInDate'];
}
$apiData['roomjson'] = json_encode($roominfojson);
$curl = curl_init($baseUrl . "gtxwebservices/dynamic-query"); // b2c site url
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($apiData));
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
$response = curl_exec($curl);
// echo "<pre>";print_r($response);die('query');
curl_close($curl);
$responseArr = json_decode($response, 1);
if ($responseArr['status'] == 'success') {
echo json_encode(array('status' => true, 'queryType' => 'query','data'=>$responseArr));
} else {
echo json_encode(array('status' => false, 'queryType' => 'query','data'=>$responseArr));
}
} catch (Exception $ex) {
echo $message = $ex->getMessage();
exit;
}
} else {
try {
$_POST['Noofdays'] = trim($_POST['Noofdays']);
// echo "<pre>";print_r($_POST);die('query');
//$curl = curl_init($baseUrl."gtxwebservices/lending-page-query"); // b2c site url
$curl = curl_init($baseUrl . "gtxwebservices/lead-update"); // b2c site url
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($_POST));
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
$response = curl_exec($curl);
// echo "<pre>";print_r($response);die('query');
curl_close($curl);
$responseArr = json_decode($response, 1);
if ($responseArr['status'] == 'success') {
echo json_encode(array('status' => true, 'message'=>$response, 'queryType' => 'query','data'=>$responseArr));
} else {
echo json_encode(array('status' => false, 'message'=>$response, 'queryType' => 'query','data'=>$responseArr));
}
} catch (Exception $ex) {
echo $message = $ex->getMessage();
exit;
}
}
}
}
function sanitize_data($input_data) {
$searchArr = array("document", "write", "alert", "%", "$", ";", "+", "|", "#", "<", ">", "\'");
$input_data = str_replace("script", "", $input_data);
$input_data = str_replace("iframe", "", $input_data);
$input_data = str_replace($searchArr, "", $input_data);
return htmlentities(stripslashes($input_data), ENT_QUOTES);
}
?>