| 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/dcb/application/controllers/ |
Upload File : |
<?php
/* * *************************************************************
* Catabatic Technology Pvt. Ltd.
* File Name :LmsController.php
* File Description :Lms controller for manage all lms pages
* Created By : Praveen Kumar
* Created Date: 18-November-2014
* ************************************************************* */
class WebservicesController extends Zend_Controller_Action
{
public function init()
{
$aConfig = $this->getInvokeArg('bootstrap')->getOptions();
$this->deviceBasePath = $aConfig['deviceBasePath'];
require_once $this->deviceBasePath . 'library/Catabatic/MobileDetect.php';
$this->mobile_detect = new Catabatic_MobileDetect();
}
public function sanitize_data($input_data)
{
$searchArr = array("document", "write", "alert", "%", "$", ";", "+", "|", "#", "<", ">", ")", "(", "'", "\'", ",", "JAVASCRIPT");
$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 indexAction()
{
$lms = new Application_Model_Lms();
$json = file_get_contents('php://input');
$getData2 = json_decode($json, true);
if (!empty($getData2)) {
if ($this->mobile_detect->isMobile() == "mobile") {
$deviceType = "mobile";
} else if ($this->mobile_detect->isTablet() == "tablet") {
$deviceType = "mobile";
} else {
$deviceType = "desktop";
}
$message = '';
$isStatus = true;
$requestData = isset($getData2['request']) ? $getData2['request'] : '';
if ($requestData != '') {
$jsonData = $this->checkDecyptAction($requestData);
$getData = json_decode($jsonData, true);
if (is_array($getData) && !empty($getData)) {
$firstName = isset($getData['FirstName']) ? $this->sanitize_data(trim($getData['FirstName'])) : '';
if (empty($firstName)) {
$message = "Plese enter Name";
$isStatus = false;
} else if (!preg_match("/^[a-zA-Z ]*$/", $firstName)) {
$message = "Only letters!";
$isStatus = false;
}
$email = isset($getData['Email']) ? $this->sanitize_data(trim($getData['Email'])) : '';
if (empty($email)) {
$message = "Plese enter email";
$isStatus = false;
} else if (!preg_match("/^[_.0-9a-zA-Z-]+@([0-9a-zA-Z][0-9a-zA-Z-]+.)+[a-zA-Z]{2,6}$/i", $email)) {
$message = "not valid email !";
$isStatus = false;
}
$city = isset($getData['City']) ? $this->sanitize_data(trim($getData['City'])) : '';
if (empty($city)) {
$message = "Plese enter city";
$isStatus = false;
} else if (!preg_match("/^[a-zA-Z ]*$/", $city)) {
$message = "Only letters !";
$isStatus = false;
}
$pincode = isset($getData['PinCode']) ? $this->sanitize_data(trim($getData['PinCode'])) : '';
if (empty($pincode)) {
$message = "Plese enter Pincode";
$isStatus = false;
} else if (!is_numeric($pincode)) {
$message = "Numbers only !";
$isStatus = false;
}
$MobileNo = isset($getData['MobileNo']) ? $this->sanitize_data(trim($getData['MobileNo'])) : '';
if (empty($MobileNo)) {
$message = "Plese enter mobile Number";
$isStatus = false;
} else if (!is_numeric($MobileNo)) {
$message = "Numbers only !";
$isStatus = false;
}
$CustomerId = isset($getData['CustomerId']) ? $this->sanitize_data(trim($getData['CustomerId'])) : '';
$Source = isset($getData['Source']) ? $this->sanitize_data(trim($getData['Source'])) : '';
$Category = isset($getData['Category']) ? $this->sanitize_data(trim($getData['Category'])) : '';
$SubCategory = isset($getData['SubCategory']) ? $this->sanitize_data(trim($getData['SubCategory'])) : '';
if ($isStatus == true) {
$dataArray = array(
'application_type' => $deviceType,
'lms_type' => $Source,
'title' => '',
'first_name' => $firstName,
'last_name' => '',
'email' => $email,
'city_name' => $city,
'address' => '',
'country' => 0,
'state_id' => 0,
'city_id' => 0,
'pin_code' => $pincode,
'country_code' => '',
'area_code' => '',
'landline_no' => '',
'mobile_no' => $MobileNo,
'account_no' => 0,
'complaint_detail' => $this->sanitize_data($getData['Comment']),
'status' => 'Deactive',
'customer_id' => $CustomerId,
'complaint_type' => $Category,
'complaint_sub_type' => $SubCategory,
'createdOn' => date("Y-m-d H:i:s")
);
try {
$lms->add($dataArray);
$responseSET = array("status" => true, "message" => 'Your information has been successfully saved');
} catch (Zend_Exception $e) {
$responseSET = array("status" => false, "message" => $e->getMessage());
}
} else {
$responseSET = array("status" => $isStatus, "message" => $message);
}
} else {
$responseSET = array("status" => false, "message" => 'Please pass value in json formate');
}
} else {
$responseSET = array("status" => false, "message" => 'Please check request value');
}
} else {
$responseSET = array("status" => false, "message" => 'Please use the post method');
}
echo json_encode($responseSET);
exit;
}
public function checkEncyptAction($data_string)
{
$data = $data_string;
$inputKey = 'DCBcasa@11061987DCBcasa@11061987';
$blockSize = 256;
$iv = "hgsdf6534632#$$5";
$aes = new Application_Model_Encrytion($data, $inputKey, $iv, $blockSize);
return $enc = $aes->encrypt();
}
public function checkDecyptAction($decyptCode)
{
$data = $decyptCode;
$inputKey = 'DCBcasa@11061987DCBcasa@11061987';
$blockSize = 256;
$iv = "hgsdf6534632#$$5";
$aes = new Application_Model_Encrytion($data, $inputKey, $iv, $blockSize);
return $enc = $aes->decrypt();
}
public function checkDataAction()
{
if ($this->getRequest()->isPost()) {
$getData = $this->getRequest()->getPost();
$data_string = json_encode($getData);
$jsonData['request'] = $this->checkEncyptAction($data_string);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://www.dcbbank.com/webservices/index");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $jsonData);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
$output = curl_exec($ch);
echo "<pre>";
print_r($output);
exit;
curl_close($ch);
}
}
}