HEX
Server: Apache/2.4.41 (Amazon) OpenSSL/1.0.2k-fips PHP/5.6.40
System: Linux ip-172-31-40-18 4.14.146-93.123.amzn1.x86_64 #1 SMP Tue Sep 24 00:45:23 UTC 2019 x86_64
User: apache (48)
PHP: 5.6.40
Disabled: NONE
Upload Files
File: //var/www/html/pmw24/app/application/controllers/admin/Usersetting_12.07.2021.php
<?php
defined('BASEPATH') OR exit('No direct script access allowed');

class Usersetting extends MY_Controller {
	public function __construct() {
		parent::__construct();
		$this->redirect_guest();
		$this->admin=$this->session->userdata('admin');
		$this->load->model('admin/musersetting');
	}
		
	public function index() { 
		$this->_load_list_view();		
	}
	
	private function _load_list_view() {
		$data['admin'] = $this->admin;
		$data['content'] = 'admin/usersetting/list';
		$this->load->view('admin/layouts/index', $data);
	}

	public function inactive_user() { 
		$this->_load_list_view_inactive();		
	}
	
	private function _load_list_view_inactive() {
		$data['admin'] = $this->admin;
		$data['content'] = 'admin/usersetting/list_inactive';
		$this->load->view('admin/layouts/index', $data);
	}
	
	public function all_content_list(){
		$list = $this->musersetting->get_datatables();	
		//print_r($list);die;	
		$data = array();
        $no = $_POST['start'];
		$i=1;
		foreach ($list as $person) {
			$row = array();	
			$address='';
			$row[]=$i;		
			$row[] = $person->name;	
			$row[] = $person->username;
			$row[] = $person->org_password;
			if(!empty($person->unit)){
				$address.='Unit: '.$person->unit;
			}
			if(!empty($person->street)){
				if(!empty($address)){
					$address.=', Street: '.$person->street;
				}else{
					$address.=' Street: '.$person->street;
				}
			}
			if(!empty($person->suburb)){
				if(!empty($address)){
					$address.=', Suburb: '.$person->suburb;
				}else{
					$address.=' Suburb: '.$person->suburb;
				}
			}
			if(!empty($person->post_code)){
				if(!empty($address)){
					$address.=', Postcode: '.$person->post_code;
				}else{
					$address.=' Postcode: '.$person->post_code;
				}
			}
			if(!empty($person->address)){
				if(!empty($address)){
					$address.='<br>'.$person->address;
				}else{
					$address.=$person->address; 
				}
			}
			$row[] = $address;
			$row[] = $person->phoneno;
			$row[] = $person->role_name;
			
			$admin = $this->admin;
			$CI =& get_instance();
			$CI->db->select('*');
			$CI->db->from('role_menu');	
			$CI->db->join('menu', 'menu.menu_id = role_menu.menu_id', 'left');
			$CI->db->where('role_id',$admin['role_id']);
			$CI->db->where('parent_id',12);					
			$query=$CI->db->get();
			$menus = $query->result_array();		
			
			$status_result = $this->searcharray('Status', 'menu_name', $menus);
			
			$edit_result = $this->searcharray('Edit', 'menu_name', $menus);
			
			if(!empty($status_result))
			{
				$row[] = ($person->status==1?'<a class="cstm_view_status btn btn-success" id="active" href="javascript:void(0)" title="'.$person->admin_id.'"><span class="glyphicon glyphicon-ok"></span></a>':'<a class="cstm_view_status btn btn-danger" id="inactive" href="javascript:void(0)" title="'.$person->admin_id.'"><span class="glyphicon glyphicon-remove"></span></a>');	
			}
			
			if(!empty($edit_result)){	
				$row[] = '<a href="'.base_url('admin/usersetting/details/'.$person->admin_id).'" title="Edit" class="btn btn-info"><span class="glyphicon glyphicon-pencil"></span></a>';
			}
            $data[] = $row;
			$i++;
        }
		
		$output = array(
                        "draw" => $_POST['draw'],
                        "recordsTotal" => $this->musersetting->count_all(),
                        "recordsFiltered" => $this->musersetting->count_filtered(),
                        "data" => $data,
                );
        echo json_encode($output);
	}

