AnonSec Shell
Server IP : 162.214.74.102  /  Your IP : 216.73.216.139
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/www/lrsys_projetos/sopizzas/application/controllers/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME ]     

Current File : /home/lrsys/www/lrsys_projetos/sopizzas/application/controllers/rewardmanagement.php
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
session_start(); //we need to call PHP's session object to access it through CI
class RewardManagement extends MY_Controller {

    function __construct()
    {
        parent::__construct();
        $this->load->helper("url");
        $this->load->helper('form');
        $this->load->library('form_validation');
        $this->load->library('javascript');
        $this->load->library('Ajax_pagination');
        $this->perPage = ROW_PER_PAGE;
        $this->load->model('reward_model');
        $session_data = $this->session->userdata('logged_in');
        //if(empty($session_data)) { redirect('superadmin', 'refresh'); }
        if($this->session->userdata('user_language'))
        {
            $language = $this->session->userdata('user_language');
        }
        else
        {
            $language = $this->config->item("language");
        }
        $data['user_language'] =  $language;
        $this->lang->load('superAdmin', $language);
    }

    function index( $offset = 0 )
    {
        if ($this->input->server('REQUEST_METHOD') == 'POST')
        {
            if ($this->input->post('EditId') == '' && $this->input->post('AddEdit')) {
                $this->addReward();
            }
            else if($this->input->post('EditId') != '' && $this->input->post('AddEdit')) {
                $this->editReward();
            }
            if($this->input->post('ActionTab')=='SiteInfo')
            {
                $this->websettings_site();
            }

            if($this->input->post('ActionTab')=='SiteContact')
            {
                $this->websettings_contact();
            }

            if($this->input->post('ActionTab')=='SiteVAT')
            {
                $this->websettings_VAT();
            }
            if($this->input->post('ActionTab')=='SiteOffline')
            {
                $this->websettings_Offline();
            }
            if($this->input->post('ActionTab')=='SiteTwilio')
            {
                $this->websettings_Twilio();
            }
            if($this->input->post('ActionTab')=='SiteDocusign')
            {
                $this->websettings_DocuSign();
            }
        }else
        {
            $this->showRewardList();
        }
    }
    function managepartner( $offset = 0 )
    {
        if ($this->input->server('REQUEST_METHOD') == 'POST')
        {
            if ($this->input->post('EditId') == '' && $this->input->post('AddEdit')) {
                $this->addPartner();
            }
            else if($this->input->post('EditId') != '' && $this->input->post('AddEdit')) {
                $this->editPartner();
            }
        }else
        {
            $this->showPartnerList();
        }
    }

    function showRewardList() {
        $SearchBy = '';
        $PerPage = $this->input->post('Per_Page');
        if(!$PerPage){
            $PerPage = $this->perPage;
        }else{
            $PerPage = $PerPage;
        }
        //total rows count
        $totalRec = count($this->reward_model->get_rewards_list());
        //pagination configuration
        $config['target']      = '#postList';
        $config['base_url']    = base_url().'rewardmanagement/ajaxPaginationDataReward/'.$SearchBy;
        $config['total_rows']  = $totalRec;
        $config['per_page']    = $PerPage;
        $this->ajax_pagination->initialize($config);
        //get the posts data
        $data['RewardList'] = $this->reward_model->get_rewards_list(array('limit'=>$PerPage), $SearchBy);

        $query['OfferTotal'] =$this->reward_model->RewardsStatistics($status='');
        $query['OfferActive'] =$this->reward_model->RewardsStatistics($status='1');
        $query['OfferInactive'] =$this->reward_model->RewardsStatistics($status='0');
        $query['RestaurantList'] = $this ->reward_model -> RewardPartnerList();
        $data['title']="Reward List";
        $query['SiteTab'] ='reward_list';
        $data['page']="reward_list";
        $this->load->view('superadmin/header',$data);
        $this->load->view('superadmin/main-sidebar');
        $this->load->view('superadmin/reward_list',$query);
        $this->load->view('superadmin/footer');
    }
    function showPartnerList() {
        $SearchBy = '';
        $PerPage = $this->input->post('Per_Page');
        if(!$PerPage){
            $PerPage = $this->perPage;
        }else{
            $PerPage = $PerPage;
        }
        //total rows count
        $totalRec = count($this->reward_model->get_partner_list());
        //pagination configuration
        $config['target']      = '#postList';
        $config['base_url']    = base_url().'rewardmanagement/ajaxPaginationDataPartner/'.$SearchBy;
        $config['total_rows']  = $totalRec;
        $config['per_page']    = $PerPage;
        $this->ajax_pagination->initialize($config);
        //get the posts data
        $data['RewardList'] = $this->reward_model->get_partner_list(array('limit'=>$PerPage), $SearchBy);

        $query['OfferTotal'] =$this->reward_model->PartnerStatistics($status='');
        $query['OfferActive'] =$this->reward_model->PartnerStatistics($status='1');
        $query['OfferInactive'] =$this->reward_model->PartnerStatistics($status='0');
        $query['RestaurantList'] = $this ->reward_model -> RewardPartnerList();
        $data['title']="Partner List";
        $query['SiteTab'] ='partner_list';
        $data['page']="partner_list";

        $this->load->view('superadmin/header',$data);
        $this->load->view('superadmin/main-sidebar');
        //echo "Partner LIst Page";
        $this->load->view('superadmin/partner_list_manage',$query);
        $this->load->view('superadmin/footer');
    }

