https://t.me/RX1948
Server : Apache/2.4.18 (Ubuntu)
System : Linux canvaswebdesign 3.13.0-71-generic #114-Ubuntu SMP Tue Dec 1 02:34:22 UTC 2015 x86_64
User : oppastar ( 1041)
PHP Version : 7.0.33-0ubuntu0.16.04.15
Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,
Directory :  /var/www/kamariallee.com/public_html/application/models/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /var/www/kamariallee.com/public_html/application/models/Customer_m.php
<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Customer_m extends MY_Model {
	
	protected $_table_name = 'customers';
	protected $_order_by = 'name';
	
	public $rules = array(
		'email' => array(
			'field'=>'email', 
			'label'=>'Email', 
			'rules'=>'trim|required|valid_email'),	
		'password' => array(
			'field'=>'password', 
			'label'=>'Password', 
			'rules'=>'trim|required')
	);

	public $lostpassword_rules = array(
			
		'email' => array(
			'field'=>'email', 
			'label'=>'Email', 
			'rules'=>'trim|required|valid_email|callback_checkregisteredemail')	
	);

	public $registration_rules = array(
		'name' => array(
			'field'=>'name', 
			'label'=>'Name', 
			'rules'=>'trim|required'),

		'register_email' => array(
			'field'=>'register_email', 
			'label'=>'Email', 
			'rules'=>'trim|required|valid_email|callback_cek_email'),

		'register_password' => array(
			'field'=>'register_password', 
			'label'=>'Password', 
			'rules'=>'trim|required'),

		'retype_register_password' => array(
			'field'=>'retype_register_password', 
			'label'=>'Retype Password', 
			'rules'=>'trim|required|matches[register_password]'), 	
		'honeypot' => array(
			'field'	=> 'honeypot',
			'label'	=> 'Honeypot',
			'rules'	=> 'callback_check_honeypot'
		)		
	);

	public $registration_rules_international = array(

		'title' => array(
			'field'=>'title', 
			'label'=>'Title', 
			'rules'=>'trim|required'),	

		'name' => array(
			'field'=>'name', 
			'label'=>'Name', 
			'rules'=>'trim|required'),

		'phone' => array(
			'field'=>'phone', 
			'label'=>'Phone', 
			'rules'=>'trim|required'),	

		'register_email' => array(
			'field'=>'register_email', 
			'label'=>'Email', 
			'rules'=>'trim|required|valid_email|callback_cek_email'),

		'birthday' => array(
			'field'=>'birthday', 
			'label'=>'Birthday', 
			'rules'=>'trim'),	

		'register_password' => array(
			'field'=>'register_password', 
			'label'=>'Password', 
			'rules'=>'trim|required'),

		'retype_register_password' => array(
			'field'=>'retype_register_password', 
			'label'=>'Retype Password', 
			'rules'=>'trim|required|matches[register_password]'),	

		'country' => array(
			'field'=>'country', 
			'label'=>'Country', 
			'rules'=>'trim|required'),

		'address' => array(
			'field'=>'address', 
			'label'=>'Address', 
			'rules'=>'trim|required'), 

		'postcode' => array(
			'field'=>'postcode', 
			'label'=>'Postcode', 
			'rules'=>'trim|required')
	);

	public $profile_rules = array(

			'name' => array(
				'field'=>'name', 
				'label'=>'Name', 
				'rules'=>'trim|required'),	
			
			'password' => array(
				'field'=>'password', 
				'label'=>'Password', 
				'rules'=>'trim|required'),

			'retype_register_password' => array(
				'field'=>'confirm_password', 
				'label'=>'Confirm Password', 
				'rules'=>'trim|required|matches[password]'),				
	);

	public $shipping_rules = array(

			'recipient_name' => array(
				'field'=>'recipient_name', 
				'label'=>'Recipient Name', 
				'rules'=>'trim|required'),	

			'address' => array(
				'field'=>'address', 
				'label'=>'Address', 
				'rules'=>'trim|required'),

			'country' => array(
				'field'=>'country', 
				'label'=>'Country', 
				'rules'=>'trim|required'),	

			'province' => array(
				'field'=>'province', 
				'label'=>'Province', 
				'rules'=>'trim|required'),

			'district' => array(
				'field'=>'district', 
				'label'=>'District', 
				'rules'=>'trim|required'),	

			'subdistrict' => array(
				'field'=>'subdistrict', 
				'label'=>'Sub District', 
				'rules'=>'trim|required'),		

			'postcode' => array(
				'field'=>'postcode', 
				'label'=>'Postcode', 
				'rules'=>'trim|required'),

			'phone' => array( 
				'field'=>'phone', 
				'label'=>'Phone', 
				'rules'=>'trim|required'),

			'shipping_name' => array(
				'field'=>'shipping_name', 
				'label'=>'Shipping Name', 
				'rules'=>'trim'),	

			'shipping_address' => array(
				'field'=>'shipping_address', 
				'label'=>'AShipping ddress', 
				'rules'=>'trim'),

			'shipping_country' => array(
				'field'=>'shipping_country', 
				'label'=>'Country', 
				'rules'=>'trim'),	

			'shipping_province' => array(
				'field'=>'shipping_province', 
				'label'=>'Shipping Province', 
				'rules'=>'trim'),

			'shipping_district' => array(
				'field'=>'shipping_district', 
				'label'=>'Shipping District', 
				'rules'=>'trim'),	

			'shipping_subdistrict' => array(
				'field'=>'shipping_subdistrict', 
				'label'=>'Shipping Sub District', 
				'rules'=>'trim'),	

			'shipping_postcode' => array(
				'field'=>'shipping_postcode', 
				'label'=>'Postcode', 
				'rules'=>'trim|required'),

			'shipping_phone' => array(
				'field'=>'shipping_phone', 
				'label'=>'Phone', 
				'rules'=>'trim|required')
	);

	public $shipping_rules_international = array(

			'recipient_name' => array(
				'field'=>'recipient_name', 
				'label'=>'Recipient Name', 
				'rules'=>'trim|required'),	

			'address' => array(
				'field'=>'address', 
				'label'=>'Address', 
				'rules'=>'trim|required'),

			'country' => array(
				'field'=>'country', 
				'label'=>'Country', 
				'rules'=>'trim|required'),	

			'postcode' => array(
				'field'=>'postcode', 
				'label'=>'Postcode', 
				'rules'=>'trim|required'),

			'phone' => array(
				'field'=>'phone', 
				'label'=>'Phone', 
				'rules'=>'trim|required'),

			'shipping_name' => array(
				'field'=>'shipping_name', 
				'label'=>'Shipping Name', 
				'rules'=>'trim'),	

			'shipping_address' => array(
				'field'=>'shipping_address', 
				'label'=>'AShipping ddress', 
				'rules'=>'trim'),

			'shipping_country' => array(
				'field'=>'shipping_country', 
				'label'=>'Country', 
				'rules'=>'trim'),

			'shipping_postcode' => array(
				'field'=>'shipping_postcode', 
				'label'=>'Postcode', 
				'rules'=>'trim|required'),

			'shipping_phone' => array(
				'field'=>'shipping_phone', 
				'label'=>'Phone', 
				'rules'=>'trim|required')
	);
			
	function __construct() {
		parent::__construct();	
	}	
	
	//function for login
	public function login() { 
		$customer = $this->get_by(array(
				'email' => $this->security->xss_clean($this->input->post('email')),
				'password' => $this->hash($this->input->post('password')),
				'status' => 1
				), TRUE);
		
		if(count($customer)) {
			//if customer is exist in database, then log them in..	
			$customer_data = array(
				'customer_name' => $customer->name,
				'customer_email' => $customer->email,
				'customer_id' => $customer->id_customers,
				'customer_loggedin' => TRUE
			);
			$this->session->set_userdata(array('customer' => $customer_data)); 
		}
	} 

	//google login
	public function google_login($user_data) { 
		$customer = $this->get_by(array(
				'email' => $user_data['email'],
				'login_oauth_uid' => $user_data['id'],
				'status' => 1
				), TRUE);
		
		if(count($customer)) {
			//if customer is exist in database, then log them in..	
			$customer_data = array(
				'customer_name' => $customer->name,
				'customer_email' => $customer->email,
				'customer_id' => $customer->id_customers,
				'customer_loggedin' => TRUE
			);
			$this->session->set_userdata(array('customer' => $customer_data)); 
		}
	} 
	
	//function for logout
	public function logout() {
   		$this->session->unset_userdata('customer');
    }
	
	//IS USED: function to check if logged in, true if loggedin
	public function loggedin() {
		if($this->session->userdata('customer') && $this->session->userdata('customer')['customer_loggedin']) {
			return (bool) $this->session->userdata('customer')['customer_loggedin'];
		} else {
			return false;
		}
	}
	
	//function for hashing SHA512
	public function hash($string) {
		return hash('sha512', $string . config_item('encryption_key'));
		//password is salted with encryption key, and then use sha512
    }

	//count existing email
    function cek_existing_email($email) {
		$this->db->select('*');
		$this->db->from('customers');
		$this->db->where('email', $email);
		$query = $this->db->get();
		return $query->num_rows();
	}

	//get customer by id customer
	function get_customer($id_customer) {
		$this->db->select('name, email, phone');
		$this->db->from('customers');
		$this->db->where('id_customers', $id_customer);
		$query = $this->db->get();
		return $query->row();
	}

	//update customer profile
	function update_profile($id, $data) {
		$this->db->where('id_customers', $id);
		$this->db->update('customers', $data);	
	}

	//get shipping
	function get_shipping($id_customer) {
		$this->db->select('*');
		$this->db->from('customers');
		$this->db->where('id_customers', $id_customer);
		$query = $this->db->get();
		return $query->row();
	}

	//update shipping
	function update_shipping($id, $data) {
		$this->db->where('id_customers', $id);
		$this->db->update('customers', $data);	
	}

    //function to return a new user
	public function get_new() {
		$user = new stdClass();
		$user->name = '';	
		$user->email = '';
		$user->password = '';
		return $user;
	}

	//function count all record for customers
	public function record_count() {
        return $this->db->get('customers')->num_rows();
    }

    //get all customer with pagination included
	function get_all_customers($limit, $start) {
		$this->db->select('*');
		$this->db->from('customers');
		$this->db->order_by('join_date', 'DESC');
		$this->db->limit($limit, $start);
		$query = $this->db->get();		
		return $query->result();
	}

	//excel export customer data
	function excel_export() {
		$this->db->select('name, title, email, phone, address, district, province, country, postcode, birthday, socialmedia, join_date');
		$this->db->from('customers');
		$this->db->order_by('join_date', 'DESC');
		$query = $this->db->get();		
		return $query->result();
	}
	
}

https://t.me/RX1948 - 2025