| 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
class LandingPageController extends Zend_Controller_Action {
public function init() {
$aConfig = $this->getInvokeArg('bootstrap')->getOptions();
$this->deviceBasePath = $aConfig['deviceBasePath'];
$controller_name = Zend_Controller_Front::getInstance()->getRequest()->getControllerName();
$action_name = Zend_Controller_Front::getInstance()->getRequest()->getActionName();
$cms = new Application_Model_Cms();
$this->_helper->layout()->disableLayout();
}
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() {
$page_key = $this->getRequest()->getParam("page", null);
$bannerview = new Admin_Model_Bannerview();
$user = new Admin_Model_User();
if ($page_key) {
$page_key = $this->sanitize_data($page_key);
$LandingPageDataSet = $bannerview->getLandingPageDetail($page_key);
$leadingPageId = isset($LandingPageDataSet[0]['pageID']) ? $LandingPageDataSet[0]['pageID'] : null;
if (!empty($LandingPageDataSet) && ($leadingPageId)) {
$result = $bannerview->getBannerList($leadingPageId);
$this->view->totalrec = $result;
$whychooseusresult = $bannerview->getAllWhychooseusList($leadingPageId);
$this->view->whychooseusresult = $whychooseusresult;
require_once $this->deviceBasePath . 'library/Catabatic/MobileDetect.php';
$mobile_detect = new Catabatic_MobileDetect();
if ($mobile_detect->isMobile() == "mobile") {
$deviceType = "mobile";
} else if ($mobile_detect->isTablet() == "tablet") {
$deviceType = "mobile";
} else {
$deviceType = "desktop";
}
$session = new Zend_Session_Namespace('SecurePageKey');
$session->SecurePageKey = $leadingPageId;
$this->view->landingPageDataArray = $LandingPageDataSet;
$this->view->utm_source = $this->sanitize_data($this->getRequest()->getParam('utm_source', null));
$this->view->utm_medium = $this->sanitize_data($this->getRequest()->getParam('utm_medium', null));
$this->view->utm_campaign = $this->sanitize_data($this->getRequest()->getParam('utm_campaign', null));
$this->view->utm_term = $this->sanitize_data($this->getRequest()->getParam('utm_term', null));
$this->view->utm_content = $this->sanitize_data($this->getRequest()->getParam('utm_content', null));
$faqresult = $bannerview->getAllFaqList($leadingPageId);
$this->view->faqresult = $faqresult;
$depositrates = $bannerview->getAllDepositratesList($leadingPageId);
$this->view->depositrates = $depositrates;
$optsetting = $user->otpdata();
$this->view->optsetting = $optsetting;
$this->view->deviceType = $deviceType;
} else {
echo "asasdda";
exit;
}
}
}
public function randomString() {
$length = 6;
$chars = "0123456789";
$str = "";
for ($i = 0; $i < $length; $i++) {
$str .= $chars[mt_rand(0, strlen($chars) - 1)];
}
return $str;
}
public function generatecaptchaAction() {
$this->_helper->layout->disableLayout();
$this->_helper->viewRenderer->setNoRender();
$payrmno = '1234567890';
$captchaCode = (substr(str_shuffle($payrmno), 0, 4));
$session = new Zend_Session_Namespace('captcha');
$session->captchaCode = $captchaCode;
$captchaImage = imagecreatetruecolor(100, 40);
$backgroundColor = imagecolorallocate($captchaImage, 255, 255, 255);
imagefill($captchaImage, 0, 0, $backgroundColor);
$textColor = imagecolorallocate($captchaImage, 0, 0, 0);
imagestring($captchaImage, 5, 30, 12, $captchaCode, $textColor);
header('Content-Type: image/png');
imagepng($captchaImage);
imagedestroy($captchaImage);
}
public function sendotpinfoAction() {
if ($this->getRequest()->isPost()) {
$param = $this->getRequest()->getParams();
$pno = $param['phone'];
$OTP = $this->randomString();
$msgtxt = "$OTP is your One Time password (OTP) . Please use within 5 minutes and do not share this OTP with anyone. - DCB Bank LTD.";
$url = "https://axiomuat.dcbbank.com:8443/publisher/http6listener?dcode=DCBWEBSITE&subuid=DCBWEBSITE&pwd=WKqFxcuOKof/XfySCwjePQ==&ctype=1&alert=1&msgtype=S&sender=DCBANK&pno=$pno&msgtxt=" . urlencode($msgtxt);
////$url = "https://local.dcb.com/gtx.php";
try {
$lms = new Application_Model_Lms();
$currentData = date('Y-m-d H:i:s');
$date = new DateTime($currentData);
$date->add(new DateInterval('P0DT0H5M0S'));
//$newDate = date("Y-m-d H:i:s",strtotime($currentData." +5 minutes"));
$newDate = $date->format('Y-m-d H:i:s');
$ipadress = $_SERVER['REMOTE_ADDR'];
$numberofhitarray = $lms->getOtpvalidateDb($ipadress, $pno);
$totalcount = 1;
if (empty($numberofhitarray)) {
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
$outputH = curl_exec($ch);
curl_close($ch);
$insertArray = array(
'ip_address' => $ipadress,
'phone_no' => $pno,
'total_count' => $totalcount,
'otp' => md5($OTP),
'released_date' => $newDate,
'create_date' => date('Y-m-d H:i:s')
);
$lms->addData($insertArray, 'tbl_otp_validate');
$reply = array('status' => true, "c" => '', 'message' => "Your OTP has been sent.");
} else {
$numberofhit = $numberofhitarray[0]['total_count'];
if ($numberofhit > 4) {
$reply = array("status" => false, "c" => $numberofhit, "message" => "Your OTP limit is exceeded. Please try later.");
} else {
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
$outputH = curl_exec($ch);
curl_close($ch);
$updateay = array(
'total_count' => new Zend_Db_Expr("total_count + $totalcount"),
'otp' => md5($OTP),
'released_date' => $newDate,
'create_date' => date('Y-m-d H:i:s')
);
$where = array('ip_address =?' => $ipadress, 'phone_no =?' => $pno);
$lms->updateData($updateay, $where);
$reply = array('status' => true, "c" => '', 'message' => "Your OTP has been sent.");
}
}
} catch (Zend_Exception $error) {
$reply = array('status' => false, "c" => '', 'message' => $error->getMessage());
}
} else {
$reply = array('status' => false, 'message' => "");
}
echo Zend_Json::encode($reply);
exit;
}
public function thankYouAction() {
$this->view->returnPerameter = $this->getRequest()->getPost();
}
public function saveAndCheckDataAction() {
$returnArray = array("status" => false, "message" => "Please Post method");
if ($this->getRequest()->isPost()) {
$banner = new Admin_Model_Bannerview();
$user = new Admin_Model_User();
$optsetting = $user->otpdata();
$sessionSecurePageKey = new Zend_Session_Namespace('SecurePageKey');
$SecurePageKeyId = $sessionSecurePageKey->SecurePageKey;
$sessionCaptcha = new Zend_Session_Namespace('captcha');
$captchaCode = trim($sessionCaptcha->captchaCode);
try {
$page_id = $this->getRequest()->getPost('page_id', null);
$otp = $this->getRequest()->getPost('otp', null);
$captcha = trim($this->getRequest()->getPost('captcha', null));
$utm_source = $this->getRequest()->getPost('utm_source', null);
$utm_medium = $this->getRequest()->getPost('utm_medium', null);
$utm_campaign = $this->getRequest()->getPost('utm_campaign', null);
$utm_term = $this->getRequest()->getPost('utm_term', null);
$utm_content = $this->getRequest()->getPost('utm_content', null);
$first_name = trim($this->getRequest()->getPost('first_name', null));
$last_name = trim($this->getRequest()->getPost('last_name', null));
$email = trim($this->getRequest()->getPost('email', null));
$city_name = trim($this->getRequest()->getPost('city_name', null));
$mobilecountrycode = trim($this->getRequest()->getPost('mobilecountrycode', '+91'));
$mobile_no = trim($this->getRequest()->getPost('mobile_no', null));
$lms = new Application_Model_Lms();
$ipadress = $_SERVER['REMOTE_ADDR'];
$pno = $this->getRequest()->getParam('mobile_no', null);
if ($optsetting['isotpEnabled'] == 1) {
$numberofhitarray = $lms->getOtpvalidateDb($ipadress, $pno);
$numberofhit = isset($numberofhitarray[0]['total_count']) ? (int) $numberofhitarray[0]['total_count'] : 0;
$encyptedmd5 = isset($numberofhitarray[0]['otp']) ? trim($numberofhitarray[0]['otp']) : null;
$params_date = isset($numberofhitarray[0]['released_date']) ? $numberofhitarray[0]['released_date'] : null;
$currentDate = date("Y-m-d H:i:s");
}
$check = true;
if ($SecurePageKeyId != $page_id) {
$check = false;
$returnArray = array("status" => false, "message" => "something went wrong");
} else if (empty($first_name)) {
$check = false;
$returnArray = array("status" => false, "message" => "Please enter first name");
} else if (!ctype_alpha(str_replace(" ", "", $first_name))) {
$check = false;
$returnArray = array("status" => false, "message" => "First name should contain only alphabetic characters");
} else if (empty($last_name)) {
$check = false;
$returnArray = array("status" => false, "message" => "Please enter last name");
} else if (!ctype_alpha(str_replace(" ", "", $last_name))) {
$check = false;
$returnArray = array("status" => false, "message" => "Last name should contain only alphabetic characters");
} else if (empty($email)) {
$check = false;
$returnArray = array("status" => false, "message" => "Please enter email");
} else if (!preg_match("/^[_.0-9a-zA-Z-]+@([0-9a-zA-Z][0-9a-zA-Z-]+.)+[a-zA-Z]{2,6}$/i", $email)) {
$check = false;
$returnArray = array("status" => false, "message" => "Invalid email format");
} else if (empty($city_name)) {
$check = false;
$returnArray = array("status" => false, "message" => "Please enter city name");
} else if (empty($mobile_no)) {
$check = false;
$returnArray = array("status" => false, "message" => "Please enter mobile number");
} else if (!preg_match('/^\d{10}$/', $mobile_no)) {
$check = false;
$returnArray = array("status" => false, "message" => "Invalid mobile number format. Please enter a 10-digit number.");
} else if ($optsetting['isotpEnabled'] == 1) {
if (empty($otp)) {
$check = false;
$returnArray = array("status" => false, "message" => "Please enter OTP");
} else if (!$encyptedmd5) {
$check = false;
$returnArray = array("status" => false, "message" => "Please enter OTP.");
} else if ($encyptedmd5 != md5($otp)) {
$check = false;
$returnArray = array("status" => false, "message" => "Please check OTP.");
} else if ((!$params_date) || ($currentDate > $params_date)) {
$check = false;
$returnArray = array("status" => false, "message" => "Your OTP expired. Please try again");
} else if (($numberofhit > 5) || ($numberofhit == 0)) {
$check = false;
$returnArray = array("status" => false, "message" => "Your OTP limit is exceeded. Please try later.");
}
} else if (empty($captcha)) {
$check = false;
$returnArray = array("status" => false, "message" => "Please check CAPTCHA");
} else if (empty($captchaCode)) {
$check = false;
$returnArray = array("status" => false, "message" => "Please check CAPTCHA");
} else if ($captcha != $captchaCode) {
$check = false;
$returnArray = array("status" => false, "message" => "You entered an incorrect CAPTCHA. Please try again");
}
if ($check === true) {
$insertdata = array(
'first_name' => $this->sanitize_data($first_name),
'last_name' => $this->sanitize_data($last_name),
'email' => $this->sanitize_data($email),
'city_name' => $this->sanitize_data($city_name),
'landingpage_id' => $page_id,
'otp' => '',
'phone' => $this->sanitize_data($mobilecountrycode) . '-' . $this->sanitize_data($mobile_no),
'utm_source' => $this->sanitize_data($utm_source),
'utm_medium' => $this->sanitize_data($utm_medium),
'utm_campaign' => $this->sanitize_data($utm_campaign),
'utm_term' => $this->sanitize_data($utm_term),
'utm_content' => $this->sanitize_data($utm_content),
'createdOn' => date('Y-m-d H:i:s')
);
$banner->adddata($insertdata);
unset($sessionCaptcha->captchaCode);
$ipadress = $_SERVER['REMOTE_ADDR'];
if ($optsetting['isotpEnabled'] == 1) {
$lms->deleteOtpvalidateDb($ipadress, $mobile_no);
}
$returnArray = array("status" => true, "message" => "Lead saved.");
}
} catch (Zend_Eeception $error) {
$returnArray = array("status" => false, "message" => $error->getMessage());
}
}
echo json_encode($returnArray);
exit;
}
}