	public function all_content_list_inactive(){
		$list = $this->musersetting->get_datatables(2);	
		//print_r($list);die;	
		$data = array();
        $no = $_POST['start'];
		$i=1;
		foreach ($list as $person) {
			$row = array();	
			$address='';
			$row[]=$i;		
			$row[] = $person->name;	
			$row[] = $person->username;
			$row[] = $person->org_password;
			if(!empty($person->unit)){
				$address.='Unit: '.$person->unit;
			}
			if(!empty($person->street)){
				if(!empty($address)){
					$address.=', Street: '.$person->street;
				}else{
					$address.=' Street: '.$person->street;
				}
			}
			if(!empty($person->suburb)){
				if(!empty($address)){
					$address.=', Suburb: '.$person->suburb;
				}else{
					$address.=' Suburb: '.$person->suburb;
				}
			}
			if(!empty($person->post_code)){
				if(!empty($address)){
					$address.=', Postcode: '.$person->post_code;
				}else{
					$address.=' Postcode: '.$person->post_code;
				}
			}
			if(!empty($person->address)){
				if(!empty($address)){
					$address.='<br>'.$person->address;
				}else{
					$address.=$person->address; 
				}
			}
			$row[] = $address;
			$row[] = $person->phoneno;
			$row[] = $person->role_name;
			
			$admin = $this->admin;
			$CI =& get_instance();
			$CI->db->select('*');
			$CI->db->from('role_menu');	
			$CI->db->join('menu', 'menu.menu_id = role_menu.menu_id', 'left');
			$CI->db->where('role_id',$admin['role_id']);
			$CI->db->where('parent_id',12);					
			$query=$CI->db->get();
			$menus = $query->result_array();		
			
			$status_result = $this->searcharray('Status', 'menu_name', $menus);
			
			$edit_result = $this->searcharray('Edit', 'menu_name', $menus);
			
			if(!empty($status_result))
			{
				$row[] = ($person->status==1?'<a class="cstm_view_status btn btn-success" id="active" href="javascript:void(0)" title="'.$person->admin_id.'"><span class="glyphicon glyphicon-ok"></span></a>':'<a class="cstm_view_status btn btn-danger" id="inactive" href="javascript:void(0)" title="'.$person->admin_id.'"><span class="glyphicon glyphicon-remove"></span></a>');	
			}
			
			if(!empty($edit_result)){	
				$row[] = '<a href="'.base_url('admin/usersetting/details/'.$person->admin_id).'" title="Edit" class="btn btn-info"><span class="glyphicon glyphicon-pencil"></span></a>';
			}
            $data[] = $row;
			$i++;
        }
		
		$output = array(
                        "draw" => $_POST['draw'],
                        "recordsTotal" => $this->musersetting->count_all(),
                        "recordsFiltered" => $this->musersetting->count_filtered(),
                        "data" => $data,
                );
        echo json_encode($output);
	}
	
	private function searcharray($value, $key, $array) {
	   foreach ($array as $k => $val) {
		   if ($val[$key] == $value) {
			   return $val;
		   }
	   }
	   return null;
	}
	
	public function all_details(){
		$user_id = $this->input->post('user_id');		
		$result = $this->musersetting->get_details($user_id);	
		$category = $this->musersetting->get_category_by_id($result['cat_id']);
		$city = $this->musersetting->get_city_by_id($result['city_id']);
		
		$subCategory = $this->musersetting->get_category_by_id($result['sub_cat_id']);
		if($category)
		{
			$result['category'] = $category;			
			/*$parent_category = $this->musersetting->get_parent_category_by_parent_id($result['category']['parent_id']);
			if($parent_category)
			{
				$result['parent_category'] = $parent_category;
			}else{
				$result['parent_category']['category_name'] = '-';
			}*/
		}else{
			//$result['parent_category']['category_name'] = '-';
			$result['category']['category_name'] = '-';
		}
		if($subCategory)
		{
			$result['sub_category'] = $subCategory;	
		}else{
			$result['sub_category']['category_name'] = '-';
		}
		$result['city'] = $city['name'];
		echo json_encode($result);
	}
	
	public function edit($admin_id){
		$data['cms']=$this->musersetting->get_details($admin_id);		
		if(empty($data['cms'])){
			$this->_load_list_view();
		}else{			
			$this->_load_details_view($data);
		}
	}
	
	public function slots($user_id){
		$data['user_slots'] = $this->musersetting->get_user_slots($user_id);
		//$date=strtotime(date('Y-m-d'));  // if today :2013-05-23

		//$newDate = date('Y-m-d',strtotime('+15 days',$date));	
		//$date_range = $this->getDatesFromRange(date('Y-m-d'),$newDate);
		//$data['date_range'] = $date_range;		
		//$data['user_id'] = $user_id;
		$this->_load_slot_view($data);
	}
	
