403Webshell
Server IP : 103.234.187.230  /  Your IP : 216.73.216.216
Web Server : Apache
System : Linux lserver42043-ind.megavelocity.net 3.10.0-1160.108.1.el7.x86_64 #1 SMP Thu Jan 25 16:17:31 UTC 2024 x86_64
User : apache ( 48)
PHP Version : 7.4.33
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : ON
Directory :  /var/www/html/adeetie_hellogtx/application/models/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/html/adeetie_hellogtx/application/models/Mfc.php
<?php defined('BASEPATH') OR exit('No direct script access allowed');

class Mfc extends CI_Model{

    private $tableName = "facilation_users";

    function usermodel() {
        return array(
             'name'          => $this->input->post('name'),
             'email_id'      => $this->input->post('email_id'),
             'user_type'     => $this->input->post('user_type'),
             'designation'     => $this->input->post('designation'),
         );
     }
     
     function add_user(){        
    
         $arr = $this->usermodel();
         if(!empty($this->input->post('password'))) {
            $arr['password'] = password_hash($this->input->post('password'), PASSWORD_DEFAULT);
         }

         $arr['status'] = 1;
    
 
         $arr['user_id'] = uniqid();
         $arr['created_by'] = json_encode([
             'email_id' => $this->session->userdata('email_id'),
             'name' => $this->session->userdata('name'),
             'user_type' => $this->session->userdata('user_type'),
             'user_id' => $this->session->userdata('user_id')
         ]);
 
         $this->db->insert($this->tableName, $arr);
         if( $this->db->affected_rows() > 0 ) {
             $id = $this->db->insert_id();
             $this->session->set_flashdata('message','Successfully added');
             redirect('console/users', 'refresh');
 
         } else {
            $this->session->set_flashdata('error','Unknown error'); 
            redirect('console/users', 'refresh');
         }
         
     }
     
     
      function update_user($id) {
         
         $arr = $this->usermodel();
         if(!empty($this->input->post('password'))) {
             $arr['password'] = password_hash($this->input->post('password'), PASSWORD_DEFAULT);
         }

         $arr['update_by'] = json_encode([
            'email_id' => $this->session->userdata('email_id'),
            'name' => $this->session->userdata('name'),
            'user_type' => $this->session->userdata('user_type'),
            'user_id' => $this->session->userdata('user_id')
        ]);
 
         $this->db->where('user_id', $id);
         $this->db->update( $this->tableName, $arr );
          
         if( $this->db->affected_rows() > 0 ) {
             $this->session->set_flashdata( 'message','Successfully Updated' );
             redirect('console/users', 'refresh');
         } else {
            $this->session->set_flashdata('error','Updation failed'); 
            redirect('console/users', 'refresh');
         } 
     }



     function delete_user($id) {

        $arr['status'] = 0;
        $arr['update_by'] = json_encode([
           'email_id' => $this->session->userdata('email_id'),
           'name' => $this->session->userdata('name'),
           'user_type' => $this->session->userdata('user_type'),
           'user_id' => $this->session->userdata('user_id')
       ]);

        $this->db->where('user_id', $id);
        $this->db->update( $this->tableName, $arr );
         
        if( $this->db->affected_rows() > 0 ) {
            $this->session->set_flashdata( 'message','Successfully Delete' );
            redirect('fc/users', 'refresh');
        } else {
           $this->session->set_flashdata('error','Deletion failed'); 
           redirect('fc/users', 'refresh');
        } 
     }

    function get_all_workshop($limit, $offset) {
        $query = $this->db->select("tcb_trainings.*")
                ->from('tcb_trainings')
                ->order_by('training_date', 'DESC')
                ->limit($limit, $offset)
                ->get();
                if ( $query->num_rows() > 0) {
                    return $query->result_array();
                }
    }

    function get_total_workshop() {
        $query = $this->db->select("tcb_trainings.id")
                ->from('tcb_trainings')
                ->order_by('training_date', 'DESC')
                ->get();
                return $query->num_rows();
    }


    function get_workshop_participants($workshopid = '') {
        $query = $this->db->select("workshop_participants.*")
        ->from('workshop_participants')
        ->where('workshop_id', $workshopid)
        ->get();
        if ( $query->num_rows() > 0) {
            return $query->result_array();
        }
    }

    function get_total_workshop_participants($limit, $offset, $workshopid = '') {
        $query = $this->db->select("workshop_participants.id")
        ->from('workshop_participants')
        ->limit($limit, $offset)
        ->where('workshop_id', $workshopid)
        ->get();
        return $query->num_rows();
    }

    function get_all_user() {
        $this->db->where('status', 1);
        $query = $this->db->get('facilation_users');
        if ( $query->num_rows() > 0) {
            return $query->result_array();
        }
    }

    function get_user_byid($id) {
        $this->db->where('status', 1);
        $this->db->where('user_id', $id);
        $query = $this->db->get('facilation_users');
        return $query->row_array();
    }

}

Youez - 2016 - github.com/yon3zu
LinuXploit