| Server IP : 14.225.204.176 / Your IP : 216.73.216.6 Web Server : nginx/1.24.0 System : Linux nodejs-ybgk 6.8.0-40-generic #40-Ubuntu SMP PREEMPT_DYNAMIC Fri Jul 5 10:34:03 UTC 2024 x86_64 User : root ( 0) PHP Version : 8.1.34 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /var/www/html/php/mmobot/app/modules/transactions/models/ |
Upload File : |
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class transactions_model extends MY_Model {
public $tb_users;
public $tb_categories;
public $tb_services;
public $tb_transaction_logs;
public function __construct(){
$this->tb_users = USERS;
$this->tb_categories = CATEGORIES;
$this->tb_services = SERVICES;
$this->tb_transaction_logs = TRANSACTION_LOGS;
parent::__construct();
}
function get_transaction_list($total_rows = false, $status = "", $limit = "", $start = ""){
$data = array();
if (get_role("user")) {
$this->db->where("tl.uid", session('uid'));
}
if ($limit != "" && $start >= 0) {
$this->db->limit($limit, $start);
}
$this->db->select("tl.*, u.email");
$this->db->from($this->tb_transaction_logs." tl");
$this->db->join($this->tb_users." u", "u.id = tl.uid", 'left');
$this->db->order_by("tl.id", 'DESC');
$query = $this->db->get();
if ($total_rows) {
$result = $query->num_rows();
return $result;
}else{
$result = $query->result();
return $result;
}
return false;
}
function get_transactions_by_search($k){
$k = trim(htmlspecialchars($k));
if (get_role("user")) {
$this->db->select("tl.*, u.email");
$this->db->from($this->tb_transaction_logs." tl");
$this->db->join($this->tb_users." u", "u.id = tl.uid", 'left');
if ($k != "" && strlen($k) >= 2) {
$this->db->where("(`tl`.`transaction_id` LIKE '%".$k."%' ESCAPE '!' OR `tl`.`type` LIKE '%".$k."%' ESCAPE '!')");
}
$this->db->where("u.id", session("uid"));
$this->db->order_by("tl.id", 'DESC');
$query = $this->db->get();
$result = $query->result();
}else{
$this->db->select("tl.*, u.email");
$this->db->from($this->tb_transaction_logs." tl");
$this->db->join($this->tb_users." u", "u.id = tl.uid", 'left');
if ($k != "" && strlen($k) >= 2) {
$this->db->where("(`tl`.`transaction_id` LIKE '%".$k."%' ESCAPE '!' OR `tl`.`type` LIKE '%".$k."%' ESCAPE '!' OR `u`.`email` LIKE '%".$k."%' ESCAPE '!')");
}
$this->db->order_by("tl.id", 'DESC');
$query = $this->db->get();
$result = $query->result();
}
return $result;
}
}