	public function employee_slot()
	{
print_r($_POST);exit;		
		$data['dates'] = $this->input->post('date');
		print_r($dates);exit;
		$am = $this->input->post('AM');
		$pm = $this->input->post('PM');
		$um = $this->input->post('UM');
		foreach($data['dates'] as $key=>$date)
		{		
			$data['dates']['am'] = $am[$key];
			$data['dates']['pm'] = $pm[$key];
		}
		print_r($data);
		exit;
	}
	
	private function getDatesFromRange($startDate, $endDate)
	{
		$return = array($startDate);
		$start = $startDate;
		$i=1;
		if (strtotime($startDate) < strtotime($endDate))
		{
		   while (strtotime($start) < strtotime($endDate))
			{
				$start = date('Y-m-d', strtotime($startDate.'+'.$i.' days'));
				$return[] = $start;
				$i++;
			}
		}

		return $return;
	}
	
	private function _load_slot_view($data)
	{
		$data['user_slots'] = $data['user_slots'];
		$data['content'] = 'admin/usersetting/employee_slot';
		$this->load->view('admin/layouts/index', $data);
	}
	
	private function _load_details_view($parms){
		$condition = array("status"=> 1 );
		$data['roles'] = $this->musersetting->getRows('roles',$condition);	
		$data['cms']=$parms['cms'];	
		$data['content'] = 'admin/usersetting/detail';
		$this->load->view('admin/layouts/index', $data);
	}
	
	public function update(){
		if($this->input->post()){
			$admin_id = $this->input->post('admin_id');
			$this->form_validation->set_rules('role_id','Role Name','required');
			$this->form_validation->set_rules('first_name','First Name','required');				
			$this->form_validation->set_rules('email','email','required');			
			$this->form_validation->set_rules('phoneno','Phone No','required');
			//$this->form_validation->set_rules('abn','ABN','required');
			
			
			if($this->form_validation->run()==FALSE){
				$data['cms']=$this->musersetting->get_details($admin_id);				
				$this->_load_details_view($data);
			}else{
				$email = $this->input->post('email');
				$condition = array("admin_id"=>$admin_id);
				$user_information = $this->musersetting->getRow('admins',$condition);				
				if($user_information['email'] == $email)
				{
					$udata['first_name']=$this->input->post('first_name');
					$udata['last_name']=$this->input->post('last_name');
					$udata['name'] = $udata['first_name']." ".$udata['last_name'];
					$udata['employee_id'] = $this->input->post('employee_id');
					$udata['email']=$this->input->post('email');
					$udata['username'] = $this->input->post('email');								
					$udata['phoneno']=$this->input->post('phoneno');
					$dob = $this->input->post('dob');
					$dob_array = explode('/',$dob);
					$newDob = $dob_array[2]."-".$dob_array[1]."-".$dob_array[0];
					$udata['dob'] = $newDob;
					$udata['unit'] = $this->input->post('unit');
				    $udata['street'] = $this->input->post('street');
				    $udata['suburb'] = $this->input->post('suburb');
				    $udata['post_code'] = $this->input->post('post_code');
					$udata['address'] = $this->input->post('address');
					$udata['emergency_contact'] = $this->input->post('emergency_contact_no');
					$udata['tfn'] = $this->input->post('tfn');
					$udata['abn'] = $this->input->post('abn');
					$udata['role_id'] = $this->input->post('role_id');					
					$udata['date_of_update']=date('Y-m-d H:i:s');
					$udata['org_password'] = $this->input->post('org_password');
					$udata['password']=sha1($this->input->post('org_password'));
					$this->musersetting->update($condition,$udata);
					
					$this->session->set_flashdata('success_msg','User updated successfully');
					redirect('admin/usersetting');
				}else{
					$conditionUserDetails = array("email"=>$email);
					
					$userDetail = $this->musersetting->getRow('admins',$conditionUserDetails);					
					
					if(empty($userDetail))
					{
						$udata['first_name']=$this->input->post('first_name');
						$udata['last_name']=$this->input->post('last_name');
						$udata['name'] = $udata['first_name']." ".$udata['last_name'];
						$udata['email']=$this->input->post('email');
						$udata['employee_id'] = $this->input->post('employee_id');
						$udata['username'] = $this->input->post('email');								
						$udata['phoneno']=$this->input->post('phoneno');
						$udata['dob'] = $this->input->post('dob');
						$udata['unit'] = $this->input->post('unit');
						$udata['street'] = $this->input->post('street');
						$udata['suburb'] = $this->input->post('suburb');
						$udata['post_code'] = $this->input->post('post_code');
						$udata['address'] = $this->input->post('address');
						$udata['emergency_contact'] = $this->input->post('emergency_contact_no');
						$udata['tfn'] = $this->input->post('tfn');
						$udata['abn'] = $this->input->post('abn');	
						$udata['role_id'] = $this->input->post('role_id');						
						$udata['date_of_update']=date('Y-m-d H:i:s');
						$this->musersetting->update($condition,$udata);
						
						$this->session->set_flashdata('success_msg','User updated successfully');
						redirect('admin/usersetting');
					}else{
						$this->session->set_flashdata('error_msg','User Already Exsits');
						redirect('admin/usersetting');
					}
				}		
				
			}
		}else{
			$this->_load_list_view();
		}
	}
	
