| 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/public_html/lrsys_projetos/sopizzas/application/models/ |
Upload File : |
<?php
Class User extends CI_Model
{
function total_count($isadmin)
{
$this -> db -> select('*');
$this -> db -> from('redm_user');
$this -> db -> where('is_admin = ' . "'" . $isadmin . "'");
$query = $this -> db -> get();
//$query = $this->db->where('is_admin', '2')->get('redm_user');
return $query->num_rows();
}
function total_count_new($isadmin,$client_id)
{
$this -> db -> select('*');
$this -> db -> from('redm_user');
$this -> db -> where('is_admin = ' . "'" . $isadmin . "'");
$this -> db -> where('client_id = ' . "'" . $client_id . "'");
$query = $this -> db -> get();
//$query = $this->db->where('is_admin', '2')->get('redm_user');
return $query->num_rows();
}
function login($username, $password)
{
$this -> db -> select('*');
$this -> db -> from('rt_admin');
$this -> db -> where('username = ' . "'" . $username . "'");
$this -> db -> where('password = ' . "'" . $password . "'");
//$this -> db -> where('counter_no = ' . "'" . $counter_no . "'");
$this -> db -> limit(1);
$query = $this -> db -> get();
if($query -> num_rows() == 1)
{
return $query->result();
}
else
{
return false;
}
}
function login_cookie($cookieData)
{
$this -> db -> select('*');
$this -> db -> from('rt_admin');
$this -> db -> where('md5(admin_id)',$cookieData);
$this -> db -> limit(1);
$query = $this -> db -> get();
if($query -> num_rows() == 1)
{
return $query->result();
}
else
{
return false;
}
}
function login_cookie_restaurant($cookieData)
{
$this -> db -> select('*');
$this -> db -> from('rt_restaurant');
$this -> db -> where('md5(restaurant_id)',$cookieData);
$this -> db -> limit(1);
$query = $this -> db -> get();
if($query -> num_rows() == 1)
{
return $query->result();
}
else
{
return false;
}
}
function login_restaurant($username, $password)
{
$this -> db -> select('*');
$this -> db -> from('rt_restaurant');
$this -> db -> where('restaurant_contact_email = ' . "'" . $username . "'");
$this -> db -> where('restaurant_password = ' . "'" . $password . "'");
//$this -> db -> where('counter_no = ' . "'" . $counter_no . "'");
$this -> db -> limit(1);
$query = $this -> db -> get();
if($query -> num_rows() == 1)
{
return $query->result();
}
else
{
return false;
}
}
function login_cookie_customer($cookieData)
{
$this -> db -> select('*');
$this -> db -> from('rt_customer');
$this -> db -> where('md5(customer_id)',$cookieData);
$this -> db -> limit(1);
$query = $this -> db -> get();
if($query -> num_rows() == 1)
{
return $query->result();
}
else
{
return false;
}
}
function login_customer($username, $password)
{
$this -> db -> select('*');
$this -> db -> from('rt_customer');
$this -> db -> where('customer_email = ' . "'" . $username . "'");
$this -> db -> where('customer_password = ' . "'" . $password . "'");
//$this -> db -> where('counter_no = ' . "'" . $counter_no . "'");
$this -> db -> limit(1);
$query = $this -> db -> get();
if($query -> num_rows() == 1)
{
return $query->result();
}
else
{
return false;
}
}
function login_customer_fb($fb_id)
{
$this -> db -> select('*');
$this -> db -> from('rt_customer');
$this -> db -> where('fb_id = ' . "'" . $fb_id . "'");
//$this -> db -> where('counter_no = ' . "'" . $counter_no . "'");
$this -> db -> limit(1);
$query = $this -> db -> get();
if($query -> num_rows() == 1)
{
return $query->result();
}
else
{
return false;
}
}
function getAllClient()
{
$is_admin=3;
$is_active=1;
$this->db->select('*');
$this->db->from('redm_user');
//$this->db->where('is_active=1 and is_admin=3');
$this->db->where('is_admin = '."'". $is_admin . "'");
$this->db->where('is_active = '."'". $is_active . "'".' order by name');
$query=$this->db->get();
if($query->num_rows() >0)
{
return $query->result();
}
return false;
}
function check_access($userid,$accessnm,$actionNm)
{
$goval=1;
if($actionNm=='view'){
$fld_nm='r_view';
}
if($actionNm=='add'){
$fld_nm='r_add';
}
if($actionNm=='edit'){
$fld_nm='r_edit';
}
if($actionNm=='delete'){
$fld_nm='r_delete';
}
$accessQery=$this -> get_access_id($accessnm);
$accessid=$accessQery['id'];
$this -> db -> select('*');
$this -> db -> from('redm_access_user');
$this -> db -> where('userid = ' . "'" . $userid . "'");
$this -> db -> where('accessid = ' . "'" . $accessid . "'");
$this -> db -> where( $fld_nm.' = ' . "'" . $goval . "'");
$this -> db -> limit(1);
$query = $this -> db -> get();
if($query -> num_rows() == 1)
{
return $query->result();
}
else
{
return false;
}
}
function get_access_id($accessnm)
{
$this->db->select('*');
$this->db->from('redm_access');
$this->db->where('link = '."'". $accessnm . "'");
$query = $this->db->get();
if ($query->num_rows() > 0)
{
return $query->row_array();
}
return false;
}
function get_user($limit, $start, $is_admin)
{
$this->db->select('*');
$this->db->from('redm_user');
$this->db->where('is_admin = '."'". $is_admin . "'".' order by id DESC');
$this->db->limit($limit, $start);
$query = $this->db->get();
if ($query->num_rows() > 0)
{
return $query->result_array();
}
return false;
}
function get_user_new($limit, $start, $is_admin, $client_id)
{
$this->db->select('*');
$this->db->from('redm_user');
$this -> db -> where('client_id = ' . "'" . $client_id . "'");
$this->db->where('is_admin = '."'". $is_admin . "'".' order by id DESC');
$this->db->limit($limit, $start);
$query = $this->db->get();
if ($query->num_rows() > 0)
{
return $query->result_array();
}
return false;
}
function user_details($id)
{
$this->db->select('*');
$this->db->from('redm_user');
$this->db->where('id = '."'". $id . "'");
$query = $this->db->get();
if ($query->num_rows() > 0)
{
return $query->row_array();
}
return false;
}
function IsUserExist($restaurant_contact_email, $exclude_userid) {
$this->db->select('restaurant_id');
$this->db->from('rt_restaurant');
$this->db->where('restaurant_contact_email', $restaurant_contact_email);
$this->db->where('restaurant_id !=', $exclude_userid);
$queryRest = $this->db->get();
$this->db->select('customer_id');
$this->db->from('rt_customer');
$this->db->where('customer_email', $restaurant_contact_email);
$queryCust = $this->db->get();
$this->db->select('driver_id');
$this->db->from('rt_driver');
$this->db->where('driver_email', $restaurant_contact_email);
$queryDri = $this->db->get();
if($queryRest->num_rows() > 0 || $queryCust->num_rows() > 0 || $queryDri->num_rows() > 0) {
return true;
}
else {
return false;
}
}
function isRestNameExist($restaurant_name, $exclude_userid) {
$this->db->select('restaurant_id');
$this->db->from('rt_restaurant');
$this->db->where('restaurant_name', $restaurant_name);
$this->db->where('restaurant_id !=', $exclude_userid);
$queryRest = $this->db->get();
if($queryRest->num_rows() > 0 ) {
return true;
}
else {
return false;
}
}
function getAllAccess_old()
{
$query = $this->db->order_by("link_name", "asc");
$query = $this -> db -> get('redm_access');
return $query -> result();
}
function getAllAccess($userid)
{
$this->db->select('*');
$this->db->from('redm_access');
$this->db->where('redm_access.id not in (select accessid from redm_access_user where userid='."'". $userid . "')".' order by link_name ASC');
//$this->db->limit($limit, $start);
$query = $this->db->get();
if ($query->num_rows() > 0)
{
return $query->result();
}
return false;
}
function access_user_details($userid)
{
$this->db->select('redm_access.link_name,redm_access_user.*');
$this->db->from('redm_access_user');
$this->db->join('redm_access','redm_access_user.accessid=redm_access.id');
$this->db->where('redm_access_user.userid = '."'". $userid . "'");
//$this->db->limit($limit, $start);
$query = $this->db->get();
if ($query->num_rows() > 0)
{
return $query->result_array();
}
return false;
}
function client_access_details($client_id,$userid)
{
//SELECT * FROM `redm_campaign` left join (select * from access_client_user where user_id=55) as A on redm_campaign.id=A.camp_id where redm_campaign.`client_id`=56
$this->db->select('b.id,b.campaign_name,a.redemp_repo,a.stock_repo');
$this->db->from('redm_campaign as b');
$this->db->join('(select * from access_client_user where user_id='.$userid.') as a','b.id=a.camp_id','left');
$this->db->where('b.client_id = '.$client_id.' order by campaign_name');
//$this->db->limit($limit, $start);
$query = $this->db->get();
if ($query->num_rows() > 0)
{
return $query->result_array();
}
return false;
}
function access_user_id($id)
{
$this->db->select('userid');
$this->db->from('redm_access_user');
$this->db->where('id = '."'". $id . "'");
$query = $this->db->get();
if ($query->num_rows() > 0)
{
return $query->row_array();
}
return false;
}
function get_access_result($user_id)
{
$this->db->select('*');
$this->db->from('access_client_user');
$this->db->where('user_id = '."'". $user_id . "'");
$query = $this->db->get();
if ($query->num_rows() > 0)
{
return $query->result_array();
}
return false;
}
}
?>