| 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 :IndexController.php
* File Description :Index controller for manage home page
* Created By : Praveen Kumar
* Created Date: 10-September-2014
* ************************************************************* */
class CampaignsController 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 indexAction() {
$this->_helper->layout()->disableLayout();
$this->_helper->layout->setLayout('campaigns');
$form = new Application_Form_Campaigns();
$getParams = $this->getRequest()->getParams();
if ($this->mobile_detect->isMobile() == "mobile") {
$deviceType = "mobile";
} else if ($this->mobile_detect->isTablet() == "tablet") {
$deviceType = "mobile";
} else {
$deviceType = "desktop";
}
$url_ip_address = isset($_SERVER['REMOTE_ADDR'])?$_SERVER['REMOTE_ADDR']:'';
$populateArray = array(
"utm_source" => isset($getParams['utm_source'])?$this->sanitize_data($getParams['utm_source']):'',
"utm_medium" => isset($getParams['utm_medium'])?$this->sanitize_data($getParams['utm_medium']):'',
"utm_campaign" => isset($getParams['utm_campaign'])?$this->sanitize_data($getParams['utm_campaign']):'',
"utm_term" => isset($getParams['utm_term'])?$this->sanitize_data($getParams['utm_term']):'',
"utm_content" => isset($getParams['utm_content'])?$this->sanitize_data($getParams['utm_content']):'',
"country_name" => "India"
);
$form->setMethod("POST");
$form->setAction("campaigns/index");
$form->setName("campaigns");
$form->populate($populateArray);
$this->view->form = $form;
if ($this->getRequest()->isPost()) {
$getData = $this->getRequest()->getPost();
if ($form->isValid($getData)) {
$dataArray = array(
'salutation' => "",
'FName' => $this->sanitize_data($getData['fname']),
'LName' => "",
'EmailId' => $this->sanitize_data($getData['email']),
'Country' => $this->sanitize_data($getData['country_name']),
'City' => $this->sanitize_data($getData['city_name']),
'MobileNo' => $this->sanitize_data($getData['mobile_no']),
'AreaCode' => "",
'LandlineNo' => "",
'utm_source' => $this->sanitize_data($getData['utm_source']),
'utm_medium' => $this->sanitize_data($getData['utm_medium']),
'utm_campaign' => $this->sanitize_data($getData['utm_campaign']),
'utm_term' => $this->sanitize_data($getData['utm_term']),
'utm_content' => $this->sanitize_data($getData['utm_content']),
'application_type' => $deviceType,
'ip_address' => $url_ip_address,
'CreteDate' => date("Y-m-d H:i:s")
);
$id = 0;
$campaignsModel = new Application_Model_Campaigns();
try{
$id = $campaignsModel->add($dataArray);
} catch(Zend_Exception $e) {
echo $e->getMessage();exit;
}
// echo "<pre>";print_r($dataArray);exit;
$this->_redirect("campaigns/thankyou/id/$id");
}
}
}
public function thankyouAction()
{
// echo "sdfsdf";exit;
$this->_helper->layout()->disableLayout();
$this->_helper->layout->setLayout('campaigns');
$pixelId = $this->getRequest()->getParam('id');
$id = isset($pixelId)?$pixelId:'0';
$pixel_code = 0;
if($id != 0){
$state = new Application_Model_Campaigns();
$pixel_code = $state->getPixelCode($id);
if(!empty($pixel_code)){
$pixel_code = $pixel_code['pixcel_code'];
}
}
$this->view->id = $pixelId;
$this->view->pixel_code = $pixel_code;
}
public function getCityAction() {
$this->_helper->layout()->disableLayout('');
if ($this->_request->isXmlHttpRequest()) {
$sid = $this->getRequest()->getParam('sid');
$state = new Application_Model_State();
$city_list = $state->getAllCitiesListByStateId($sid);
//echo "<pre>";print_r($city_list);die;
$select = '<option value="">--Select City * --</option>';
if (count($city_list) > 0) {
foreach ($city_list as $val) {
$select .= '<option value="' . $val['id'] . '">' . $val['city_name'] . '</option>';
}
}
//$select .= '</select>';
echo $select;
}
exit;
}
/**
* termsConditions() method is used to send email
* @param Null
* @return Array
*/
public function termsConditionsAction() {
$this->_helper->layout()->disableLayout('');
}
/**
* __getLeftMenuListById() method is used to get all menu list by page url
* @param page string
* @return object
*/
public function sanitize_data($input_data) {
$searchArr = array("document", "write", "alert", "%", "$", ";", "+", "|", "#", "<", ">", ")", "(", "'", "\'", ",", "AND", "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);
}
}