	public function add_content()
	{
		if($this->input->post()){
			$this->form_validation->set_rules('role_id','Role Name','required');
			$this->form_validation->set_rules('first_name','First Name','required');				
			$this->form_validation->set_rules('email','email','required|valid_email|is_unique[admins.email]');			
			$this->form_validation->set_rules('phoneno','Phone No','required');
			
			//if($this->input->post('role_id')==)
			
			//$this->form_validation->set_rules('abn','ABN','required');						
			//$this->form_validation->set_rules('unitno','Unit','required');	
			//$this->form_validation->set_rules('street','street','required');
            //$this->form_validation->set_rules('suburb','suburb','required');
            $this->form_validation->set_rules('post_code','Post Code','required');
			
			if($this->form_validation->run()==FALSE){			
				$this->_load_add_view();
			}else{			
				$udata['first_name']=$this->input->post('first_name');
				$udata['last_name']=$this->input->post('last_name');
				$udata['name'] = $udata['first_name']." ".$udata['last_name'];
				$udata['email']=$this->input->post('email');
				$udata['employee_id'] = $this->input->post('employee_id');
				$udata['username'] = $this->input->post('email');
				$udata['password']=sha1($this->input->post('password'));
				$udata['org_password']=$this->input->post('password');				
				$udata['phoneno']=$this->input->post('phoneno');
				$dob = $this->input->post('dob');
				if(!empty($dob)){
				$dob_array = explode('/',$dob);

				$newDob = $dob_array[2]."-".$dob_array[1]."-".$dob_array[0];
				}
				else
				{
				$newDob = '';	
				}
				$udata['dob'] = $newDob;
				$udata['unit'] = $this->input->post('unit');
				$udata['street'] = $this->input->post('street');
				$udata['suburb'] = $this->input->post('suburb');
				$udata['post_code'] = $this->input->post('post_code');
				$udata['address'] = $this->input->post('address');
				$udata['emergency_contact'] = $this->input->post('emergency_contact_no');
				$udata['tfn'] = $this->input->post('tfn');
				$udata['abn'] = $this->input->post('abn');
				$udata['role_id'] = $this->input->post('role_id');
				$udata['status']=1;								
				$udata['date_of_creation']=date('Y-m-d H:i:s');
				//print_r($udata) ; exit() ; 
				$admin_id = $this->musersetting->add($udata);
				if(!empty($admin_id)){
					$mail_temp = file_get_contents('./global/mail/password.html');						
					$mail_temp=str_replace("{name}",$name,$mail_temp);
					$mail_temp=str_replace("{passwd}",$this->input->post('password'),$mail_temp);
					$mail_temp=str_replace("{username}",$udata['email'],$mail_temp);
					$mail_temp=str_replace("{shop_name}","PUNJAB MOTOR WORKSHOP",$mail_temp);
					//$mail_temp=str_replace("{shop_logo}",$this->logo,$mail_temp);
							
					$data['to']=$this->input->post('email');
					$data['name']='PUNJAB MOTOR WORKSHOP';
					$data['subject']='PUNJAB MOTOR WORKSHOP New Login Details';
					$data['message']=$mail_temp;
					$data['from']='admin@gmail.com';
					$this->sendMail($data);
				}
				$this->session->set_flashdata('success_msg','User added successfully');
				redirect('admin/usersetting/content');
			}
		}else{
			$this->_load_list_view();
		}
	}
	
