Ask Experts Questions for FREE Help !
Ask
    Goochi's Avatar
    Goochi Posts: 1, Reputation: 1
    New Member
     
    #1

    Sep 22, 2013, 10:07 PM
    Backspace bug
    Hi there


    My problem is I have an app with admin and partners access group lvl 1 and 2

    The problem here when I login as partner I have to see only items that assigned to me by the admin

    But when I press backspace button the page refresh and show up all the items that the admin have

    Please can you chk where I made the error and thank you for your help

    Here is the code

    PHP Code:
    <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

    class 
    Members extends CI_Controller {
        public 
    $success$message$data;
        var 
    $table "subscribers";
        var 
    $part_tabel "partners";
        var 
    $serv_tabel "servers";
        var 
    $user NULL;
        
        function 
    __construct() {
            
    parent::__construct();
            
    $this->success true;
            
    $this->data = array();
            
    $this->message ""
            if (!
    $this->ion_auth->logged_in())
            {
                if(
    $this->ion_auth->isAjax()){
                    
    $this->success false;
                    
    $this->to_json(array("login"=>true));
                    exit;
                }else{
                    
    redirect('auth/login');
                }
            }
            
    $this->load->model("tools_model");
            
    $this->load->model("user_model");        
            
    $this->user $this->get_partner_id();
        }
        function 
    user_info(){
            
    $lines = array();
            
    $users json_decode($this->input->post("users"), true);        
            foreach(
    $users as $user){            
                if(
    $t $this->tools_model->fetch_user_infos($user))
                    
    $lines array_merge($lines,$t);
                    
            }
            
    $this->load->view("user_infos", array("lines"=>$lines));
        }
        function 
    get_record($id){
            
    $q $this->db->get_where($this->table, array("id"=>$id));
            return 
    $q->num_rows() > $q->row_array() : array();    
        }
        
        }
        private function 
    get_partner_id(){
            
    $q $this->db->get_where($this->part_tabel, array("user_id"=>$this->ion_auth->user()->row()->id));
            if(
    $q->num_rows() > 0)
                return 
    $q->row()->id;
            else
                return 
    false;    
        }
        public function 
    index()
        {
            
    $this->load->view("members");
        }
        
        function 
    retrive(){
         
             
    $this->db->select("(TO_DAYS(date) + duration) - TO_DAYS(NOW())  as days_left");
            
    $this->db->select("subscribers.id, subscribers.name,subscribers.amount_left, proxy,subscribers.username,subscribers.date,subscribers.duration,subscribers.end_date,subscribers.amount,subscribers.chat,subscribers.mobile,subscribers.created,subscribers.payment,subscribers.type,subscribers.status,subscribers.server_id,subscribers.namo");
            
            if(
    $this->input->post("fields")){
                
    $fields json_decode($this->input->post("fields"),true);            
                foreach(
    $fields as $field){
                    
    $this->db->or_like("subscribers.".$field,$this->input->post("query"));
                }
            }
            
                

            
    $this->db->join('partners''partners.id = subscribers.partner_id',"left");
            if(!empty(
    $this->user))
                
    $this->db->where("partner_id"$this->user);
            else
                
    $this->db->where("0"1false);
            
    $q $this->db->get($this->table);        
            
    $total $q->num_rows();
            
    $q->free_result();
            
                
                
    $this->db->select("subscribers.id, subscribers.name,amount_left,subscribers.proxy, subscribers.username,subscribers.date,subscribers.duration,subscribers.end_date,subscribers.amount,subscribers.chat,subscribers.mobile,subscribers.created,subscribers.payment,subscribers.type,subscribers.status, subscribers.server_id,subscribers.namo");
                
    $this->db->select("CONCAT('C: ',servers.url,' ',servers.listen_port,' ',subscribers.username,' ',subscribers.password) as cline"FALSE);
                 
    $this->db->select("(TO_DAYS(date) + duration) - TO_DAYS(NOW())  as days_left");
                 
    $this->db->join('servers''servers.id = subscribers.server_id',"left");
                
            if(!empty(
    $this->user))
                
    $this->db->where("partner_id"$this->user);
            else
                
    $this->db->where("0"1false);
            
            if(
    $this->input->post("fields")){
                
    $fields json_decode($this->input->post("fields"),true);
                        
                foreach(
    $fields as $field){
                    
    $this->db->or_like($field,$this->input->post("query"));
                }
            }        
            
            
            
            if(
    $this->input->post("sort")){
                
    $this->db->order_by($this->input->post("sort"),$this->input->post("dir"));            
            }else{        
                
    $this->db->order_by("subscribers.status","ASC");
                
    $this->db->order_by("subscribers.created","DESC");
            }
                
            if(
    $this->input->post("start"))
                
    $this->db->limit($this->input->post("limit"), $this->input->post("start"));
            else
                
    $this->db->limit(100);
            
    $this->db->where("subscribers.partner_id !=",1);

            
    $q $this->db->get($this->table);     
        
    //    print($this->db->last_query());
            
    if($q->num_rows() > 0){
                
    $this->data $q->result_array();
            }
            
    $this->to_json(array("total"=>$total));
        }
        function 
    to_json($params false){
            
    $properties = array(
                
    "success"=>$this->success,
                
    "message"=>$this->message,
                
    "data"   =>$this->data
            
    );
            if(
    is_array($params)){
                foreach(
    $params as $key=>$val)
                
    $properties[$key] = $val;
            }
            echo 
    json_encode($properties);
        }
        
        function 
    download(){            
            
    $this->load->library('zip');        
            
    $users $this->input->get('users');
            
    $users explode(":",$users);
            
    $this->db->select("subscribers.username");        
            
    $this->db->select("CONCAT('C: ',servers.url,' ',servers.listen_port,' ',subscribers.username,' ',subscribers.password) as cline"FALSE);
            
    $this->db->join('servers''servers.id = subscribers.server_id',"left");
            
    $this->db->where_in("subscribers.id"$users);
            
    $q $this->db->get($this->table);
            
            if(
    $q->num_rows() > 0){
                foreach(
    $q->result() as $row){
                    
    $name $row->username.""    ;
                    
    $this->zip->add_data($name$row->cline);
                }
            }
            
            
    $this->zip->download("abonnements-".date("d-m-Y").".zip");
        }

    }

