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.197.231
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/Teacher.php
<?php
/*********************
 *********************
 Indian Controller : "Teacher_old_old.php"
 Indian Template : "teacher_old_old.php"
 controller fix 9 may 2019
 Aernout Guillaume
 http://Codes.Solutions
 *********************
 *********************/


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

  	 class Teacher extends NS_Controller {
       function __construct() {
        parent::__construct(array('no_cache'=>1));

         $this->load->helper('generator');
         $this->load->model('users_model');
         $this->load->model('email_model');
         $this->load->model('address_model');
         $this->load->model('profile_model');
         $this->load->database();
      }
      ////////////////////////
      // Fonction controller
      ////////////////////////
      function index() {
        $this->continueIfAllowed(array('allowed'=>array('admin','teacher')));
        $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{
          //no param
        }
        $data['page_name'] = 'teacher';
        $data['language'] = $this->profile_model->language();
        $data['page_title'] = get_phrase('teacher');
        $data['teacher_list'] = $this->crud_model->get_teachers();
        $this->load->view('backend/index', $data);
      }
      function getTeacher(){
        $this->continueIfAllowed(array('allowed'=>array('admin','teacher')));
        $id = $this->input->post('id');
        $teacher = $this->crud_model->get_teacher_info($id);
        $teacherLang = $this->crud_model->get_teacher_lang($id);
        $user = $this->crud_model->get_user_info($id);
        $address = $this->crud_model->get_user_address($teacher[0]['address_id']);

        $jsonLang  = "{";
          foreach ($teacherLang as $key => $row) {
            $teacherLan = $this->crud_model->get_language_name($row['course_language_id']);
            if($teacherLan ==""){
              $courseName = "db conflict";
            }
            $jsonLang = $jsonLang . "\"". $key ."\":{\"lanId\":\"".$row['course_language_id']."\",\"lanName\":\"".$teacherLan."\"},";
          }
          $jsonLang = rtrim($jsonLang,',') ."}";

        $jsonData = "{ \"user_id\":\"".$id."\",\"address_id\":\"".$teacher[0]['address_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\" : \"".str_replace(array("\n", "\r"), '', $teacher[0]['admin_comment'])."\",\"ispaid\" : \"".$teacher[0]['is_paid']."\",\"lan\" : ".$jsonLang.",\"dob\" : \"".$teacher[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 showLessons(){
        $this->continueIfAllowed(array('allowed'=>array('admin')));
        $id = $this->input->post('id');

        $query = $this->db->get_where('course_teacher', array('teacher_id' => $id));
        $query = $query->result_array();

        $jsonSchedule = "{";
        foreach ($query as $key => $row) {
          $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']."\",\"lessonInfo\":\"".$this->crud_model->get_lesson_info($row['lesson_id'])."\",\"teacherId\":\"".$id."\",\"teacherName\":\"".$this->crud_model->get_teacher_name($id)."\",\"statusId\":\"".$row['status_id']."\"},";
        }
        $jsonSchedule = rtrim($jsonSchedule,',') ."}";
        echo $jsonSchedule;
        return true;
      }

      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','language','rate','send_param','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");}
          //echo($data['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");}

          $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'],'2',$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_teacher($userId,$addressId,$data['comment'],$data['rate'],$dob);
              //language qualif
              $lanList = $data['language'];

              $arrlength = count($lanList);
              for($x = 0; $x < $arrlength; $x++) {
                  $this->users_model->create_teacher_lang($userId,$lanList[$x]);
              }
              echo "1";

              if($data['send_param'] == "true"){
                  $name = $data['name1']." ". $data['name2'];
                  $lang = $this->crud_model->get_user_lang($userId);
                  $isoLang = $this->profile_model->intToIso($lang);
                  //var_dump($isoLang."+".$lang."+".$name);
                  $this->email_model->account_opening_email($isoLang,"teacher",$name,$data['email'],$data['pass'],$userId);
              }
            }
            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','rate','language','send_param','lang','pattern_param'));
            $error = array();
            //var_dump($data);
            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->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");}

            $error = array_filter($error);

            if (empty($error)){
                //update user + teacher + 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_teacher($data['user_id'],$data['comment'],$dob,$data['rate']);

                $lanList = $data['language'];
                //var_dump($lanList);
                $arrlength = count($lanList);
                $this->users_model->clean_teacher_lang($data['user_id']);

                for($x = 0; $x < $arrlength; $x++) {
                  //echo "--->".$lanList[$x];
                  $this->users_model->update_teacher_lang($data['user_id'],$lanList[$x]);
                }
                //var_dump($userId);

                if($data['send_param'] == "true"){
                    $name = $data['name1']." ". $data['name2'];
                    $lang = $this->crud_model->get_user_lang($data['user_id']);
                    $isoLang = $this->profile_model->intToIso($lang);
                    if($data['pattern_param']=="notif"){
                      $this->email_model->password_notification_email($isoLang,$data['pass'],$name,$data['email'],$data['user_id']);
                    }
                    else if($data['pattern_param'] == "opening"){
                      $this->email_model->account_opening_email($isoLang,'teacher',$name,$data['email'],$data['pass'],$data['user_id']);
                    }
                    else{}

                }

                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']) && isset($data['addressId'])){
     				 $this->db->delete('teacher',array('teacher_id' => $data['userId']));
             $this->db->delete('user',array('user_id' => $data['userId']));
             $this->db->delete('address',array('address_id' => $data['addressId']));
             $this->db->delete('course_teacher',array('teacher_id'=>$data['userId']));
             $this->db->delete('teacher_course_language',array('teacher_id' => $data['userId']));
             echo "1";
     			 }
         }

        /*function resend_opening_notif(){
          $id = $this->input->post(array('id');
          $name = $this->crud_model->get_student_name($id);
          $lang = $this->crud_model->get_user_lang($id);
          $isoLang = $this->profile_model->intToIso($lang);
          $this->email_model->password_notification_email($isoLang,$data['pass'],$name,$data['email']);
        }*/

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

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

                 $sql = array(
                   'course_id' => "$courseId",
                   'lesson_id' => "$lessonId",
                   'teacher_id' => "$teacherId"
                 );
                 $this->db->insert('course_teacher',$sql);
                 echo "assigned $lessonId";
               return true;
           }
           else{return false; }
      }

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

        $sql = array(
          'lesson_id' => "$il",
          'course_id' => "$ic",
          'teacher_id' => "$is");
          //var_dump($sql);
          $this->db->delete('course_teacher',$sql);
          echo "1";
          return true;
      }
      function presence(){
        $this->continueIfAllowed(array('allowed'=>array('admin')));
        $data = $this->input->post(array('teacherId','courseId','lessonId','lessonStatut'));
        $studentId = $data['teacherId'];$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('teacher_id', $studentId);
          $this->db->update('course_teacher');
          echo "1";
      }
    }
?>

Youez - 2016 - github.com/yon3zu
LinuXploit