Uname:Linux EDL-STRETCH 4.19.0-27-amd64 #1 SMP Debian 4.19.316-1 (2024-06-25) x86_64

403WebShell
403Webshell
Server IP : 188.114.97.2  /  Your IP : 104.23.243.200
Web Server : Apache/2.4.59 (Debian)
System : Linux EDL-STRETCH 4.19.0-27-amd64 #1 SMP Debian 4.19.316-1 (2024-06-25) x86_64
User : edlftp ( 1002)
PHP Version : 7.4.33
Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : ON
Directory :  /home/nicolasj/www/sms.formationlangues.be/application/models/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /home/nicolasj/www/sms.formationlangues.be/application/models/Payment_model.php
<?php
/*********************
 *********************

 Payment Model
 Creation 16 october 2019
 Aernout Guillaume
 http://Codes.Solutions

 *********************
 *********************/
if (!defined('BASEPATH')) {
    exit('No direct script access allowed');
}

class Payment_model extends CI_Model
{
    public function __construct()
    {
        parent::__construct(array('no_cache'=>1));
        $this->load->model('crud_model');
        $this->load->database();
    }

    public function payment_request($user, $amount, $comment)
    {
        $sql = array(
          'Student_ID' => $user,
          'Payment_amount' => $amount,
          'Method_ID' => '3',
          'Status' => '2',
          'Date' => date("Y-m-d"),
          'Comment' => $comment
        );
        $this->db->insert('wallet', $sql);
        $id = $this->db->insert_id();

        return array( "id" => $id, "request" => $this->hash_request($id, $user, $amount, $date));
    }

    public function get_payment($id)
    {
        $query = $this->db->get_where('wallet', array('ID'=>$id));
        $data = $query->result_array();
        foreach ($data as $row) {
            return $row;
        }
    }

    public function get_linked_payment($ref, $id)
    {
        $query = $this->db->get_where('wallet', array('Linked_ID'=>$ref,'Student_ID !='=>$id));
        $data = $query->result_array();
        $data_plus = array();
        foreach ($data as $key => $payment) {
            $data_current = $payment;

            $courses_json = json_decode($payment['Courses_id']);
            $course_list = array();
            foreach ($courses_json as $key => $course) {
                $course['debu2']= "debug";
                array_push($course_list, $course);
            }

            if($data_current['Linked_ID'] != null && $data_current['Linked_repartition'] != "") {
                $data_current['Payment_amount'] = ($data_current['Payment_amount']*$data_current['Linked_repartition'])/100;
            }
            $data_current['Courses_list'] = $course_list;
            array_push($data_plus, $data_current);
        }
        return $data_plus;
    }

    public function get_student_payment($id)
    {
        $query = $this->db->get_where('wallet', array('Student_ID'=>$id));
        $data = $query->result_array();
        $data_plus = array();
        foreach ($data as $key => $payment) {
            $data_current = $payment;

            $courses_json = json_decode($payment['Courses_id']);
            $course_list = array();
            foreach ($courses_json as $key => $course) {
                $course['debu2']= "debug";
                array_push($course_list, $course);
            }

            if($data_current['Linked_ID'] != null && $data_current['Linked_repartition'] != "") {
                $data_current['Payment_amount'] = ($data_current['Payment_amount']*$data_current['Linked_repartition'])/100;
            }
            $data_current['Courses_list'] = $course_list;
            array_push($data_plus, $data_current);
        }
        return $data_plus;
    }

    public function get_student_payment_count($id)
    {
        $query = $this->db->get_where('wallet', array('Student_ID'=>$id));
        $data = $query->result_array();
        return count($data);
    }

    public function get_student_discount($id)
    {
        $query = $this->db->get_where('discount', array('Student_ID'=>$id));
        $data = $query->result_array();
        return $data;
    }

    public function update_payment($id)
    {
        $this->db->set('Status', '1');
        $this->db->where('ID', $id);
        $this->db->update('wallet');

        $this->db->set('Status', '1');
        $this->db->where('Wallet_ID', $id);
        $this->db->update('invoices');
    }

    public function hash_request($id, $user, $amount, $date)
    {
        $toHash = "$id-$date@$user#$amount";
        return md5($toHash);
    }

    public function detect_society($studentId)
    {
        $courses = $this->crud_model->get_students_course($studentId);

        foreach ($courses as $course) {
            $data = $this->crud_model->get_course_info($course);
            //return $data;
            if($data[0]['CourseSociety'] == "0" || $data[0]['CourseSociety'] =="") {
                return "1";
            } else {
                return $data[0]['CourseSociety'];
            }
        }
        return "1";
    }

    public function detect_course($studentId)
    {
        $courses = $this->crud_model->get_students_course($studentId);

        foreach ($courses as $course) {
            $data = $this->crud_model->get_course_info($course);
            //return $data;
            return $data[0]['CourseName'];
        }
    }

    public function check_hash($id, $hash)
    {

        $query = $this->db->get_where('wallet', array('ID'=>$id));
        $data = $query->result_array();

        foreach ($data as $row) {
            $original_data = $row['ID']."-".$row['Date']."@".$row['Student_ID']."#".$row['Payment_amount'];
            $original_hash = md5($original_data);

            if($original_hash == $hash) {
                return true;
            } else {
                return false;
            }
        }
    }
    public function get_payment_user_date($user)
    {
        $this->db->order_by('ID', 'DESC');
        $query = $this->db->get_where('shop_transaction', array('User_ID'=>$user,'Payment_State'=>'succeeded'));
        $data = $query->result_array()[0];

        return substr($data['Payment_Date'], 0, 10);
    }
}

Youez - 2016 - github.com/yon3zu
LinuXploit