HEX
Server: Apache
System: Linux 185.122.168.184.host.secureserver.net 5.14.0-570.52.1.el9_6.x86_64 #1 SMP PREEMPT_DYNAMIC Wed Oct 15 06:39:08 EDT 2025 x86_64
User: barbeatleanalyti (1024)
PHP: 8.1.33
Disabled: NONE
Upload Files
File: /home/barbeatleanalyti/public_html/m.beatleanalytics.com/application/models/Survey_model.php
<?php 
	class Survey_model extends CI_Model
	{
		public function loginSurvey($depId)
		{
			$this->load->database();
			$query = $this->db->get_where("beatle_industry" , array("db_IndLoginId"=>$depId));
			$result = $query->result();
			return $result;
		}
		
		public function endUserLogin($username,$password)
		{
			$this->load->database();
			$pass = md5($password);
			
			/*
			//$this->db->where("db_username",$username);
			$this->db->where("db_email",$username);
			$this->db->or_where("db_phone",$username);
			
			$this->db->where("db_password",$pass);
			
			$query = $this->db->get('beatle_userlogin');
			///echo $this->db->last_query();
			$data = $query->result(); */ 

			$SQL = "SELECT * FROM beatle_userlogin WHERE (db_phone = '".$username."' OR db_userLoginName = '".$username."') AND db_password = '".$pass."' AND db_usertype = 'End_user' ";
			//echo "<br />";
			$query = $this->db->query($SQL);
			$data = $query->result();			
			
			if($data)
			{	
				return $data;
			}
			else 
			{	
				/*$success = '0';
				$json = json_encode($success);
				return $json;*/
				$json = '0';
				return $json;

			}
		}
		
		public function SignUpUserLogin($insertdata,$enduseremail)
		{
			$this->load->database();
			$select = $this->db->get_where("beatle_userlogin" , array("db_email"=>$enduseremail));
			$result = $select->result();
			if (!empty($result))
			{
				//$error = '[{"error:1"}]';
				//$text = str_replace(".\.","",$error);
				//$json = json_encode($error);
				$error  = 'already';
				return $error;
			}
			else
			{
				$query = $this->db->insert("beatle_userlogin",$insertdata);
				if ($query)
				{
					$success = 'yes';
					//$json = json_encode($success);
					return $success;
				}
				else 
				{
					$success = '0';
					$json = json_encode($success);
					return $json;
				}
			}
		}


		public function insertUserFeedback($userid,$LoginIndid,$pageid,$pageConId,$avavalue)
		{
			
			$this->load->database();
			
			$branchId = 0;
			$getBranchID = $this->db->get_where("beatle_industry" ,array("IndId"=>$this->session->userdata('LoginIndid')));
			$rsBrandID = $getBranchID->result();
			$branchId  = $rsBrandID[0]->db_bracnchid;
			
			// to get orgid
			$rsBranches = $this->db->get_where("beatle_branch",array("branchId"=>$branchId));
			$rsBrancDetails = $rsBranches->result();
			
			$orgID = $rsBrancDetails[0]->db_branchOrg;
			
			
			$date = date('Y-m-d H:i:s');
			$insertdata = array
			(
				'db_surveyUserid' 		=> $userid,
				'db_surveyIndId' 		=> $LoginIndid,
				'db_surveyPageid' 		=> $pageid,
				'db_surveyContentId' 	=> $pageConId,
				'db_surveyBranchid' 	=> $branchId,
				'db_surveyValue' 		=> $avavalue,
				'created_date' 			=> $date,
				'tokenid' 			=> $this->session->userdata('tokenID'),
				'orgid' 			=> $orgID,
				'is_submit' 			=> "N"
			);
			
			$updatecheck = array 
			(
				'db_surveyUserid' 		=> $userid,
				'db_surveyIndId' 		=> $LoginIndid,
				'db_surveyPageid' 		=> $pageid,
				'db_surveyBranchid' 	=> $branchId,
				'db_surveyContentId' 	=> $pageConId,
				'tokenid' 			=> $this->session->userdata('tokenID'),
				'orgid' 			=> $orgID,
				'is_submit' 			=> "N"
			);
			 
			
			//$this->db->select("*");
			//$this->db->from();
			$query = $this->db->get_where("beatle_survey" , $updatecheck);
			$result = $query->result();
			if (empty($result))
			{
				$insertquery = $this->db->insert("beatle_survey" , $insertdata);
				if ($insertquery)
				{
					echo 'ddd';
				}
			}
			else 
			{
				$this->load->database();
				$this->db->where("db_surveyUserid",$userid);
				$this->db->where("db_surveyIndId",$LoginIndid);
				$this->db->where("db_surveyPageid",$pageid);
				$this->db->where("db_surveyContentId",$pageConId);
				
				$insertquery = $this->db->update("beatle_survey" , array('db_surveyValue' => $avavalue));
				if ($insertquery)
				{
					echo 'update';
				}
			}
		}

	}
?>