	private function image_upload(){ 
		$img='imgInp';
		if (!is_dir('./public/admin_assets/images/profilepics/')) {
			mkdir('./public/admin_assets/images/profilepics/' ,0777, TRUE);			
		}		
		$config['upload_path'] = './public/admin_assets/images/profilepics/';
		$config['allowed_types'] = 'gif|jpg|png';
		//$config['min_width']  = '200';
		//$config['min_height']  = '200';
		//$config['max_size']	= '100';
		//$config['max_width']  = '1024';
		//$config['max_height']  = '768';
		$config['encrypt_name']  = true;
		$this->load->library('upload', $config);
		if ( ! $this->upload->do_upload($img)){
			$message = array('result' => $this->upload->display_errors(),'status'=>0);
		}else{ 
			$data = array('upload_data' => $this->upload->data());
			$message = array('result' => $data['upload_data']['file_name'],'status'=>1);
		}
		return $message;
	}
	
	public function add(){		
		$this->_load_add_view();
	}
	
	public function send_special_notification()
	{
		$comment =  $this->input->post('comment');
		$deviceList=$this->musersetting->deviceList();
		$push['message'] = $comment;
		
		if(!empty($deviceList)){
			foreach($deviceList as $device){
				if($device['device_type']==2 && $device['device_token'] != '' && $device['loggedin_status'] == 1){
					$this->send_android_notification($device['device_token'],$push);
				}else if($device['device_type']==1 && $device['device_token'] != '' && $device['loggedin_status'] == 1){
					$this->send_ios_notification($device['device_token'],$push);
				}
			}					
		}
		
		$result['notify_message'] = 'Notification Successfully Send';
		
		
		echo json_encode($result);
	}
	
	private function _load_add_view(){
		$condition = array('status'=>1);
		$data['roles'] = $this->musersetting->getRows('roles',$condition);		
		$data['content']='admin/usersetting/add';
		$this->load->view('admin/layouts/index',$data);
	}
	
	
	
	public function delete_content(){
		$condition['user_id']=$this->input->post('user_id');	
		$user_information = $this->musersetting->get_details($this->input->post('user_id'));
		if($user_information['profile_image']){
			unlink('./public/images/profilepics/'.$user_information['profile_image']);					
		}
		$this->musersetting->delete($condition);
		$response=array('status'=>1,'message'=>'Success');
		echo header('Content-Type: application/json');
		echo json_encode($response);
	}
	
	public function delete_profile_pic(){
		$condition['user_id']=$this->input->post('user_id');
		$user_information = $this->musersetting->get_details($this->input->post('user_id'));
		if($user_information['profile_image']){
			unlink('./public/images/profilepics/'.$user_information['profile_image']);					
		}
		
		$udata['profile_image']= '';
		$this->musersetting->update($condition,$udata);	
		return 1;	
	}
	
	public function active()
	{
		$condition['admin_id']=$this->input->post('admin_id');
		$udata['status'] = 1;
		$this->musersetting->active($condition,$udata);
		$response=array('status'=>1,'message'=>'Success');		
		echo json_encode($response);
	}
	
	public function inactive()
	{
		$condition['admin_id']=$this->input->post('admin_id');
		$udata['status'] = 0;
		$this->musersetting->active($condition,$udata);
		$response=array('status'=>1,'message'=>'Success');		
		echo json_encode($response);
	}
	
	public function multiple_del()
	{
		$user_ids = explode(',',$this->input->post('user_ids'));
		foreach($user_ids as $user_id)
		{
			$condition['user_id'] = $user_id;					
			$this->musersetting->delete($condition);			
			$response=array('status'=>1,'message'=>'Success');
		}		
		echo header('Content-Type: application/json');
		echo json_encode($response);
	}
	
	public function get_sub_category()
	{
		$category_id =  $this->input->post('category_id');
		$result['sub_category'] = $this->musersetting->get_sub_category($category_id);
		if(empty($result))
		{
			$result = array("category_name"=>"Select");
		}
		echo json_encode($result);
	}
	
