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.201
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/git/sms.edl.codes.solutions/application/controllers/BO/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /home/git/sms.edl.codes.solutions/application/controllers/BO/Student.php
<?php
/*********************
 *********************
 Indian Controller : "Student_old_old.php"
 Indian Template : "student_old.php"
 controller fix 23 april 2019
 Aernout Guillaume
 http://Codes.Solutions
 *********************
 *********************/

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

 	 class Student extends NS_Controller {
     //$session = "";

     function __construct() {
      parent::__construct(array('no_cache'=>1));

       $this->load->helper('generator');
       $this->load->model('users_model');
       $this->load->model('profile_model');
       $this->load->model('wallet_model');
       $this->load->model('address_model');
       $this->load->database();
    }
    ////////////////////////
    // Fonction controller
    ////////////////////////
    function index() {
      $this->continueIfAllowed(array('allowed'=>array('admin','teacher','parent')));
      $this->load->helper('url');
      $param = $this->uri->segment(3);
      if($param == "edit"){
        $data['edit'] = $this->uri->segment(4);
      }
      else if($param == "presence"){
        $data['presence'] = $this->uri->segment(4);
      }
      else if($param == "assign"){
        $data['assign'] = $this->uri->segment(4);
      }
      else{
        //no param
      }
      $data['language'] = $this->profile_model->language();
      $data['page_name'] = 'student';
      $data['page_title'] = get_phrase('student / group');
      $data['student_list'] = $this->crud_model->mix_student_group();//$this->crud_model->get_student_list();
      $this->load->view('backend/index', $data);
    }
    function getStudent(){
      $this->continueIfAllowed(array('allowed'=>array('admin','teacher','parent')));
      $id = $this->input->post('id');
      $user = $this->userInfo['user_id'];
      //var_dump($this->crud_model->is_child($user,$id));
      if(($this->userInfo['role'] == "parent" && $this->crud_model->is_child($user,$id))|| $this->userInfo['role'] != "parent"){
      $user = $this->crud_model->get_user_info($id);
        if($user[0]['role_id'] == '5'){
          $group = $this->crud_model->get_group_info($id);
          //$address = $this->crud_model->get_user_address($student[0]['residential_address_id']);
          $jsonData = "{ \"user_id\":\"".$id."\",\"email\" :\"".$user[0]['email']."\",\"lang\" :\"".$user[0]['lang']."\",\"firstName\" :\"".$user[0]['first_name']."\",\"lastName\" :\"".$user[0]['last_name']."\",\"phone\" :\"".$user[0]['phone']."\"";
          $jsonData = $jsonData .",\"comment\" : \"".preg_replace('/\R/', '', $group[0]['admin_comment'])."\",\"ispaid\" : \"".$group[0]['is_paid']."\",\"dob\" : \"".$group[0]['dob']."\"";
          $jsonData = $jsonData .",\"size\" : \"".$group[0]['number']."\"}";
          echo $jsonData;
        }
        else{
        $student = $this->crud_model->get_student_info($id);
        $address = $this->crud_model->get_user_address($student[0]['residential_address_id']);
        $jsonData = "{ \"user_id\":\"".$id."\",\"address_id\":\"".$student[0]['residential_address_id']."\",\"email\" :\"".$user[0]['email']."\",\"lang\" :\"".$user[0]['lang']."\",\"parent\" :\"".$student[0]['parent_id']."\",\"firstName\" :\"".$user[0]['first_name']."\",\"lastName\" :\"".$user[0]['last_name']."\",\"phone\" :\"".$user[0]['phone']."\"";
        $jsonData = $jsonData .",\"comment\" : \"".preg_replace('/\R/', '', $student[0]['admin_comment'])."\",\"ispaid\" : \"".$student[0]['is_paid']."\",\"dob\" : \"".date('d-m-Y', strtotime($student[0]['dob']))."\"";
        $jsonData = $jsonData .",\"line1\" : \"".$address[0]['line_1']."\",\"line2\" : \"".$address[0]['line_2']."\",\"state\" : \"".$address[0]['state']."\",\"location\" : \"".$address[0]['location']."\",\"postcode\" : \"".$address[0]['postcode']."\",\"country\" : \"".$address[0]['country']."\"}";
        echo $jsonData;
        }
      }

    }
    function getParent(){
      $this->continueIfAllowed(array('allowed'=>array('admin')));
      $id = $this->input->post('id');
      //$parentId = $this->crud_model->get_child_parent($id);
      $parent = $this->crud_model->get_parent_info($id);
      $user = $this->crud_model->get_user_info($id);
      $address = $this->crud_model->get_user_address($parent[0]['residential_address_id']);
      $jsonData = "{ \"user_id\":\"".$id."\",\"address_id\":\"".$parent[0]['residential_address_id']."\",\"email\" :\"".$user[0]['email']."\",\"lang\" :\"".$user[0]['lang']."\",\"parent\" :\"".$parent[0]['parent_id']."\",\"firstName\" :\"".$user[0]['first_name']."\",\"lastName\" :\"".$user[0]['last_name']."\",\"phone\" :\"".$user[0]['phone']."\"";
      $jsonData = $jsonData .",\"comment\" : \"".$parent[0]['admin_comment']."\",\"ispaid\" : \"".$parent[0]['is_paid']."\",\"dob\" : \"".date('d-m-Y', strtotime($parent[0]['dob']))."\"";
      $jsonData = $jsonData .",\"line1\" : \"".$address[0]['line_1']."\",\"line2\" : \"".$address[0]['line_2']."\",\"state\" : \"".$address[0]['state']."\",\"location\" : \"".$address[0]['location']."\",\"postcode\" : \"".$address[0]['postcode']."\",\"country\" : \"".$address[0]['country']."\"}";
      echo $jsonData;
    }
    function save(){
       $this->continueIfAllowed(array('allowed'=>array('admin')));
        $data = $this->input->post(array('email','pass','name1','name2','pic','phone','dob','line_1','line_2','country','state','location','postcode','comment','statut','parent','lang'));
        $error = array();

        if($this->users_model->check_email_format($data['email']) != TRUE || ($data['email'] == null || $data['email'] == "" )){ array_push($error,"Please enter a valid email");}
        if($this->users_model->email_exist($data['email']) == true){ array_push($error,"email already exist");}
        if($this->users_model->check_pass($data['pass']) != true || ($data['pass'] == null || $data['pass'] == "" )){ array_push($error,"Password should be at least 6 characters in length and should include at least one upper case letter, one number, and one special character");}
        if($this->users_model->check_name($data['name1']) != true || ($data['name1'] == null || $data['name1'] == "" )){ array_push($error,"Please enter a correct name");}
        if($this->users_model->check_name($data['name2']) != true || ($data['name2'] == null || $data['name2'] == "" )){ array_push($error,"Please enter a correct name");}
        if($this->users_model->check_phone($data['phone']) != true && ($data['phone'] != null || $data['phone'] != "" )){ array_push($error,"Please enter a correct phone number");}//|| ($data['phone'] == null || $data['phone'] == "" ))
        $dob = str_replace('/', '-', $data['dob']);
        $dob = date('Y-m-d', strtotime($dob));
        if($this->users_model->check_dob($dob) != true && ($data['dob'] != null || $data['dob'] != "" )){ array_push($error,"Please enter a correct date of birth");}
        //if($this->users_model->check_address($data['line_1'],$data['line_2'],$data['country'],$data['state'],$data['postcode']) != true){array_push($error,"Please enter a correct address");}

        //var_dump($data['line_1'].$data['line_2'].$data['country'].$data['state'].$data['postcode']);
        $error = array_filter($error);

        if (empty($error)){
            //create user and get the user_id
            $userId = $this->users_model->create_user($data['email'],$data['pass'],$data['name1'],$data['name2'],$data['phone'],'4',$data['lang']);
            $addressId = $this->users_model->create_user_address($data['line_1'],$data['line_2'],$data['country'],$data['state'],$data['location'],$data['postcode']);
            $this->users_model->create_student($userId,$addressId,$data['comment'],$dob,$data['parent']);
          //  var_dump($userId." ".$addressId." ".$data['comment']." ".$data['statut']." ".$dob." ".$data['parent']);
            echo "1";
          }
          else{
            var_dump($error);
          }

      }
      function saveGroup(){
         $this->continueIfAllowed(array('allowed'=>array('admin')));
          $data = $this->input->post(array('email','pass','name','age','size','comment','statut','phone','lang'));
          $error = array();

          if($this->users_model->check_email_format($data['email']) != TRUE || ($data['email'] == null || $data['email'] == "" )){ array_push($error,"Please enter a valid email");}
          if($this->users_model->email_exist($data['email']) == true){ array_push($error,"email already exist");}
          if($this->users_model->check_pass($data['pass']) != true || ($data['pass'] == null || $data['pass'] == "" )){ array_push($error,"Password should be at least 6 characters in length and should include at least one upper case letter, one number, and one special character");}
          if($this->users_model->check_name($data['name']) != true || ($data['name'] == null || $data['name'] == "" )){ array_push($error,"Please enter a correct name");}

          $dob = date('Y-m-d', strtotime($data['age'] . ' years ago'));

          //var_dump($data['line_1'].$data['line_2'].$data['country'].$data['state'].$data['postcode']);
          $error = array_filter($error);

          if (empty($error)){
              //create user and get the user_id
              $userId = $this->users_model->create_user($data['email'],$data['pass'],$data['name'],'[group]',$data['phone'],'5',$data['lang']);
              $this->users_model->create_group($userId,$addressId,$data['comment'],$data['statut'],$dob,$data['size']);
              //var_dump($userId);
              //var_dump($userId,$addressId,$data['comment'],$data['statut'],$dob,$data['size']);
              echo "1";
            }
            else{
              var_dump($error);
            }

        }
      function edit(){
          $this->continueIfAllowed(array('allowed'=>array('admin')));
          $data = $this->input->post(array('user_id','address_id','email','pass','name1','name2','pic','phone','dob','line_1','line_2','country','state','location','postcode','comment','statut','parent','lang'));
          $error = array();

          if($data['user_id'] == null || $data['user_id'] == "" ){ array_push($error,"Error on processing : no id");}
          if($data['address_id'] == null || $data['address_id'] == "" ){ array_push($error,"Error on processing : no address id");}

          if($this->users_model->check_email_format($data['email']) != TRUE || ($data['email'] == null || $data['email'] == "" )){ array_push($error,"Please enter a valid email");}
          //if($this->users_model->email_exist($data['email']) == true){ array_push($error,"email already exist");}
          //if($this->users_model->check_pass($data['pass']) != true || ($data['pass'] == null || $data['pass'] == "" )){ array_push($error,"Password should be at least 6 characters in length and should include at least one upper case letter, one number, and one special character");}
          if($this->users_model->check_name($data['name1']) != true || ($data['name1'] == null || $data['name1'] == "" )){ array_push($error,"Please enter a correct name");}
          if($this->users_model->check_name($data['name2']) != true || ($data['name2'] == null || $data['name2'] == "" )){ array_push($error,"Please enter a correct name");}
          if($this->users_model->check_phone($data['phone']) != true || ($data['phone'] == null || $data['phone'] == "" )){ array_push($error,"Please enter a correct phone number");}

          $dob = str_replace('/', '-', $data['dob']);
          $dob = date('Y-m-d', strtotime($dob));
          if($this->users_model->check_dob($dob) != true || ($data['dob'] == null || $data['dob'] == "" )){ array_push($error,"Please enter a correct date of birth");}
          //if($this->users_model->check_address($data['line_1'],$data['line_2'],$data['country'],$data['state'],$data['postcode']) != true){array_push($error,"Please enter a correct address");}

          //var_dump($data['line_1'].$data['line_2'].$data['country'].$data['state'].$data['postcode']);
          $error = array_filter($error);

          if (empty($error)){
              //update user + student + address
                if(!$this->users_model->update_user($data['user_id'],$data['email'],$data['pass'],$data['name1'],$data['name2'],$data['phone'],$data['lang'])){
                  echo "email already exit or sql crash";
                  return false;
                }
              $this->users_model->update_user_address($data['address_id'],$data['line_1'],$data['line_2'],$data['country'],$data['state'],$data['location'],$data['postcode']);
              $this->users_model->update_student($data['user_id'],$data['comment'],$dob,$data['parent']);
              //var_dump($userId);
              echo "1";
            }
            else{
              var_dump($error);
            }

        }
        function editGroup(){
            $this->continueIfAllowed(array('allowed'=>array('admin')));
            $data = $this->input->post(array('group_id','email','pass','name','phone','age','size','comment','statut','lang'));
            $error = array();

            if($data['group_id'] == null || $data['group_id'] == "" ){ array_push($error,"Error on processing : no id");}


            if($this->users_model->check_email_format($data['email']) != TRUE || ($data['email'] == null || $data['email'] == "" )){ array_push($error,"Please enter a valid email");}
            if($this->users_model->check_name($data['name']) != true || ($data['name'] == null || $data['name'] == "" )){ array_push($error,"Please enter a correct name");}

            $dob = date('Y-m-d', strtotime($data['age'] . ' years ago'));

            $error = array_filter($error);

              if (empty($error)){
                  $this->users_model->update_user($data['group_id'],$data['email'],$data['pass'],$data['name'],'[group]',$data['phone'],$data['lang']);
                  $this->users_model->update_group($data['group_id'],$data['comment'],$data['statut'],$dob,$data['size']);
                  //var_dump($userId);
                  echo "1";
                }
                else{
                  var_dump($error);
                }
          }

      function delete(){
        $this->continueIfAllowed(array('allowed'=>array('admin')));
        $data = $this->input->post(array('userId','addressId'));

        if(isset($data['userId'])){
 				 $this->db->delete('student',array('student_id' => $data['userId']));
         $this->db->delete('user',array('user_id' => $data['userId']));
         $this->db->delete('course_student_new',array('student_id'=>$data['userId']));
         echo "1";
 			 }
       //some address id are empty due to old conf
       if(isset($data['addressId'])){
          $this->db->delete('address',array('address_id' => $data['addressId']));
       }
      }

      function deleteGroup(){
        $this->continueIfAllowed(array('allowed'=>array('admin')));
        $id = $this->input->post('groupId');

        if(isset($id)){
 				 $this->db->delete('group',array('group_id' => $id));
         $this->db->delete('user',array('user_id' => $id));
         $this->db->delete('course_student_new',array('student_id'=>$id));
         echo "1";
 			 }
       //some address id are empty due to old conf
       /*if(isset($data['addressId'])){
          $this->db->delete('address',array('address_id' => $data['addressId']));
       }*/
      }

     function assign(){
       //keep in mind to avoid duplicate content :√
       $this->continueIfAllowed(array('allowed'=>array('admin')));
       $data = $this->input->post(array('studentId','courseId','lessonId'));
       $studentId = $data['studentId'];$courseId = $data['courseId'];$lessonId = $data['lessonId'];
       $assigned = $this->users_model->checkAssigned($studentId,$courseId,$lessonId);
       //var_dump($assigned);

       if(isset($studentId) && isset($courseId) && isset($lessonId) && ($assigned == 'false')){

           $sql = array(
             'course_id' => "$courseId",
             'lesson_id' => "$lessonId",
             'student_id' => "$studentId"
           );
           $this->db->insert('course_student_new',$sql);
           $this->form_model->remove_pending_s($studentId);
           //echo "assigned $lessonId";
           echo "1";
         return true;
     }
     else{return false; }
   }
   function presence(){
     $this->continueIfAllowed(array('allowed'=>array('admin','teacher')));
     $data = $this->input->post(array('studentId','courseId','lessonId','lessonStatut'));
     $studentId = $data['studentId'];$courseId = $data['courseId'];$lessonId = $data['lessonId'];$statut = $data['lessonStatut'];
      //echo var_dump($data);

       $this->db->set('status_id',$statut);
       $this->db->where('course_id', $courseId);
       $this->db->where('lesson_id', $lessonId);
       $this->db->where('student_id', $studentId);
       $this->db->update('course_student_new');
       echo "1";
   }
   function showLessons(){
     $this->continueIfAllowed(array('allowed'=>array('admin','teacher')));
     $id = $this->input->post('id');
     //$this->db->where('student_id',$id);

     $query = $this->db->get_where('course_student_new', array('student_id' => $id));
     $this->db->order_by('lesson_id', 'ASC');
     $query = $query->result_array();

     $jsonSchedule = "{";
     foreach ($query as $key => $row) {
         if($this->crud_model->check_teacher($row['course_id'],$this->userInfo['user_id'])|| $this->userInfo['role'] == "admin"){
         $courseName = $this->crud_model->get_course_name($row['course_id']);
         if($courseName ==""){
           $courseName = "db conflict";
         }
         $jsonSchedule = $jsonSchedule . "\"". $key ."\":{\"courseId\":\"".$row['course_id']."\",\"courseName\":\"".$courseName."\",\"lessonId\":\"".$row['lesson_id']."\",\"lessonName\":\"".$this->crud_model->get_lesson_info($row['lesson_id'])."\",\"studentId\":\"".$id."\",\"studentName\":\"".$this->crud_model->get_student_name($id)."\",\"statusId\":\"".$row['status_id']."\"},";
        }
     }
     $jsonSchedule = rtrim($jsonSchedule,',') ."}";
     echo $jsonSchedule;
     return true;
   }

   function removeAssign(){
     $this->continueIfAllowed(array('allowed'=>array('admin')));
     $data = $this->input->post(array('idLesson','idCourse','idStudent'));
     $il = $data['idLesson'];
     $ic = $data['idCourse'];
     $is = $data['idStudent'];

     $sql = array(
       'lesson_id' => "$il",
       'course_id' => "$ic",
       'student_id' => "$is");
       //var_dump($sql);
       //$this->db->where('course_id',$data['idCourse']);
       $this->db->delete('course_student_new',$sql);
       echo "1";
       return true;
   }
}

Youez - 2016 - github.com/yon3zu
LinuXploit