    function ajaxPaginationDataReward(){
        $page = $this->input->post('page');
        if(!$page){
            $offset = 0;
        }else{
            $offset = $page;
        }

        $action = $this->input->post('action');
        /*if(!$action){
            $action = '';
        }else{
            $action = $action;
        }*/
        $perpage = $this->input->post('per_page');
        if(!$perpage){
            $perpage = $this->perPage;
        }else{
            $perpage = $perpage;
        }

        $action2 = $this->input->post('action2');
        if(!$action2){
            $action2 = '0';
        }else{
            $action2 = $action2;
        }

        //total rows count
        $totalRec = count($this->reward_model->get_rewards_list($params = array(), $action,$action2));

        //pagination configuration
        $config['target']      = '#postList';
        $config['base_url']    = base_url().'rewardmanagement/ajaxPaginationDataReward';
        $config['total_rows']  = $totalRec;
        $config['per_page']    = $perpage;
        $config['action']      = $action;
        $config['action2']     = $action2;
        $this->ajax_pagination->initialize($config);

        //get the posts data
        $data['RewardList'] = $this->reward_model->get_rewards_list(array('start'=>$offset,'limit'=>$perpage),$action,$action2);
        $data['title']="Reward List";
        $query['SiteTab'] ='reward_list';
        $data['page']="reward_list";
        $data['perPageCount'] = $page;
        /*** Remember what was the last page start ***/
        if ($this->input->post('pagination') != '') {
            $myPage = $this->input->post('page');
            $myAction = $this->input->post('action');
            $myPerPage = $this->input->post('per_page');
            $myAction2 = $this->input->post('action2');
            $paginationArray = array('page' => $myPage, 'action' => $myAction, 'per_page' => $myPerPage, 'action2' => $myAction2, 'page_name' => $data['page'], 'pagination' => $this->input->post('pagination'));
            if ($this->session->userdata('paginationArray')) {
                $this->session->unset_userdata('paginationArray');
            }
            $this->session->set_userdata('paginationArray', $paginationArray);
        }
        /*** Remember what was the last page end ***/
        $this->load->view('superadmin/reward_list_ajax', $data, false);
    }
    function ajaxPaginationDataPartner(){
        $page = $this->input->post('page');
        if(!$page){
            $offset = 0;
        }else{
            $offset = $page;
        }

        $action = $this->input->post('action');
        /*if(!$action){
            $action = '';
        }else{
            $action = $action;
        }*/
        $perpage = $this->input->post('per_page');
        if(!$perpage){
            $perpage = $this->perPage;
        }else{
            $perpage = $perpage;
        }

        $action2 = $this->input->post('action2');
        if(!$action2){
            $action2 = '0';
        }else{
            $action2 = $action2;
        }

        //total rows count
        $totalRec = count($this->reward_model->get_partner_list($params = array(), $action,$action2));

        //pagination configuration
        $config['target']      = '#postList';
        $config['base_url']    = base_url().'rewardmanagement/ajaxPaginationDataPartner';
        $config['total_rows']  = $totalRec;
        $config['per_page']    = $perpage;
        $config['action']      = $action;
        $config['action2']     = $action2;
        $this->ajax_pagination->initialize($config);

        //get the posts data
        $data['RewardList'] = $this->reward_model->get_partner_list(array('start'=>$offset,'limit'=>$perpage),$action,$action2);
        $data['title']="Reward List";
        $query['SiteTab'] ='reward_list';
        $data['page']="reward_list";
        $data['perPageCount'] = $page;
        /*** Remember what was the last page start ***/
        if ($this->input->post('pagination') != '') {
            $myPage = $this->input->post('page');
            $myAction = $this->input->post('action');
            $myPerPage = $this->input->post('per_page');
            $myAction2 = $this->input->post('action2');
            $paginationArray = array('page' => $myPage, 'action' => $myAction, 'per_page' => $myPerPage, 'action2' => $myAction2, 'page_name' => $data['page'], 'pagination' => $this->input->post('pagination'));
            if ($this->session->userdata('paginationArray')) {
                $this->session->unset_userdata('paginationArray');
            }
            $this->session->set_userdata('paginationArray', $paginationArray);
        }
        /*** Remember what was the last page end ***/
        $this->load->view('superadmin/partner_list_ajax', $data, false);
    }