	public function send_ios_notification($devicetoken,$data){
		$passphrase='123456';
        $deviceToken = $devicetoken;    
        $ctx = stream_context_create();
		// ck.pem is your certificate file ssl://gateway.sandbox.push.apple.com:2195
		stream_context_set_option($ctx, 'ssl', 'local_cert', './public/WeCareStaffPem.pem');
		stream_context_set_option($ctx, 'ssl', 'passphrase', $passphrase);
		// Open a connection to the APNS server
		$fp = stream_socket_client(
			'ssl://gateway.sandbox.push.apple.com:2195', $err,
			$errstr, 60, STREAM_CLIENT_CONNECT|STREAM_CLIENT_PERSISTENT, $ctx);

		if (!$fp){ 
			//exit("Failed to connect: $err $errstr" . PHP_EOL);
			return 2;
		}else{
			// Create the payload body
			$body['aps'] = array(
					'alert' => array(
					    'title' => 'Wecare App',
		                'body' => 'Wecare App',
					 ),
					'sound' => 'default',
					'data'=>$data
			);

			// Encode the payload as JSON
			$payload = json_encode($body);
			// Build the binary notification
			$msg = chr(0) . pack('n', 32) . pack('H*', str_replace(' ', '', $deviceToken)) . pack('n', strlen($payload)) . $payload;  //
			//$msg = chr(0) . pack('n', 32) . pack('H*',str_replace(' ', '', sprintf('%u', CRC32($deviceToken)))) . pack('n', strlen($payload)) . $payload;  // 
			//str_replace(' ', '', sprintf('%u', CRC32($deviceToken)))
			//$msg = chr(0) . pack('n', 32) . pack('H*', str_replace(' ', '', sprintf('%u', CRC32($deviceToken)))) . pack('n', strlen($payload)) . $payload
			// Send it to the server
			$result = fwrite($fp, $msg, strlen($msg));
			// Close the connection to the server
			fclose($fp);
			if (!$result){
				//return 'Message not delivered' . PHP_EOL;
				return 0; 
			}else{
				//return  'Message successfully delivered' . PHP_EOL;
				return 1;
			}
		} 
	}
	public function send_android_notification($registration_ids, $data) {
		$fields = array(
		'registration_ids' => array($registration_ids),
		'data'=> $data,
		);
		$headers = array(
		'Authorization: key=AAAAAjykQAw:APA91bF2xwn1yqpfBkoxg_K_fTp5bOaI4M3zXL_yG63hmQpqvVFZlMiilFdf65DWdqAO5Xy3eBxJjFybwKMwDMnr16ls_YnMDpMAfwTbJUcBnpHK4supv42pZIoDEBHrdUwOFI9wmQYs', // FIREBASE_API_KEY_FOR_ANDROID_NOTIFICATION
		'Content-Type: application/json'
		);
		// Open connection
		$ch = curl_init();
		 
		// Set the url, number of POST vars, POST data
		curl_setopt( $ch,CURLOPT_URL, 'https://fcm.googleapis.com/fcm/send' );
		curl_setopt( $ch,CURLOPT_POST, true );
		curl_setopt( $ch,CURLOPT_HTTPHEADER, $headers );
		curl_setopt( $ch,CURLOPT_RETURNTRANSFER, true );
		 
		// Disabling SSL Certificate support temporarly
		curl_setopt( $ch,CURLOPT_SSL_VERIFYPEER, false );
		curl_setopt( $ch,CURLOPT_POSTFIELDS, json_encode( $fields ) );
		 
		// Execute post
		$result = curl_exec($ch );
		if($result === false){
		//die('Curl failed:' .curl_errno($ch));
			return 0;
		}
		 
		// Close connection
		curl_close( $ch );
		return $result;
	}
	
	private function sendMail($data){
		$config['protocol']    	= 'smtp';
        $config['protocol']      = 'smtp';
        $config['smtp_host']     = 'ssl://mail.fitser.com';
        $config['smtp_port']     = '465';  
        $config['smtp_user']     = 'test123@fitser.com';
        $config['smtp_pass']     = 'Test123@';
        $config['charset']    	= 'utf-8';
        $config['newline']    	= "\r\n";
        $config['mailtype'] 	= 'html';
        $config['validation'] 	= TRUE;   

        $this->email->initialize($config);

        $this->email->set_crlf( "\r\n" );

        $this->email->from('info@punjabmotor.com', 'PUNJAB MOTOR WORKSHOP');
        $this->email->to($data['to']); 

        $this->email->subject($data['subject']);
        $this->email->message($data['message']);  

        $this->email->send();
		return true;   	
    } 
	
}