| 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/b2c.hellogtx.com/library/Catabatic/ |
Upload File : |
<?php
class Catabatic_ValidateCustomer extends Zend_Controller_Action {
public $requestedId;
public $checkCode;
public $checkId;
public $finalCode;
public $input_data;
private $secureCode = "SECURE";
private $key = "GTX";
public $amount;
public $userID;
private $ENC_KEY = "tripsbanklockkey";
private $VECTOR = "myvector";
public function init() {
$this->_user = new Zend_Session_Namespace('User');
$this->customerprofileAPIUrl = API_CUSTOMER_PROFILE;
$param = $this->getRequest()->getParams();
if (isset($param['token']) && !empty($param['token']) && ($param['action'] != 'checkresetlink')) {
$REQUEST_URI = $_SERVER['REQUEST_URI'];
$REQUEST_URIE = explode('token',$REQUEST_URI);
$REQUEST_URIED = rtrim($REQUEST_URIE[0],'&');
$REQUEST_URIED = rtrim($REQUEST_URIED,'?');
//echo "<pre>";print_r($REQUEST_URIED);die;
// $click = '';
// if(isset($param['click']) && !empty($param['click'])){
// $click = '?click='.$param['click'];
// }
if(isset($this->_user->session['CustomerSysId']) && !empty($this->_user->session['CustomerSysId'])){
$this->_redirect($REQUEST_URIED); exit;
}
$tokenDec = Catabatic_ValidateCustomer::getDecDession(base64_decode($param['token']), SECURITYKEY);
$tokenDecDecode = json_decode($tokenDec, 1);
if (SECURITYKEY == $tokenDecDecode['SecurityKey']) {
$apiData = array(
'AgencySysId' => $tokenDecDecode['AgencySysId'],
'CustomerSysId' => $tokenDecDecode['UserSysId'],
);
try {
$curl_p = curl_init($this->customerprofileAPIUrl);
curl_setopt($curl_p, CURLOPT_POST, true);
curl_setopt($curl_p, CURLOPT_POSTFIELDS, http_build_query($apiData));
curl_setopt($curl_p, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl_p, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($curl_p, CURLOPT_TIMEOUT, 300);
$response_pro = curl_exec($curl_p);
// echo "<pre>";print_r($response_pro);die;
curl_close($curl_p);
} catch (Exception $error) {
$this->view->error_msg = $error->getMessage();
die;
}
$response_decode = json_decode($response_pro, 1);
if($response_decode['status'] == 1){
$WalletStatus = array(
'WalletStatus' => $response_decode['Wallet']['WalletStatus'],
'WalletBalance' => $response_decode['Wallet']['WalletBalance'],
);
$data = [
'EmailId' => $response_decode['profile']['EmailId'],
'CustomerSysId' => $response_decode['profile']['CustomerSysId'],
'AgencySysId' => $response_decode['profile']['AgencySysId'],
'FirstName' => $response_decode['profile']['FirstName'],
'LastName' => $response_decode['profile']['LastName'],
'Password_cu' => $response_decode['profile']['Password'],
'ContactNo1' => $response_decode['profile']['Contacts'],
];
$this->_user->session = $data;
$this->_user->wallet = $WalletStatus;
$this->_redirect($REQUEST_URIED); exit;
}else{
$this->_redirect('customer/account');
}
}else{
$this->_redirect('customer/account');
}
}
}
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);
}
public function GUID() {
if (function_exists('com_create_guid') === true) {
return trim(com_create_guid(), '{}');
}
return sprintf('%04X%04X%04X%04X%04X%04X%04X%04X', mt_rand(0, 65535), mt_rand(0, 65535), mt_rand(0, 65535), mt_rand(16384, 20479), mt_rand(32768, 49151), mt_rand(0, 65535), mt_rand(0, 65535), mt_rand(0, 65535));
}
public function secureCode($id, $guid) {
$requestedId = $this->sanitize_data($id);
$checkCode = $this->sanitize_data($guid);
$finalCode = $checkCode . $this->secureCode . $requestedId;
$checkId = hash('sha256', "GTX-$finalCode");
return $checkId;
}
public function walletCode($id, $guid, $amount, $userID, $planID, $BaseAmount, $StAMOUNT) {
$requestedId = $this->sanitize_data($id);
$checkCode = $this->sanitize_data($guid);
$amount = $this->sanitize_data($amount);
$planID = $this->sanitize_data($planID);
$userID = $this->sanitize_data($userID);
$BaseAmount = $this->sanitize_data(trim($BaseAmount));
$StAMOUNT = $this->sanitize_data(trim($StAMOUNT));
$finalCode = $checkCode . $this->secureCode . $requestedId . $this->secureCode . 'AMOUNT' . $amount . $this->secureCode . 'USERID' . $userID . $this->secureCode . 'PLANID' . $planID . $BaseAmount . $StAMOUNT;
$checkId = hash('sha256', "$this->key-$finalCode");
return $checkId;
}
public function getDec($input) {
$filter = new Zend_Filter_Decrypt(array('adapter' => 'mcrypt', 'key' => $this->ENC_KEY));
$filter->setVector($this->VECTOR);
$decoded = pack('H*', $input);
$decrypted = trim($filter->filter($decoded));
return $decrypted;
}
public function getEnc($input) {
$filter = new Zend_Filter_Encrypt(array('adapter' => 'mcrypt', 'key' => $this->ENC_KEY));
$filter->setVector($this->VECTOR);
$encrypted = $filter->filter($input);
$encrypted = bin2hex($encrypted); //hints: rawurlencode(..) works
return $encrypted;
}
public function writeLogEmail($data) {
$fileName = date("Y-m-d") . "_email.txt";
$fp = fopen("data/" . $fileName, 'a+');
$data = date("Y-m-d H:i:s") . " - " . $data;
fwrite($fp, $data);
fclose($fp);
}
public function mailSentByElastice($emailData,$arrEmailStatistics = array()) {
$url = 'https://api.elasticemail.com/v2/email/send';
$to = implode(";",$emailData['to']);
try {
$post = array('from' => $emailData['fromEmail'],
'fromName' => $emailData['fromName'],
'apikey' => '6e1092b5-f6b4-4011-8f25-19870fb945fb',
'subject' => $emailData['subject'],
'to' => $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);
if(count($arrEmailStatistics) > 0){
$mailResponse = json_decode($result,1);
$arrEmailStatistics['Title'] = $emailData['subject'];
if($mailResponse['success']){
$arrEmailStatistics['Status'] = $mailResponse['success'];
$arrEmailStatistics['RefSysId'] = isset($mailResponse['data']['transactionid'])?$mailResponse['data']['transactionid']:'';
}
$objAgency = new Travel_Model_TblAgency();
$objAgency->insertData("TB_Agency_Sent_Sms_Email", $arrEmailStatistics);
}
} catch (Exception $ex) {
$result = $ex->getMessage();
}
return $result;
}
/* By Md sabir */
public function mailSentByElasticeEnquirySupplier($emailData,$arrEmailStatistics = array()) {
$url = 'https://api.elasticemail.com/v2/email/send';
$to = implode(";",$emailData['to']);
//print_r($to); die('eee');
try {
$post = array('from' => $emailData['fromEmail'],
'fromName' => $emailData['fromName'],
'apikey' => '6e1092b5-f6b4-4011-8f25-19870fb945fb',
'subject' => $emailData['subject'],
'to' => $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;
}
public function mailSentByElasticeWithAttachement($emailData) {
$url = 'https://api.elasticemail.com/v2/email/send';
$filename = $emailData['fileName'];
$file_name_with_full_path = realpath($emailData['filePath'].$filename);
$filetype = "text/plain";
try {
$post = array('from' => $emailData['fromEmail'],
'fromName' => $emailData['fromName'],
'apikey' => '6e1092b5-f6b4-4011-8f25-19870fb945fb',
'subject' => $emailData['subject'],
'to' => $emailData['to'][0],
'bodyHtml' => $emailData['bodyHtml'],
'bodyText' => $emailData['bodyText'],
'isTransactional' => false,
'file_1' => new CurlFile($file_name_with_full_path, $filetype, $filename));
$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;
}
public function getDecGTX($input,$SecurityKey) {
$inputKey = $SecurityKey;
$iv = substr($SecurityKey, 0, 16);
$blockSize = 256;
$aes = new Travel_Model_Encrytion($input, $inputKey, $iv, $blockSize);
return $enc = $aes->decrypt();
}
public function getEncGTX($input,$SecurityKey) {
$inputKey = $SecurityKey;
$iv = substr($SecurityKey, 0, 16);
$blockSize = 256;
$aes = new Travel_Model_Encrytion($input, $inputKey, $iv, $blockSize);
return $enc = $aes->encrypt();
}
public function getDecDession($input,$SecurityKey) {
$inputKey = substr($SecurityKey, 0, 32);
$iv = substr($SecurityKey, 0, 16);
$blockSize = 256;
$aes = new Travel_Model_Encrytion($input, $inputKey, $iv, $blockSize);
return $enc = $aes->decrypt();
}
}