    function addReward() {
        $now = date('Y-m-d H:i:s');
        $this->form_validation->set_rules('redemption_code', 'Reward Code', 'trim|required|xss_clean|callback_isRewardExist');
        $this->form_validation->set_message('is_unique', 'Reward Code already exist');
        //$this->form_validation->set_rules('offer_valid_from');
        //$this->form_validation->set_rules('offer_valid_to');
        $this->form_validation->set_rules('redemption_amount');
        $this->form_validation->set_rules('redemption_point');
        $this->form_validation->set_rules('partner_id');

        if ($this->form_validation->run() == FALSE) {
            $this->showRewardList();
        }

        else {
            /*$date1 = str_replace('/', '-', $this->input->post('offer_valid_from'));
            $date_array = explode('-', $date1);
            $date1 = $date_array[1]."-".$date_array[0]."-".$date_array[2];
            $offer_valid_from  = date("Y-m-d", strtotime($date1));

            $date1 = str_replace('/', '-', $this->input->post('offer_valid_to'));
            $date_array = explode('-', $date1);
            $date1 = $date_array[1]."-".$date_array[0]."-".$date_array[2];
            $offer_valid_to  = date("Y-m-d", strtotime($date1));*/


            $data_in = array(
                'partner_id'       =>  $this->input->post('partner_id'),
                'redemption_amount'    =>  $this->input->post('redemption_amount'),
                'redemption_point'         =>  $this->input->post('redemption_point'),
                'addeddate'           =>  $now,
                'redemption_code'         =>  $this->input->post('redemption_code')
            );

            $this->db->trans_start();
            $this->db->insert('rt_rewards', $data_in);
            $this->db->trans_complete();
            $this->session->set_flashdata('success_msg', 'Reward successfully saved');
            redirect('superadmin/reward');
        }
    }

    function editReward() {
        $now = date('Y-m-d H:i:s');
        $EditId = $this->input->post('EditId');
        $this->form_validation->set_rules('redemption_code', 'Reward Code', 'trim|required|xss_clean|callback_isRewardExist');
        $this->form_validation->set_message('is_unique', 'Reward Code already exist');
        $this->form_validation->set_rules('redemption_amount');
        $this->form_validation->set_rules('redemption_point');
        $this->form_validation->set_rules('partner_id');

        if ($this->form_validation->run() == FALSE) {
            $this->showRewardList();
        }
        else {
            $data_up = array(
                'partner_id'       =>  $this->input->post('partner_id'),
                'redemption_amount'    =>  $this->input->post('redemption_amount'),
                'redemption_point'         =>  $this->input->post('redemption_point'),
                'addeddate'           =>  $now,
                'redemption_code'         =>  $this->input->post('redemption_code')
            );

            $this->db->trans_start();
            $this->db->where('id', $EditId);
            $this->db->update('rt_rewards', $data_up);
            $this->db->trans_complete();
            $this->session->set_flashdata('success_msg', 'Reward successfully updated');
            redirect('superadmin/reward');
        }
    }

    function isRewardExist() {
        $redemption_code = $this->input->post('redemption_code');
        $partner_id = $this->input->post('partner_id');
        $id = $this->input->post('EditId');
        $is_exist = $this->reward_model->isRewardExist($id, $redemption_code, $partner_id);
        if ($is_exist) {
            $this->form_validation->set_message('isRewardExist', 'Reward Code already exist');
            return false;
        }
        else {
            return true;
        }
    }
    function addPartner() {
        $now = date('Y-m-d H:i:s');
        $this->form_validation->set_rules('partner_name', 'Partner Name', 'trim|required|xss_clean|callback_isRewardExist');
        $this->form_validation->set_message('is_unique', 'Partner Name already exist');

        if ($this->form_validation->run() == FALSE) {
            $this->showRewardList();
        }

        else {
            $data_in = array(
                'addeddate'           =>  $now,
                'partner_name'         =>  $this->input->post('partner_name')
            );

            $this->db->trans_start();
            $this->db->insert('rt_reward_partner', $data_in);
            $this->db->trans_complete();
            $this->session->set_flashdata('success_msg', 'Partner Name successfully saved');
            redirect('superadmin/rewardpartners');
        }
    }

    function editPartner() {
        $now = date('Y-m-d H:i:s');
        $EditId = $this->input->post('EditId');
        $this->form_validation->set_rules('partner_name', 'Partner Name', 'trim|required|xss_clean|callback_isRewardExist');
        $this->form_validation->set_message('is_unique', 'Partner Name already exist');

        if ($this->form_validation->run() == FALSE) {
            $this->showRewardList();
        }
        else {
            $data_up = array(
                'addeddate'           =>  $now,
                'partner_name'         =>  $this->input->post('partner_name')
            );

            $this->db->trans_start();
            $this->db->where('id', $EditId);
            $this->db->update('rt_reward_partner', $data_up);
            $this->db->trans_complete();
            $this->session->set_flashdata('success_msg', 'Partner Name successfully updated');
            redirect('superadmin/rewardpartners');
        }
    }

    function isPartnerNameExist() {
        $partner_name = $this->input->post('partner_name');
        $id = $this->input->post('EditId');
        $is_exist = $this->reward_model->isPartnerNameExist($id, $partner_name);
        if ($is_exist) {
            $this->form_validation->set_message('isRewardExist', 'Partner Name already exist');
            return false;
        }
        else {
            return true;
        }
    }
}

Anon7 - 2022
AnonSec Team