!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/esa/   drwxr-xr-x
Free 50.99 GB of 127.8 GB (39.89%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Feedback    Self remove    Logout    


Viewing file:     curpbri.php (43.36 KB)      -rwxr-xr-x
Select action/file-type:
(+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php
include("curriculum.php");
$file_name dirname(dirname(__FILE__)).'/version_client/ver_query.php';
if (
file_exists($file_name))
    include_once(
$file_name);
class 
Curpbri extends Curriculum {
    function 
cur_insert_update() {
        
$this->load->library('form_validation');
        
$this->form_validation->set_error_delimiters('<div class="error">','</div>');
        
$this->form_validation->set_rules('curImproveY',' ','trim|required|exact_length[4]|is_natural_no_zero|xss_clean');
        
$this->form_validation->set_rules('curName',' ','trim|required|xss_clean');
        
$this->form_validation->set_rules('curNameE',' ','trim|required|xss_clean');
        
$this->form_validation->set_rules('curAbbr',' ','trim|required|xss_clean');
        
$this->form_validation->set_rules('curAbbrE',' ','trim|required|xss_clean');
        
$this->form_validation->set_rules('curDescription',' ','trim|xss_clean');
        
$this->form_validation->set_rules('curDescriptionE',' ','trim|xss_clean');
        
$this->form_validation->set_rules('curMinCredit',' ','trim|required|is_natural_no_zero|xss_clean');
        
$this->form_validation->set_rules('curMinGPAX',' ','trim|required|numeric|xss_clean');
        
$this->form_validation->set_rules('curNumStudyY',' ','trim|required|is_natural_no_zero|xss_clean');
        
$this->form_validation->set_rules('curMaxStudyY',' ','trim|required|is_natural_no_zero|xss_clean');
        
$this->form_validation->set_rules('curNumTmPerY',' ','trim|required|is_natural_no_zero|xss_clean');
        
$this->form_validation->set_rules('curStatus',' ','trim|xss_clean');
        
$this->form_validation->set_rules('curCcId',' ','trim|required|xss_clean');
        
$this->form_validation->set_rules('curGtpId',' ','trim|required|xss_clean');
        
$this->form_validation->set_rules('curEdgId',' ','trim|required|xss_clean');
        
$this->form_validation->set_rules('curElvId',' ','trim|required|xss_clean');
        
        if(
$this->form_validation->run() == true) {
            
$this->db->trans_begin();
            
$this->load->model($this->config->item("rg_folder").'mo_rg_curriculum','cur');

            if (
class_exists('Ver_query')) {
                
Ver_query::setOldVal($this->cur$this->config->item('rg_dbname').'.rg_Curriculum');
            }

            
$this->cur->curId $this->input->post('curId');
            
$this->cur->curImproveY $this->input->post('curImproveY');
            
$this->cur->curName $this->input->post('curName');
            
$this->cur->curNameE $this->input->post('curNameE');
            
$this->cur->curAbbr $this->input->post('curAbbr');
            
$this->cur->curAbbrE $this->input->post('curAbbrE');
            
$this->cur->curDescription $this->input->post('curDescription');
            
$this->cur->curDescriptionE $this->input->post('curDescriptionE');
            
$this->cur->curMinCredit $this->input->post('curMinCredit');
            
$this->cur->curMinGPAX $this->input->post('curMinGPAX');
            
$this->cur->curNumStudyY $this->input->post('curNumStudyY');
            
$this->cur->curMaxStudyY $this->input->post('curMaxStudyY');
            
$this->cur->curNumTmPerY $this->input->post('curNumTmPerY');
            
$this->cur->curStatus $this->input->post('curStatus') ? $this->input->post('curStatus') : 'Y';
            
$this->cur->curCcId $this->input->post('curCcId');
            
$this->cur->curEdgId $this->input->post('curEdgId');
            
$this->cur->curElvId $this->input->post('curElvId');
            
$this->cur->curElvId $this->input->post('curElvId');
            
$this->cur->curGtpId $this->input->post('curGtpId');
            
$this->cur->curCreateDate date('Y-m-d H:i:s');
            
$this->cur->curCreateUserId $this->session->userdata("UsLogin");
            
$this->cur->curUpdateUsLogin $this->session->userdata("UsLogin");
            
$this->cur->curUpdateDate date('Y-m-d H:i:s');

            if (
$this->input->post('curId')=="") {
                
$this->cur->insert();
            } else {
                
$this->cur->update();
            }

            if (
class_exists('Ver_query')) {
                
Ver_query::saveQuery($this->cur$this->cur->db->last_query());
            }

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

            
redirect($this->config->item("rg_folder")."curriculum/cur_show");
        } else {
            
$this->cur_input();
        }
    }

    function 
cur_delete() {
        
$this->load->model($this->config->item("rg_folder").'mo_rg_curriculum','cur');

        
$curId $this->input->post('id');

        
$this->cur->curId $curId;
        if (
class_exists('Ver_query')) {
            
Ver_query::setOldVal($this->cur$this->config->item('rg_dbname').'.rg_Curriculum');
        }

        
$this->cur->delete();
        if (
class_exists('Ver_query')) {
            
Ver_query::saveQuery($this->cur$this->db->last_query());
        }

        
redirect($this->config->item("rg_folder")."curriculum/cur_show");
    }
    
// ##### end cur
    
    
function crs_show($strat=0,$pageSize=50) {
        
$this->load->model($this->config->item("rg_folder").'mo_rg_course','crs');
        
$this->contents['rs_totalRecord'] = $this->crs->qryCrs();
        if(
$this->input->post('crsCodeSearch')!='' || $this->input->post('crsNameSearch')!='' ){
            
$this->contents['rs_crs'] = "";
            
$con_rs_cur = array(
            
'crsCode'    => '%'.$this->input->post('crsCodeSearch').'%',
            
'crsName'    => '%'.$this->input->post('crsNameSearch').'%',
            );
            
            
$this->contents['rs_crs'] = $this->crs->qryCrs($con_rs_cur);
        }
        
        
$this->output($this->config->item("rg_folder")."v_showCourse");
    }

    function 
crs_detail(){
        if (
$this->input->server('REQUEST_METHOD') === 'POST')
        {
        
$this->load->model($this->config->item("rg_folder").'mo_rg_course','crs');
        
$this->load->model($this->config->item("rg_folder").'mo_rg_condition','cd');
        
$this->load->model($this->config->item("rg_folder").'mo_rg_precourse','prc');
        
        
$id $this->input->post('id');
        
        
$this->crs->crsId $id;
        
$qu_crs $this->crs->get_by_key();
        
$this->contents['qu_crs'] = $qu_crs;
        
        if(
$qu_crs->num_rows()>0){
            
$row_crs $qu_crs->row();
            
$this->cd->cdId $row_crs->crsCdId;
            
$qu_cd $this->cd->get_by_key();
            
$this->contents['qu_cd'] = $qu_cd;
        }
        
        
$con_rs_prc = array('prcCrsId' => $id);
        
$ord_rs_prc = array('prcSeq' => '');            
        
$rs_prc $this->prc->qryPrc($con_rs_prc,$ord_rs_prc);
        
$this->contents['rs_prc'] = $rs_prc;
        if(
$rs_prc->num_rows()>0){
            foreach(
$rs_prc->result() as $row_prc){
                
$this->crs->crsId $row_prc->prcPrCrsId;
                
$rs_crs $this->crs->get_by_key();
                
$arr[$row_prc->prcPrCrsId] = $rs_crs;
            }
        }
        
        isset(
$arr) ? $this->contents['rs_crs'] = $arr NULL;
        
        
$this->output_detail($this->config->item("rg_folder")."v_detailCourse");
        }
    }
    
        function 
crs_popup($ndex=0) {
        
$this->load->model($this->config->item("rg_folder").'mo_rg_course','crs');
        
$con_rs_cur = array(
            
'crsName'    => '%'.$this->input->post('crsNameSearch').'%',
            );
        
$this->contents['rs_crs'] = $this->crs->qryCrs($con_rs_cur);
        if(
$this->input->post('ndex')){
            
$this->contents['ndex'] = $this->input->post('ndex');
        }else{
            
$this->contents['ndex'] = $ndex;
        }
        
        
$this->output_detail($this->config->item("rg_folder")."v_courseTable");
    }
    

    function 
crs_input() { 
        
$id $this->input->post('id');
        
$this->load->model($this->config->item("rg_folder").'mo_rg_course','crs');
        
$this->load->model($this->config->item("rg_folder").'mo_rg_precourse','prc');
        
$this->load->model($this->config->item("rg_folder").'mo_rg_condition','cd');
        
$this->load->model($this->config->item("rg_folder").'mo_rg_gradetp','gt');
        
$this->load->model($this->config->item("rg_folder").'mo_rg_ProgramCourses','pc');
        
        
$this->contents['rs_gt'] = $this->gt->qryGtp();
        
$this->contents['rs_totalRecord'] = $this->crs->qryCrs();
        
$this->crs->crsId $id;
        
$qu_crs $this->crs->get_by_key();
        
$this->contents['qu_crs'] = $qu_crs;

        
$this->contents['cp'] = $this->pc->findCurPubStaY($id);
        
            for(
$i=2$i<=5$i++){
                
$this->contents['qu_prc'.$i] = $this->prc->qryByCrsIdOrderSeqLimit2($id$i-21);
            }
        
        
$con_rs_cur = array('cdType'    => 'H');
        
$ord_rs_cur = array('cdId' => '');
        
$this->contents['rs_cd'] = $this->cd->qryCd($con_rs_cur,$ord_rs_cur);
        
        
$this->output($this->config->item("rg_folder")."v_addCourse");
    }

    function 
crs_insert_update() {
        
$this->load->library('form_validation');
        
$this->form_validation->set_error_delimiters('<font color="red">','</font>');
        
$this->form_validation->set_rules('crsCode',' ','trim|required|xss_clean');
        
$this->form_validation->set_rules('crsCodeE',' ','trim|required|xss_clean');
        
$this->form_validation->set_rules('crsName',' ','trim|required|xss_clean');
        
$this->form_validation->set_rules('crsNameE',' ','trim|required|xss_clean');
        
$this->form_validation->set_rules('crsAbbr',' ','trim|xss_clean');
        
$this->form_validation->set_rules('crsAbbrE',' ','trim|xss_clean');
        
$this->form_validation->set_rules('crsDescription',' ','trim|xss_clean');
        
$this->form_validation->set_rules('crsDescriptionE',' ','trim|xss_clean');
        
$this->form_validation->set_rules('crsCreditTotal',' ','trim|required|integer|xss_clean');
        
$this->form_validation->set_rules('crsPeriod1',' ','trim|required|integer|xss_clean');
        
$this->form_validation->set_rules('crsPeriod2',' ','trim|required|integer|xss_clean');
        
$this->form_validation->set_rules('crsPeriod3',' ','trim|required|integer|xss_clean');
        
$this->form_validation->set_rules('crsShowLabInTS',' ','trim|required|xss_clean');
        
$this->form_validation->set_rules('crsStatus',' ','trim|xss_clean');
        
$this->form_validation->set_rules('crsCdId',' ','trim|required|xss_clean');
        for(
$i=2$i<=5$i++) {
            
$this->form_validation->set_rules('crsId'.$i,' ','trim|xss_clean');
            
$this->form_validation->set_rules('crsName'.$i,' ','trim|xss_clean');
            
$this->form_validation->set_rules('prcAndOr'.$i,' ','trim|xss_clean');
        }
        
        if(
$this->form_validation->run() == true) {
            
$this->db->trans_begin();
            
$this->load->model($this->config->item("rg_folder").'mo_rg_course','crs');
            
$this->load->model($this->config->item("rg_folder").'mo_rg_precourse','prc');
            
            if (
class_exists('Ver_query')) {
                
Ver_query::setOldVal($this->crs$this->config->item('rg_dbname').'.rg_Course');
            }
            
$this->crs->crsId $this->input->post('crsId');
            
$this->crs->crsCode $this->input->post('crsCode');
            
$this->crs->crsCodeE $this->input->post('crsCodeE');
            
$this->crs->crsName $this->input->post('crsName');
            
$this->crs->crsNameE $this->input->post('crsNameE');
            
$this->crs->crsAbbr $this->input->post('crsAbbr');
            
$this->crs->crsAbbrE $this->input->post('crsAbbrE');
            
$this->crs->crsDescription $this->input->post('crsDescription');
            
$this->crs->crsDescriptionE $this->input->post('crsDescriptionE');
            
$this->crs->crsCreditTotal $this->input->post('crsCreditTotal');
            
$this->crs->crsCredit1 $this->input->post('crsPeriod1');
            
$this->crs->crsCredit2 $this->input->post('crsCreditTotal') - $this->input->post('crsPeriod1');
            
$this->crs->crsPeriod1 $this->input->post('crsPeriod1');
            
$this->crs->crsPeriod2 $this->input->post('crsPeriod2');
            
$this->crs->crsPeriod3 $this->input->post('crsPeriod3');
            
$this->crs->crsUnit $this->input->post('crsCreditTotal').'('.$this->input->post('crsPeriod1').'-'.$this->input->post('crsPeriod2').'-'.$this->input->post('crsPeriod3').')';
            
$this->crs->crsShowLabInTS $this->input->post('crsShowLabInTS');
            
$this->crs->crsStatus $this->input->post('crsStatus') ? $this->input->post('crsStatus') : '';
            
$this->crs->crsCdId $this->input->post('crsCdId');
            
$this->crs->crsGtpId $this->input->post('crsGtpId');
            
$this->crs->crsUpdateDate date('Y-m-d H:i:s');
            
$this->crs->crsUpdateUserId $this->session->userdata("UsLogin");
            
$this->crs->crsCreateDate date('Y-m-d H:i:s');
            
$this->crs->crsCreateUserId $this->session->userdata("UsLogin");
            
            if(
$this->input->post('crsId') == 0) {
                
$this->crs->insert();
                
$Lid $this->crs->last_insert_id();
                if (
class_exists('Ver_query')) {
                    
Ver_query::saveQuery($this->crs$this->crs->db->last_query());
                }
            }else{
                
$this->crs->update();
                
$Lid $this->crs->last_insert_id();
                if (
class_exists('Ver_query')) {
                    
Ver_query::saveQuery($this->crs$this->crs->db->last_query());
                }
            }    
            
            
$prcCrsId $this->input->post('crsId') ? $this->input->post('crsId') : $Lid;
            
            
$con_rs_cur = array('prcCrsId'=> $prcCrsId);
            
$rs_prc $this->prc->qryPrc($con_rs_cur);
            
            if(
$rs_prc->num_rows()>0){
                foreach(
$rs_prc->result() as $row){
                    
$this->prc->prcCrsId $row->prcCrsId;
                    
$this->prc->prcPrCrsId $row->prcPrCrsId;
                    if (
class_exists('Ver_query')) {
                        
Ver_query::setOldVal($this->prc$this->config->item('rg_dbname').'.rg_PreCourse');
                    }
                    
$this->prc->delete();
                    if (
class_exists('Ver_query')) {
                        
Ver_query::saveQuery($this->prc$this->db->last_query());
                    }
                }
            }
            
            for(
$i=2$i<=5$i++) {
                
$this->prc->prcCrsId $prcCrsId;
                
$this->prc->prcPrCrsId $this->input->post('crsId'.$i);
                
$qu_prc1 $this->prc->get_by_key();
                
                
$this->prc->prcPrCrsId $this->input->post('crsId'.($i+1));
                
$qu_prc2 $this->prc->get_by_key();
                
                if (
class_exists('Ver_query')) {
                    
Ver_query::setOldVal($this->prc$this->config->item('rg_dbname').'.rg_PreCourse');
                }
                
                
$this->prc->prcCrsId $prcCrsId;
                
$this->prc->prcPrCrsId $this->input->post('crsId'.$i);
                
$this->prc->prcAndOr = ($this->input->post('crsId'.($i+1)) && $qu_prc2->num_rows()==&& $this->input->post('crsId'.$i)<>$this->input->post('crsId'.($i+1))) ? $this->input->post('prcAndOr'.$i) : '';
                
$this->prc->prcSeq $this->prc->getNextSeqByCrsId($prcCrsId);
                
                if(
$i == 2) {
                    if(
$this->input->post('crsId'.$i) && $qu_prc1->num_rows()==0) {
                        
$this->prc->insert();
                        if (
class_exists('Ver_query')) { 
                            
Ver_query::saveQuery($this->prc$this->prc->db->last_query());
                        }
                        
$flag 1;
                    }
                    else
                        
$flag 0;
                }
                else {
                    if(
$this->input->post('crsId'.$i) && $qu_prc1->num_rows()==&& $flag) {
                        
$this->prc->insert();
                        if (
class_exists('Ver_query')) {
                            
Ver_query::saveQuery($this->prc$this->prc->db->last_query());
                        }
                        
$flag 1;
                    }
                    else
                        
$flag 0;
                }
            }
            
            if(
$this->db->trans_status() === false)
                
$this->db->trans_rollback();
            else
                
$this->db->trans_commit();

            
redirect($this->config->item("rg_folder")."curpbri/crs_show");
        }
        else{
            
$this->crs_input();
        }
    }
    
    function 
crs_delete() {
        
$this->load->model($this->config->item("rg_folder").'mo_rg_course','crs');
        
$this->load->model($this->config->item("rg_folder").'mo_rg_precourse','prc');
        
$crsId $this->input->post('id');
        
        
$this->db->trans_begin();
        
        
$con_rs_cur = array('prcCrsId'=> $crsId);
        
$rs_prc $this->prc->qryPrc($con_rs_cur);
        
        foreach(
$rs_prc->result() as $row){
                
$this->prc->prcCrsId $row->prcCrsId;
                
$this->prc->prcPrCrsId $row->prcPrCrsId;
            if (
class_exists('Ver_query')) {
                
Ver_query::setOldVal($this->prc$this->config->item('rg_dbname').'.rg_PreCourse');
            }
                
$this->prc->delete();
            if (
class_exists('Ver_query')) {
                
Ver_query::saveQuery($this->prc$this->db->last_query());
            }
        }

        
$this->crs->crsId $crsId;
        if (
class_exists('Ver_query')) {
            
Ver_query::setOldVal($this->crs$this->config->item('rg_dbname').'.rg_Course');
        }
        
$this->crs->delete();
        if (
class_exists('Ver_query')) {
            
Ver_query::saveQuery($this->crs$this->db->last_query());
        }
        
        if (
$this->db->trans_status() === false) {
            
$this->db->trans_rollback();
        } else {
            
$this->db->trans_commit();
        }

        
redirect($this->config->item("rg_folder")."curpbri/crs_show");
    }
    
// ##### end crs
    
    // ##### start sp
    
function sp_show() {
        
$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_term','tm');
        
$this->load->model($this->config->item("rg_folder").'mo_rg_studyplan','sp');
        
        
$con_rs_cur = array('curStatus'    => 'Y');
        
$ord_rs_cur = array('curName' => '');            
        
$rs_cur $this->cur->qryCur($con_rs_cur,$ord_rs_cur);
        
        
$rs_sy $this->sy->qrySy();
        
$this->contents['rs_sy'] = $rs_sy;
        
        
        
$rs_tm $this->tm->qryTm();
        
$this->contents['rs_tm'] = $rs_tm;
        
        foreach(
$rs_cur->result() as $row_cur) {
            
$arr[$row_cur->curId]["name"] = $row_cur->curName;
            
$con_rs_sp = array('spCurId'    => $row_cur->curId);
            
$arr[$row_cur->curId]["creditTotal"] = $this->sp->qrySumCrsCreditTotal($con_rs_sp);
            
            foreach(
$rs_sy->result() as $row_sy) {
                foreach(
$rs_tm->result() as $row_tm){
                    
$con_rs_sp = array(
                    
'spCurId'    => $row_cur->curId,
                    
'spSyId'    => $row_sy->syId,
                    
'spTmId'    => $row_tm->tmId
                    
);
                    
$arr[$row_cur->curId][$row_sy->syId][$row_tm->tmId] = $this->sp->qrySumCrsCreditTotal($con_rs_sp);
                    }
            }
        }
        
$this->contents['rs_sp'] = $arr;
        
        
$this->output($this->config->item("rg_folder")."v_showStudyPlan");
    }
    
    function 
sp_detail() {
    if (
$this->input->server('REQUEST_METHOD') === 'POST')
        {
        
$this->load->model($this->config->item("rg_folder").'mo_rg_curriculum','cur');
        
$this->load->model($this->config->item("rg_folder").'mo_rg_studyplan','sp');
        
$this->load->model($this->config->item("rg_folder").'mo_rg_course','crs');
        
        
$curId $this->input->post('id');
        
        
$this->cur->curId $curId;
        
$this->contents['qu_cur'] = $this->cur->get_by_key();
        
        
$con_rs_sp = array('spCurId' => $curId);
        
$rs_sp $this->sp->qrySpGroupSyId($con_rs_sp);
        
$this->contents['rs_sp'] = $rs_sp;
        
        foreach(
$rs_sp->result() as $row_sp) {
            
$con_rs_sp2 = array(
                            
'spCurId' => $curId,
                            
'spSyId' => $row_sp->spSyId
                            
);
            
$rs_spTmId $this->sp->qrySpGroupTmId($con_rs_sp2);
            
$arr[$curId][$row_sp->spSyId] = $rs_spTmId;
            
            foreach(
$rs_spTmId->result() as $row_spTmId) {
                
$con_rs_sp3 = array(
                            
'spCurId' => $curId,
                            
'spSyId' => $row_sp->spSyId,
                            
'spTmId' => $row_spTmId->spTmId
                            
);
                
$rs_crs $this->sp->qryCopySp($con_rs_sp3);
                
$tpTm[$curId][$row_sp->spSyId][$row_spTmId->spTmId] = $rs_crs;
                
//$arr[$curId][$row_sp->spSyId][$row_spTmId->spTmId] = $rs_crs;
            
}
        }
        isset(
$arr) ? $this->contents['rs_spTmId'] = $arr NULL;
        isset(
$tpTm) ? $this->contents['rs_crs'] = $tpTm NULL;
        
        
$this->output_detail($this->config->item("rg_folder")."v_detailStudyPlan");
        }
    }
    
    function 
pcr_popup() { //$curId=0, $syId=0, $tmId=0, $cdId1=0
        
$this->load->model($this->config->item("rg_folder").'mo_rg_programcourses','pcr');
        
$this->load->model($this->config->item("rg_folder").'mo_rg_studyplan','sp');
        
$curId $this->input->post('curId');
        
$syId $this->input->post('syId');
        
$tmId $this->input->post('tmId');
        
$cdId1 $this->input->post('csCdId1');
        
$this->contents['rs_pcr'] = $this->pcr->qryByCsCurIdAndCsCdId1($curId$cdId1);
        
$this->contents['spCurId'] = $curId;
        
$this->contents['spSyId'] = $syId;
        
$this->contents['spTmId'] = $tmId;
        
$this->contents['spCdId1'] = $cdId1;
        
        
$this->output_detail($this->config->item("rg_folder")."v_programCoursesTable");
    }
    
    function 
sp_input() {
        
$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_term','tm');
        
$this->load->model($this->config->item("rg_folder").'mo_rg_curriculumstructure','cs');
        
$this->load->model($this->config->item("rg_folder").'mo_rg_studyplan','sp');
    
        
$curId=$this->input->post('curId');
        
$syId=$this->input->post('syId');
        
$tmId=$this->input->post('tmId');
        
        if(
$this->input->post('spCrsId')){
            echo 
$this->input->post('spCrsId');
            
$crsId $this->input->post('spCrsId');
            
$this->load->model($this->config->item("rg_folder").'mo_rg_studyplan','sp');
            
$this->sp->spCurId $curId;
            
$this->sp->spSyId $syId;
            
$this->sp->spTmId $tmId;
            
$this->sp->spCrsId $crsId;
            
$this->sp->delete();
        }
        
        
$this->cur->curId $curId;
        
$this->contents['qu_cur'] = $this->cur->get_by_key();
        
        
$this->sy->syId $syId;
        
$this->contents['qu_sy'] = $this->sy->get_by_key();
        
        
$this->tm->tmId $tmId;
        
$this->contents['qu_tm'] = $this->tm->get_by_key();
        
        
$rs_cs $this->cs->qryByCurIdGroupCdId1_2($curId);
        
$this->contents['rs_cs'] = $rs_cs;
        foreach(
$rs_cs->result() as $row){
            
$con_rs_sp = array(
                    
'spCurId'    => $curId,
                    
'spSyId'    => $syId,
                    
'spTmId'    => $tmId,
                    
'spCdId1'    => $row->csCdId1
                    
);
                    
            
$this->contents['rs_sp'][$row->csCdId1] = $this->sp->qryCopySp($con_rs_sp);
        }
         
        
$this->output($this->config->item("rg_folder")."v_addStudyPlan");
    }
    
    function 
sp_insert_update() {
        
$this->load->library('form_validation');
        
$this->form_validation->set_error_delimiters('<span class="error">','</span>');
        
$this->form_validation->set_rules('spCurId',' ','trim|required|xss_clean');
        
$this->form_validation->set_rules('spSyId',' ','trim|required|xss_clean');
        
$this->form_validation->set_rules('spTmId',' ','trim|required|xss_clean');
        
$this->form_validation->set_rules('spCdId1',' ','trim|required|xss_clean');
        
        if(
$this->form_validation->run() == true) {
            
$this->db->trans_begin();
            
$this->load->model($this->config->item("rg_folder").'mo_rg_studyplan','sp');
            
            
            
$spCrsId $this->input->post('spCrsId');
            
$spCdId2 $this->input->post('spCdId2');
            for(
$i=0$i<count($this->input->post('spCrsId')); $i++) {
                if (
class_exists('Ver_query')) {
                    
Ver_query::setOldVal($this->sp$this->config->item('rg_dbname').'.rg_StudyPlan');
                }
                
$this->sp->spCurId $this->input->post('spCurId');
                
$this->sp->spSyId $this->input->post('spSyId');
                
$this->sp->spTmId $this->input->post('spTmId');
                
$this->sp->spCrsId $spCrsId[$i];
                
$this->sp->spCdId1 $this->input->post('spCdId1');
                
$this->sp->spCdId2 $spCdId2[$i];
                
                
$this->sp->insert();
                if (
class_exists('Ver_query')) {
                    
Ver_query::saveQuery($this->sp$this->sp->db->last_query());
                }
            }
            
            if(
$this->db->trans_status() === false)
                
$this->db->trans_rollback();
            else{
                
$this->db->trans_commit();
            }
            
$this->pcr_popup();
        }
        else{
            
$this->pcr_popup();
        }
    }
    
    function 
sp_delete() {
        
$this->load->library('form_validation');
        
$this->form_validation->set_error_delimiters('<span class="error">','</span>');
        
$this->form_validation->set_rules('curId',' ','trim|required|xss_clean');
        
$this->form_validation->set_rules('syId',' ','trim|required|xss_clean');
        
$this->form_validation->set_rules('tmId',' ','trim|required|xss_clean');
        
$this->form_validation->set_rules('spCrsId',' ','trim|required|xss_clean');
        
        if(
$this->form_validation->run() == true) {
            
$curId=$this->input->post('curId');
            
$syId=$this->input->post('syId');
            
$tmId=$this->input->post('tmId');
            
$crsId $this->input->post('spCrsId');
            
            
$this->load->model($this->config->item("rg_folder").'mo_rg_studyplan','sp');
            
$this->sp->spCurId $curId;
            
$this->sp->spSyId $syId;
            
$this->sp->spTmId $tmId;
            
$this->sp->spCrsId $crsId;
            
            if (
class_exists('Ver_query')) {
                
Ver_query::setOldVal($this->sp$this->config->item('rg_dbname').'.rg_StudyPlan');
            }
            if(
$this->sp->delete()){
                echo 
"true";
            }else{
                echo 
"";
            }
            if (
class_exists('Ver_query')) {
                
Ver_query::saveQuery($this->sp$this->sp->db->last_query());
            }
        }
    }
    
// ##### end sp
    
    // ##### start cur_s  curriculum structure
    
function cur_s_define($id='') {
        
$this->contents['id'] = $id;
        
$this->load->model($this->config->item("rg_folder").'mo_rg_curriculum','cur');
        
//$this->contents['rs_cur'] = $this->cur->qryCurStatusIsY();

        
$this->contents['rs_cur'] = $this->cur->get_options(array('curStatus'=>'Y'),array('curId'=>''),'');
        
$this->output($this->config->item("rg_folder")."v_defineCurStructure");
    }
    
    function 
cur_s_selectCur($curId) {
        
$this->load->model($this->config->item("rg_folder").'mo_rg_curriculum','cur');
        
$cur $this->cur;
        
        
$this->load->model($this->config->item("rg_folder").'mo_rg_curriculumPublic','cpub');
        
$cpub $this->cpub;
        
        
$this->load->model($this->config->item("rg_folder").'mo_rg_studyplan','sp');
        
$sp $this->sp;
        
        
$this->load->model($this->config->item("rg_folder").'mo_rg_curriculumstructure','cs');
        
$cs $this->cs;

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

        
$rs_cur $cur->qryByIdStatusIsY($curId);

        if(
$rs_cur->num_rows()>0){

            
$cur $rs_cur->row();
            
//$rs_cd = $this->cs->qryCdByCurId($cur->curId);

            
$data['cur'] = $cur;
            
//$data['rs_cd'] = $rs_cd;
            
$data['curId'] = $curId;
            
            
$con_cpub = array('cpubCurId'=>$curId);
            
$data['cpub'] = $this->cpub->qryCpubJoinCur($con_cpub);
/*            echo $this->load->view('eregis/v_cur_s_selectCur',$data,true);
echo 'curId-='.$curId;
*/
            
$arr = array();
            
$sum_sub = array();
            
$cs->csCurId $curId;
            
$cs1 $cs->qryCsLv1();
            
$lv1_seq 0;
            
$data['lv1_credit'] = 0;
            
$ct = array();
            
$sp_crs = array();
            foreach( 
$cs1->result() as $lv1 ){
                
$arr[$lv1_seq]['info'] = $lv1;
                
$data['lv1_credit']+=$lv1->csCreditTotal;
                
$cs->csCurId $curId;
                
$cs->csCdId1 $lv1->cdId;
                
$cs2 $cs->qryCsLv2();
                
$ct[$lv1->cdId] = $cs2->num_rows();
                
$lv2_seq 0;
                
$sum_sub[$lv1->cdId] = 0;
                
$arr[$lv1_seq]['lv2'] = array();
                if(
$cs2->num_rows() > 0){
                    foreach( 
$cs2->result() as $lv2 ){
                        
$arr[$lv1_seq]['lv2'][$lv2_seq]['info'] = $lv2;

                        
$pcr->pcrCsCurId $curId;
                        
$pcr->pcrCsCdId1 $lv1->cdId;
                        
$pcr->pcrCsCdId2 $lv2->cdId;
                        
$sum_sub[$lv1->cdId] += $lv2->csCreditTotal;
                        
$crs $pcr->qryCrsByCd();
                        
                        
$arr[$lv1_seq]['lv2'][$lv2_seq]['crs'] = $crs;
                        
$lv2_seq++;
                    }
                }else{
                    
$arr[$lv1_seq]['lv2'][$lv2_seq]['info'] = false;
                        
$pcr->pcrCsCurId $curId;
                        
$pcr->pcrCsCdId1 $lv1->cdId;
                        
$pcr->pcrCsCdId2 1;
                        
$crs $pcr->qryCrsByCd();
                        
                        
$arr[$lv1_seq]['lv2'][$lv2_seq]['crs'] = $crs;
                }
                
// ---- สำหรับ เพิ่มกลุ่ม
                
$arr[$lv1_seq]['opt_C'] = $cs->get_opt_qryCdNotInCs('C',array('csCurId'=>$curId,'csCdId1'=>$lv1->cdId),array('1'=>'csCdId2'), 'เลือกกลุ่ม/หน่วย');
                
$lv1_seq++;
            }
            
$data['cs'] = $arr;
            
$data['ct'] = $ct;
            
$data['sp_crs'] = $sp_crs;
            
$data['sum_sub'] = $sum_sub;

// ---- สำหรับ เพิ่มหมวดวิชา
        
$data['opt_H'] = $cs->get_opt_qryCdNotInCs('H',array('csCurId'=>$curId),array('1'=>'csCdId1'), 'เลือกหมวด');

            echo 
$this->load->view('eregis/v_cur_s_selectCur',$data,true);
        }
    }
    
    function 
curs_addCategory(){
        
$this->load->view('eregis/v_cursAddCategory','');
    }

    function 
cs_save_cd1(){
/*            $curId = $this->input->post('curId');
            $cd1_seq = $this->input->post('cd1_seq');
            $cd1 = $this->input->post('cd1');
            $cd2 = $this->input->post('cd2');
            $cd1_credit = $this->input->post('cd1_credit');
            echo "curId: $curId , cd1_seq : $cd1_seq ,cd1 : $cd1 ,cd2 : $cd2, cd1_credit : $cd1_credit";
*/      
$curId $this->input->post('curId');
        
$this->load->library('form_validation');//|required
        
$this->form_validation->set_error_delimiters('<span class="error">','</span>');
        
$this->form_validation->set_rules('cd1_seq','cd1_seq','trim|required|xss_clean');
        
$this->form_validation->set_rules('cd1','cd1','trim|required|xss_clean');
        
$this->form_validation->set_rules('cd1_credit','cd1_credit','trim|required|xss_clean');
        
$this->form_validation->set_rules('curId','curId','trim|required|xss_clean');

        if(
$this->form_validation->run() == true) {
            
$curId $this->input->post('curId');
            
$cd1_seq $this->input->post('cd1_seq');
            
$cd1 $this->input->post('cd1');
            
$cd2 $this->input->post('cd2');
            
$cd1_credit $this->input->post('cd1_credit');

            
$this->db->trans_begin();
            
$this->load->model($this->config->item("rg_folder").'mo_rg_curriculumstructure','cs');
            
            
/*if (class_exists('Ver_query')) {
                Ver_query::setOldVal($this->cs, $this->config->item('rg_dbname').'.rg_CurriculumStructure');
            }*/
            
$this->cs->csCurId $this->input->post('curId');
            
$this->cs->csCdId1 $this->input->post('cd1');
            
$this->cs->csCdId2 $this->input->post('cd2');//'1';
            
$this->cs->csSeq $this->input->post('cd1_seq');
            
$this->cs->csCreditTotal $this->input->post('cd1_credit');

            
$this->cs->insert();
            
/*if (class_exists('Ver_query')) {
                Ver_query::saveQuery($this->cs, $this->cs->db->last_query());
            }*/
                
            
if($this->db->trans_status() === false){
                
$this->db->trans_rollback();
            }else{
                
$this->db->trans_commit();
            }
            
$this->cur_s_define($curId);

        }else{
            echo 
"error";
            
$this->cur_s_define($curId);
        }
        
    }
    
    function 
del_lv1(){
        if (
$this->input->server('REQUEST_METHOD') === 'POST')
        {
            
$this->db->trans_begin();
            
$this->load->model($this->config->item("rg_folder").'mo_rg_studyplan','sp');
            
$this->load->model($this->config->item("rg_folder").'mo_rg_curriculumstructure','cs');
            
$this->load->model($this->config->item("rg_folder").'mo_rg_ProgramCourses','pcr');
            
            
$this->cs->csCurId $this->input->post('csCurId');
            
$this->cs->csCdId1 $this->input->post('csCdId1');
            
$cs_rs $this->cs->qryCsLv2();
            
            if(
$cs_rs->num_rows()>0){
                foreach(
$cs_rs->result() as $cs_row){
                    
$con_pcr = array('pcrCsCurId'=>$this->input->post('csCurId'),'pcrCsCdId1'=>$this->input->post('csCdId1'),'pcrCsCdId2'=>$cs_row->csCdId2);
                    
                    
$rs_pcr $this->pcr->qryPcr($con_pcr);
                    
                    if(
$rs_pcr->num_rows()>0){
                        foreach(
$rs_pcr->result() as $row_pcr){
                            
                            
$sp_con = array('spCurId'=>$this->input->post('csCurId'),'spCdId1'=>$this->input->post('csCdId1'),'spCrsId'=>$row_pcr->pcrCrsId);
                
                            
$sp_rs $this->sp->qrySp($sp_con);
                            
                            if(
$sp_rs->num_rows()>0){
                                foreach(
$sp_rs->result() as $sp_row){
                                
                                
$this->sp->spCurId $sp_row->spCurId;
                                
$this->sp->spSyId $sp_row->spSyId;
                                
$this->sp->spTmId $sp_row->spTmId;
                                
$this->sp->spCrsId $sp_row->spCrsId;
                                
                                
/*if (class_exists('Ver_query')) {
                                    Ver_query::setOldVal($this->sp, $this->config->item('rg_dbname').'.rg_StudyPlan');
                                }*/
                                
$this->sp->delete();
                                
/*if (class_exists('Ver_query')) {
                                    Ver_query::saveQuery($this->sp, $this->sp->db->last_query());
                                }*/
                                
}
                            }
                        
                            
$this->pcr->pcrCsCurId $this->input->post('csCurId');
                            
$this->pcr->pcrCsCdId1 $this->input->post('csCdId1');
                            
$this->pcr->pcrCsCdId2 $cs_row->csCdId2;
                            
$this->pcr->pcrCrsId $row_pcr->pcrCrsId;

                            
/*if (class_exists('Ver_query')) {
                                Ver_query::setOldVal($this->pcr, $this->config->item('rg_dbname').'.rg_ProgramCourses');
                            }*/
                            
                                
$this->pcr->delete();
                            
/*if (class_exists('Ver_query')) {
                                Ver_query::saveQuery($this->pcr, $this->pcr->db->last_query());
                            }*/
                        
}
                    }
                    
                    
$this->cs->csCurId $this->input->post('csCurId');
                    
$this->cs->csCdId1 $this->input->post('csCdId1');
                    
$this->cs->csCdId2 $cs_row->csCdId2;
                    
                    
/*if (class_exists('Ver_query')) {
                        Ver_query::setOldVal($this->cs, $this->config->item('rg_dbname').'.rg_CurriculumStructure');
                    }*/
                    
$this->cs->delete();
                    
/*if (class_exists('Ver_query')) {
                        Ver_query::saveQuery($this->cs, $this->cs->db->last_query());
                    }*/
                
}
            }
            
            
$this->cs->csCurId $this->input->post('csCurId');
            
$this->cs->csCdId1 $this->input->post('csCdId1');
            
$this->cs->csCdId2 1;
            
            
/*if (class_exists('Ver_query')) {
                Ver_query::setOldVal($this->cs, $this->config->item('rg_dbname').'.rg_CurriculumStructure');
            }*/
            
$this->cs->delete();
            
/*if (class_exists('Ver_query')) {
                Ver_query::saveQuery($this->cs, $this->cs->db->last_query());
            }*/
            
if($this->db->trans_status() === false){
                
$this->db->trans_rollback();
            }else{
                
$this->db->trans_commit();
                
$this->cur_s_selectCur($this->input->post('csCurId'));
            }
        }
    }
    
    function 
update_del_lv2(){
        if (
$this->input->server('REQUEST_METHOD') === 'POST')
        {
            
$this->db->trans_begin();
            
$this->load->model($this->config->item("rg_folder").'mo_rg_curriculumstructure','cs');
            
$this->load->model($this->config->item("rg_folder").'mo_rg_studyplan','sp');
            
$this->load->model($this->config->item("rg_folder").'mo_rg_ProgramCourses','pcr');
            
            if(
$this->input->post('edit')){
                
$this->cs->csCurId $this->input->post('csCurId');
                
$this->cs->csCdId1 $this->input->post('csCdId1');
                
$this->cs->csCdId2 $this->input->post('csCdId2');
                
$this->cs->get_by_key(TRUE);
            
                
/*if (class_exists('Ver_query')) {
                    Ver_query::setOldVal($this->cs, $this->config->item('rg_dbname').'.rg_CurriculumStructure');
                }*/
                
                    
$this->cs->csCreditTotal $this->input->post('csCreditTotal');

                    
$this->cs->update();
                
/*if (class_exists('Ver_query')) {
                    Ver_query::saveQuery($this->cs, $this->cs->db->last_query());
                }*/
            
            
}else if($this->input->post('del')){
                
                
$con_pcr = array('pcrCsCurId'=>$this->input->post('csCurId'),'pcrCsCdId1'=>$this->input->post('csCdId1'),'pcrCsCdId2'=>$this->input->post('csCdId2'));
                
$rs_pcr $this->pcr->qryPcr($con_pcr);
                if(
$rs_pcr->num_rows()>0){
                    foreach(
$rs_pcr->result() as $row_pcr){
                    
                        
$sp_con = array('spCurId'=>$this->input->post('csCurId'),'spCdId1'=>$this->input->post('csCdId1'),'spCrsId'=>$row_pcr->pcrCrsId);
                
                        
$sp_rs $this->sp->qrySp($sp_con);
                        
                        if(
$sp_rs->num_rows()>0){
                            foreach(
$sp_rs->result() as $sp_row){
                            
                            
$this->sp->spCurId $sp_row->spCurId;
                            
$this->sp->spSyId $sp_row->spSyId;
                            
$this->sp->spTmId $sp_row->spTmId;
                            
$this->sp->spCrsId $sp_row->spCrsId;
                            
                            
/*if (class_exists('Ver_query')) {
                                Ver_query::setOldVal($this->sp, $this->config->item('rg_dbname').'.rg_StudyPlan');
                            }*/
                            
$this->sp->delete();
                            
/*if (class_exists('Ver_query')) {
                                Ver_query::saveQuery($this->sp, $this->sp->db->last_query());
                            }*/
                            
}
                        }
                
                        
$this->pcr->pcrCsCurId $this->input->post('csCurId');
                        
$this->pcr->pcrCsCdId1 $this->input->post('csCdId1');
                        
$this->pcr->pcrCsCdId2 $this->input->post('csCdId2');
                        
$this->pcr->pcrCrsId $row_pcr->pcrCrsId;

                        
/*if (class_exists('Ver_query')) {
                            Ver_query::setOldVal($this->pcr, $this->config->item('rg_dbname').'.rg_ProgramCourses');
                        }*/
                        
                            
$this->pcr->delete();
                        
/*if (class_exists('Ver_query')) {
                            Ver_query::saveQuery($this->pcr, $this->pcr->db->last_query());
                        }*/
                    
}
                }
                
                
$this->cs->csCurId $this->input->post('csCurId');
                
$this->cs->csCdId1 $this->input->post('csCdId1');
                
$this->cs->csCdId2 $this->input->post('csCdId2');
                
                
/*if (class_exists('Ver_query')) {
                    Ver_query::setOldVal($this->cs, $this->config->item('rg_dbname').'.rg_CurriculumStructure');
                }*/
                
$this->cs->delete();
                
/*if (class_exists('Ver_query')) {
                    Ver_query::saveQuery($this->cs, $this->cs->db->last_query());
                }*/
            
}
            
            if(
$this->db->trans_status() === false){
                
$this->db->trans_rollback();
            }else{
                
$this->db->trans_commit();
                
$this->cur_s_selectCur($this->input->post('csCurId'));
            }
        }
    }
    
    function 
cs_update_del(){
        if (
$this->input->server('REQUEST_METHOD') === 'POST')
        {
            
$this->db->trans_begin();
            
$this->load->model($this->config->item("rg_folder").'mo_rg_ProgramCourses','pcr');
            
$this->load->model($this->config->item("rg_folder").'mo_rg_studyplan','sp');
            
            if(
$this->input->post('del')){
                
                
$sp_con = array('spCurId'=>$this->input->post('csCurId'),'spCdId1'=>$this->input->post('csCdId1'),'spCrsId'=>$this->input->post('crsId'));
                
                
$sp_rs $this->sp->qrySp($sp_con);
                
                if(
$sp_rs->num_rows()>0){
                    foreach(
$sp_rs->result() as $sp_row){
                    
                    
$this->sp->spCurId $sp_row->spCurId;
                    
$this->sp->spSyId $sp_row->spSyId;
                    
$this->sp->spTmId $sp_row->spTmId;
                    
$this->sp->spCrsId $sp_row->spCrsId;
                    
                    
/*if (class_exists('Ver_query')) {
                        Ver_query::setOldVal($this->sp, $this->config->item('rg_dbname').'.rg_StudyPlan');
                    }*/
                    
$this->sp->delete();
                    
/*if (class_exists('Ver_query')) {
                        Ver_query::saveQuery($this->sp, $this->sp->db->last_query());
                    }*/
                    
}
                }
            
                
$this->pcr->pcrCsCurId $this->input->post('csCurId');
                
$this->pcr->pcrCsCdId1 $this->input->post('csCdId1');
                
$this->pcr->pcrCsCdId2 $this->input->post('csCdId2');
                
$this->pcr->pcrCrsId $this->input->post('crsId');

                
/*if (class_exists('Ver_query')) {
                    Ver_query::setOldVal($this->pcr, $this->config->item('rg_dbname').'.rg_ProgramCourses');
                }*/
                
$this->pcr->delete();
                
/*if (class_exists('Ver_query')) {
                    Ver_query::saveQuery($this->pcr, $this->pcr->db->last_query());
                }*/
            
}if($this->input->post('edit')){
                
$sta = ($this->input->post('status')=="true")? "N" "Y";
                
$this->pcr->pcrCsCurId $this->input->post('csCurId');
                
$this->pcr->pcrCsCdId1 $this->input->post('csCdId1');
                
$this->pcr->pcrCsCdId2 $this->input->post('csCdId2');
                
$this->pcr->pcrCrsId $this->input->post('crsId');
                
$this->pcr->get_by_key(TRUE);
                
                
/*if (class_exists('Ver_query')) {
                    Ver_query::setOldVal($this->pcr, $this->config->item('rg_dbname').'.rg_ProgramCourses');
                }*/
                
$this->pcr->pcrStatus $sta;

                
$this->pcr->update();
                
/*if (class_exists('Ver_query')) {
                    Ver_query::saveQuery($this->pcr, $this->pcr->db->last_query());
                }*/
                
            
}
            if(
$this->db->trans_status() === false){
                
$this->db->trans_rollback();
            }else{
                
$this->db->trans_commit();
                
$this->cur_s_selectCur($this->input->post('csCurId'));
            }
        }
    }

    function 
cs_searchCrs($cur,$cd1,$cd2){
//        echo $cd1.'/'.$cd2;
        // cd -> getByKey ( $cd1 )
        
if ($this->input->server('REQUEST_METHOD') === 'POST')
        {
            
$select $this->input->post('crs');
//            echo $select[2];
            
$this->contents['curId'] = $this->input->post('curId');
            
$this->contents['cdId1'] = $this->input->post('cdId1');
            
$this->contents['cdId2'] = $this->input->post('cdId2');
            
$this->load->model($this->config->item("rg_folder").'mo_rg_condition','cd');
            
$this->cd->cdId $this->input->post('cdId1');
            
$cs $this->cd->get_by_key();
            
$this->contents['cs'] = $cs;

        
// crs -> search by $cd1
            
$this->load->model($this->config->item("rg_folder").'mo_rg_course','crs');
            
$this->crs->crsCdId $cd1;
            
$this->crs->crsCode $this->input->post('crsCodeSearch');
            
$this->crs->crsCodeE $this->input->post('crsCodeSearch');
            
$this->crs->crsName $this->input->post('crsNameSearch');
            
$this->crs->crsNameE $this->input->post('crsNameSearch');
            
            
$this->contents['crs'] = $this->crs->qryByCrsCurIdAndCsCdId1($cur,$cd1);

            if(
$this->input->post('fsave')){
                
$select $this->input->post('crs');
                
$this->load->model($this->config->item("rg_folder").'mo_rg_ProgramCourses','pcr');

                
$this->cd->cdId = ($this->input->post('cdId2')==1)?$this->input->post('cdId1'):$this->input->post('cdId2');
                
$cs $this->cd->get_by_key();
                
$qu $cs->row();
                
                foreach(
$select as $crs_s){
                    
//echo $crs_s.'<br>';
                    /*if (class_exists('Ver_query')) {
                        Ver_query::setOldVal($this->pcr, $this->config->item('rg_dbname').'.rg_ProgramCourses');
                    }*/
                    
$this->pcr->pcrCsCurId $this->input->post('curId');
                    
$this->pcr->pcrCsCdId1 $this->input->post('cdId1');
                    
$this->pcr->pcrCsCdId2 $this->input->post('cdId2');
                    
$this->pcr->pcrCdType $qu->cdType;
                    
$this->pcr->pcrMinGrade $qu->cdMinGrade;
                    
$this->pcr->pcrStatus 'Y';
                    
$this->pcr->pcrCrsId $crs_s;
                    
$this->pcr->insert();
                    
/*if (class_exists('Ver_query')) {
                        Ver_query::saveQuery($this->pcr, $this->pcr->db->last_query());
                    }*/
                
}
                
$this->contents['ins'] = "true";
            }
            
        }else{
            
$this->contents['curId'] = $cur;
            
$this->contents['cdId1'] = $cd1;
            
$this->contents['cdId2'] = $cd2;
            
$this->load->model($this->config->item("rg_folder").'mo_rg_condition','cd');
            
$this->cd->cdId $cd1;
            
$cs $this->cd->get_by_key();
            
$this->contents['cs'] = $cs;
        }


        
$this->output_detail($this->config->item("rg_folder")."v_searchCourseCd");

    }
    
// ##### end cur_s
    
    // start public cur
    
function cpub_show(){
        
$this->load->model($this->config->item("rg_folder").'mo_rg_curriculumpublic','cpub');
        
        
$con_cpub = array('cpubPublic'=>'N'); //'curStatus'=>'Y',
        
$this->contents['cpub'] = $this->cpub->qryCpubJoinCur($con_cpub);
        
        
$this->output($this->config->item("rg_folder")."v_showCpub");
    }
    
    
// ยังไม่ได้ทำ ส่วนที่เพิ่มคำสั่ง insert
    
function insert_update_cpub(){
        
$this->load->library('form_validation');
        
$this->form_validation->set_error_delimiters('<span class="error">','</span>');
        
$this->form_validation->set_rules('curId[]','curId[]','trim|xss_clean');

        if(
$this->form_validation->run() == true) {
            
$this->load->model($this->config->item("rg_folder").'mo_rg_curriculumpublic','cpub');
            
$select $this->input->post('curId');
            
$this->db->trans_begin();
            for(
$i=0;$i<count($select);$i++){
                if (
class_exists('Ver_query')) {
                    
Ver_query::setOldVal($this->cpub$this->config->item('rg_dbname').'.rg_CurriculumPublic');
                }
                
$this->cpub->cpubPublic "Y";
                
$this->cpub->cpubCurId $select[$i];
                
$this->cpub->cpubPublicDate date('Y-m-d H:i:s');
                
$this->cpub->cpubUserId $this->session->userdata("UsLogin");
                
                
$this->cpub->update();
                if (
class_exists('Ver_query')) {
                    
Ver_query::saveQuery($this->cpub$this->cpub->db->last_query());
                }
            }
            if(
$this->db->trans_status() === false){
                
$this->db->trans_rollback();
            }else{
                
$this->db->trans_commit();
                
redirect($this->config->item("rg_folder")."curpbri/cpub_show");
            }
        }
    }
    
// end public cur
}
?>

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