403Webshell
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 :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/html/b2bzend/savefeedback.php
<?php
// $baseUrl = 'http://local.b2bzend.com/';
//$baseUrl = 'http://st.tb.tripsbank.com/';
$baseUrl = 'https://globaltravelexchange.com/';
require_once 'cronjob/init.php';
//error_reporting(E_ALL);
$TblAgency = new Travel_Model_TblAgency();
$crmcustomerObj = new Travel_Model_CRM_Customer();
$crmagencyleadaccountObj = new Travel_Model_CRM_AgencyLeadAccount();
$agencycustomerObj = new Travel_Model_CRM_AgencyCustomer();
$resultArr = array();
if ($_POST) {

    if (isset($_POST['formType']) && $_POST['formType'] == 1) {

        $TripImageName = (isset($_POST['TripImageName']) && !empty($_POST['TripImageName'])) ? implode(',', $_POST['TripImageName']) : '';
        $firstName = (isset($_POST['FirstName']) && $_POST['FirstName'] != '') ? $_POST['FirstName'] : '';
        $LastName = (isset($_POST['LastName']) && $_POST['LastName'] != '') ? $_POST['LastName'] : '';
        $EmailId = isset($_POST['EmailId']) ? $_POST['EmailId'] : '';
        $MobileNo = isset($_POST['MobileNo']) ? $_POST['MobileNo'] : '';
        $AgencySysId = (int) $_POST['AgencySysId'];
        $updatedate = date('Y- m-d H:i');
        $Birthday = (isset($_POST['Birthday']) && trim($_POST['Birthday']) != '') ? DateTime::createFromFormat('d/m/Y', $_POST['Birthday']) : '';
        $BirthdayDate = ($Birthday != '') ? $Birthday->format('Y-m-d') : '';
        $Anniversary = (isset($_POST['Anniversary']) && trim($_POST['Anniversary']) != '') ? DateTime::createFromFormat('d/m/Y', $_POST['Anniversary']) : '';
        $AnniversaryDate = ($Anniversary != '') ? $Anniversary->format('Y-m-d') : '';
        $CountryCode = isset($_POST['CountryCode']) ? $_POST['CountryCode'] : '+91';
        $Salutation = isset($_POST['Salutation']) ? (int)$_POST['Salutation'] : 1;
        $TravelMonth = isset($_POST['TravelMonth']) ? $_POST['TravelMonth'] : '';
        $ReviewStarValue = isset($_POST['ReviewStarValue']) ? (int) $_POST['ReviewStarValue'] : 0;
        $UserDataByAgency = $TblAgency->getUserDataByAgency($AgencySysId);
        $agencyPrimaryEmail  = $UserDataByAgency['PrimaryEmail'];
        $PrimaryAgencyName  = $UserDataByAgency['PrimaryContactName'];
        $agencyTitle  = $UserDataByAgency['Title'];
        $EmailKey  = $UserDataByAgency['EmailKey'];
        //echo "<pre>";print_r($UserDataByAgency);die;
        $saveData = [
            'AgencySysId' => $AgencySysId,
            'CRSStatus' => (int) $_POST['crs'],
            'AgentSysId' => (int) $_POST['AgentSysId'],
            'Salutation' => (int) $_POST['Salutation'],
            'Name' => $firstName . ' ' . $LastName,
            'EmailId' => $EmailId,
            'CountryCode' => isset($_POST['CountryCode']) ? $_POST['CountryCode'] : '+91',
            'MobileNo' => $MobileNo,
            'Destination' => isset($_POST['Destination']) ? $_POST['Destination'] : '',
            'DestinationId' => isset($_POST['DestinationId']) ? (int) $_POST['DestinationId'] : 0,
            'TravelMonth' => isset($_POST['TravelMonth']) ? $_POST['TravelMonth'] : '',
            'Birthday' => $BirthdayDate,
            'Anniversary' => $AnniversaryDate,
            'ReviewStarValue' => isset($_POST['ReviewStarValue']) ? (int) $_POST['ReviewStarValue'] : 0,
            'ReviewTitle' => isset($_POST['ReviewTitle']) ? $_POST['ReviewTitle'] : '',
            'Review' => isset($_POST['Review']) ? $_POST['Review'] : '',
            'TripImage' => $TripImageName,
            'isActive' => 1,
            'isMarkForDel' => 0
        ];
        //echo "<pre>";print_r($saveData);die;
        $TblAgency->insertData('TB_Agency_Feedback', $saveData);
        if (isset($EmailId) && !empty($EmailId)) {
            try {
                $customerDetailsEmail = $crmcustomerObj->ChkEmailWithResponseUpdate($EmailId, $AgencySysId);
                // if (is_array($customerDetailsEmail)) {
                $CustomerSysId = isset($customerDetailsEmail['CustomerSysId']) ? (int) $customerDetailsEmail['CustomerSysId'] : 0;
                if ($CustomerSysId == 0) {
                    $userArray = array(
                        'EmailId' => $EmailId,
                        'Salutation' => $Salutation ? $Salutation : 1,
                        'PrimaryContactNumber' => $MobileNo ? $MobileNo : '',
                        'FullName' => $firstName . ' ' . $LastName,
                        'FirstName' => $firstName,
                        'LastName' => $LastName ? $LastName : '',
                        'ActiveDate' => $updatedate,
                        'UpdatedDate' => $updatedate,
                        'CreatedDate' => $updatedate,
                        'countrycode' => $CountryCode,
                        'IsApproved' => '1',
                        'IsActive' => '1',
                        'IsMarkForDelete' => '0'
                    );
                    $CRMCustSysId = $crmcustomerObj->addCustomer($userArray);
                    $agencyuserArray = array(
                        'AgencySysId' => $AgencySysId,
                        'AgencyCRMLeadSysId' => 1,
                        'CRMCustSysId' => $CRMCustSysId,
                        'EmailId' => $EmailId,
                        'Title' => $Salutation ? $Salutation : 1,
                        'Logo' => '',
                        'IsfromSM' => '0',
                        'UserId' => '0',
                        'CitySysId' => '',
                        'StateOrZoneSysId' => 0,
                        'CountrySysId' => '',
                        'IsEmployee' => '0',
                        'Contacts' => $MobileNo ? $MobileNo : '',
                        'countrycode' => $CountryCode,
                        'JoinDate' => $updatedate,
                        'UserName' => $firstName . '' . $LastName,
                        'FirstName' => $firstName ? $firstName : '',
                        'LastName' => $LastName ? $LastName : '',
                        'Relation' => '',
                        'PassportNo' => '',
                        'PassportExpiry' => '',
                        'DOB' => $BirthdayDate,
                        'MarriageAnniversary' => $AnniversaryDate,
                        'CreatedByUserSysId' => '',
                        'RegisterDate' => $updatedate,
                        'UpdateDate' => $updatedate,
                        'IsApproved' => '0',
                        'IsActive' => '1',
                        'IsMarkForDelete' => '0'
                    );
                    ### Insert Record in to Agency Table as well ########
                    $CustomerSysId = $agencycustomerObj->addAgencyCustomer($agencyuserArray);
                } else {
                    if ((int) $CustomerSysId > 0) {
                        $updateData = array();
                        if (isset($BirthdayDate) && !empty($BirthdayDate)) {
                            $updateData['DOB'] = $BirthdayDate;
                        }
                        if (isset($AnniversaryDate) && !empty($AnniversaryDate)) {
                            $updateData['MarriageAnniversary'] = $AnniversaryDate;
                            $updateData['IsMarried'] = true;
                        }
                        $where = "CustomerSysId = " . $CustomerSysId . " AND AgencySysId = " . $AgencySysId;

                        $agencycustomerObj->UpdateAgencyCustomer($updateData, $where);
                    }
                }
                //  }
            } catch (Zend_Exception $e) {
                $error_Message = $e->getMessage();
                $resultArr = array('status' => false, 'total' => 0, 'message' => $error_Message);
            }
        }

        $subjectCust = 'QUERY ALERT - helloGTX - Feedback Form';
        $customerBodyText = '<table width="80%" border="0" align="center" cellpadding="0" cellspacing="0" style=" border: dashed 1px #ccc; font-size:14px; font-family: Roboto, sans-serif;">
                
                <tr>
                  <td colspan="2" style=" padding:5px 40px;vertical-align: middle;">Dear ' . $PrimaryAgencyName . ', <br>
                    <br>
                   Hurray! 
                    <br> <br>
                   You got a new query to plan a vacation for your client via feedback form.
                 <br> <br>
                 </td></tr>
					<tr>
                      <td width="28%" style=" padding:5px 40px;vertical-align: middle;">Customer Name: </td>
                      <td width="72%" style=" padding:5px 40px;vertical-align: middle;">' . $firstName . ' ' . $LastName . '</td>
                    </tr>
					<tr>
                      <td width="28%" style=" padding:5px 40px;vertical-align: middle;">Mobile No: </td>
                      <td width="72%" style=" padding:5px 40px;vertical-align: middle;">' . $CountryCode . ' ' . $MobileNo . '</td>
                    </tr>
					<tr>
                      <td width="28%" style=" padding:5px 40px;vertical-align: middle;">Email ID:</td>
                      <td width="72%" style=" padding:5px 40px;vertical-align: middle;">' . $EmailId . '</td>
                    </tr>
					<tr>
                      <td width="28%" style=" padding:5px 40px;vertical-align: middle;">Travel Month: </td>
                      <td width="72%" style=" padding:5px 40px;vertical-align: middle;">' . $TravelMonth . '</td>
                    </tr>
					<tr>
                      <td width="28%" style=" padding:5px 40px;vertical-align: middle;">star :</td>
                      <td width="72%" style=" padding:5px 40px;vertical-align: middle;">' . $ReviewStarValue . ' Star</td>
                    </tr>
					
					<tr>
                      <td colspan="2" style=" padding:5px 40px;vertical-align: middle;"><a href="https://globaltravelexchange.com/">Click Here</a> to login to helloGTX and grab the deal ! </td>
                    </tr>
					<tr>
                      <td colspan="2" style=" padding:5px 40px;vertical-align: middle;">&nbsp; </td>
                    </tr>
					<tr>
                      <td colspan="2" style=" padding:5px 40px;vertical-align: middle;">Cheers </td>
                    </tr>
					<tr>
                      <td colspan="2" style=" padding:5px 40px;vertical-align: middle;">Team helloGTX </td>
                    </tr>
                   
              </table>
              ';

        $emailMasterDataCust = array('fromEmail' => trim($agencyPrimaryEmail), 'fromName' => trim($agencyTitle), 'subject' => $subjectCust, 'to' => trim($agencyPrimaryEmail), 'bodyHtml' => $customerBodyText, 'bodyText' => '');
        $arrEmailStatistics['EmailKey'] = $EmailKey;
        $checkStatusEmailCust = mailSentByElastice($emailMasterDataCust,  $arrEmailStatistics);
        // echo "<pre>";print_r($checkStatusEmailCust);die;


        $resultArr = array('status' => true);
    } else {

        if (isset($_FILES) && !empty($_FILES)) {
            $fileNameArray = array();
            $AgencySysId = $_POST['AgencySysId'];
            //echo "<pre>";print_r($_FILES);die;
            foreach ($_FILES['TripImage']['name'] as $key => $orignalFIleName) {
                if (!empty($orignalFIleName)) {
                    //$orignalFolderName = $_SERVER["DOCUMENT_ROOT"] . "/public/upload/feedback/image/" . $AgencySysId . "/";
                    $orignalFIleName1 = explode(".", $orignalFIleName);
                    $fileExt = end($orignalFIleName1);
                    $fileName = 'feedback__' . $key . '_' . time() . '.' . $fileExt;
                    if ($fileExt == 'pdf' || $fileExt == 'jpg' || $fileExt == 'jpeg' || $fileExt == 'png') {
                        $temp_file_name = $_FILES['TripImage']["tmp_name"][$key]; // temprary file name
                        
                        $image_path = 'img/'.$AgencySysId.'/feedback/image';
                        $DetailImg = IMAGE_PATH_URL_AWS . $image_path . '/' . $fileName;
                        $file1 = array(
                            'name'=>$_FILES['TripImage']["name"][$key],
                            'type'=>$_FILES['TripImage']["type"][$key],
                            'tmp_name'=>$_FILES['TripImage']["tmp_name"][$key],
                            'error'=>$_FILES['TripImage']["error"][$key],
                            'size'=>$_FILES['TripImage']["size"][$key],
                        );
                        $data = array(
                            'AgencySysId' =>  $AgencySysId,
                            'image_path' =>  $image_path,
                            'tags' =>  'feedback',
                            'title' =>  $fileName,
                            'FILES' =>  $file1,
                            'fileName' =>  $fileName,
                        );
                        $toupload = uploadToAWS($data);
                        
//                        if (move_uploaded_file($temp_file_name, $orignalFolderName . "/" . $fileName)) {
                        if ($toupload['status'] == true) {
                            $fileNameArray[] = $fileName;
                        }
                    }
                }
            }
            $resultArr = array('status' => true, 'fileNameArray' => $fileNameArray, 'total' => count($fileNameArray));
        } else {
            $resultArr = array('status' => false, 'total' => 0);
        }
    }
    echo json_encode($resultArr);
    exit;
}
function mailSentByElastice($emailData, $arrEmailStatistics = array())
{
    $url = 'https://api.elasticemail.com/v2/email/send';

    $to = $emailData['to'];
    $apiKey = isset($arrEmailStatistics['EmailKey']) ? trim($arrEmailStatistics['EmailKey']) : '';

    if (isset($apiKey) && $apiKey != "") {
        $emailSenderKey = $apiKey;
    } else {
        $emailSenderKey = 'dde45a5a-957d-4b94-9bd5-d41431d1a550';
    }
    try {

        $post = array(
            'from' => $emailData['fromEmail'],
            'fromName' => $emailData['fromName'],
            'apikey' => $emailSenderKey,
            'subject' => $emailData['subject'],
            'to' => $emailData['to'],
            'bodyHtml' => $emailData['bodyHtml'],
            //'bodyText' => $emailData['bodyText'],
            'isTransactional' => false
        );

        $ch = curl_init();
        curl_setopt_array($ch, array(
            CURLOPT_URL => $url,
            CURLOPT_POST => true,
            CURLOPT_POSTFIELDS => $post,
            CURLOPT_RETURNTRANSFER => true,
            CURLOPT_HEADER => false,
            CURLOPT_SSL_VERIFYPEER => false
        ));

        $result = curl_exec($ch);

        curl_close($ch);
    } catch (Exception $ex) {

        $result = $ex->getMessage();
    }

    return $result;
}

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);
}
function uploadToAWS($data){
    $FILES = $data['FILES'];
    $AgencySysId = $data['AgencySysId'];
    $image_path = $data['image_path'];
    $tags = $data['tags'];
    $title = $data['title'];
    $fileName = $data['fileName'];

    $apiData['agency_name'] = $image_path;
    $apiData['agency_id'] = $AgencySysId;
    $apiData['alt_tags'] = $tags;
    $apiData['title'] = $title;
    $cfile = new CURLFile($FILES['tmp_name'], $FILES['type'], $fileName);
    $apiData['document'] = $cfile;
    $curl = curl_init();
    curl_setopt_array($curl, array(
      CURLOPT_URL => IMAGE_API_URL_HELLOGTX,
      CURLOPT_RETURNTRANSFER => true,
      CURLOPT_ENCODING => "",
      CURLOPT_MAXREDIRS => 10,
      CURLOPT_TIMEOUT => 30,
      CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
      CURLOPT_CUSTOMREQUEST => "POST",
      CURLOPT_POSTFIELDS => $apiData,
      CURLOPT_HTTPHEADER => array(
        "cache-control: no-cache",
        "content-type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW",
        "gtxkey: DFRT5634@GHUYPO123458910RTY",
        "postman-token: 05105a87-092d-74ea-3173-e9e167160b99"
      ),
    ));

    $response = curl_exec($curl);

    $err = curl_error($curl);
    curl_close($curl);

    if ($err) {
        return array('status' => false,'message' => "cURL Error #:" . $err);
    } else {
        return (!empty($response)) ? json_decode($response,1) : '';
    }
}

Youez - 2016 - github.com/yon3zu
LinuXploit