Check out some similar questions!

When I enter w on my keyboard it gives me /sw also backspace not operating correctly [ 0 Answers ]

When I enter w on my keyboard it gives me /sw also backspace not operating correctly

How can I tell if bug bites are parasites from within my body or bug buts found home? [ 2 Answers ]

I am finding EVERYWHERE what looks like a piece of tobacco (under magnifying glass, definitely not tobacco). Small sliver-like brown (they look like tiny cigars) pieces of what can only be described as burnt ground beef or coffee grounds everywhere. Also, my cat has ear mites and is being...

When I hit the enter,backspace,or spacebar my keyboard types random things [ 3 Answers ]

All keys type fine. Until I hit the spacebar and it types random letters & characters. The backspace key does the same or takes me out of where I am working. This happened before and then just fixed itself. In the meantime very frustrating. I have run scans to find nothing. Any ideas?

When I press backspace system gets shutdown can you help me? [ 0 Answers ]

When I press backspace system goes down. I am using window xp 64bit. I think it happened because of virus then I format the system but there is no effect.

Anyone know what bug this is? [ 6 Answers ]

I don't know what this type of green metallic beetle is at my house and I want to know what its called and its habitat and all that stuff. I live in Britain so its not one of those beetles that live in America or Mexico. I find a lot of them on docking leaves. Any ideas?? ;)


View more questions Search
 

Question Tools Search this Question
Search this Question:

Advanced Search

Add your answer here.