!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:     studentinfo.php (67.46 KB)      -rwxr-xr-x
Select action/file-type:
(+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php
include("rg_controller.php");
class 
studentinfo extends Rg_controller {

    
// ##### start stdMB
    
function std_showInfo() {

        
$this->output($this->config->item("rg_folder")."v_searchStudentInfo");
    }
    function 
std_searchInfo() {
        
$stdCode $this->input->post('stdCode');
        
$stdName $this->input->post('stdName');
        
$stdSurname $this->input->post('stdSurname');

        
$this->load->library('form_validation');
        
$this->form_validation->set_error_delimiters('<div class="error">','</div>');
        
$this->form_validation->set_rules('stdCode',' ','trim|xss_clean');
        
$this->form_validation->set_rules('stdName',' ','trim|xss_clean');
        
$this->form_validation->set_rules('stdSurname',' ','trim|xss_clean');

        if(
$this->form_validation->run() == true) {
            if(
$stdCode!='' || $stdName!='' || $stdSurname!='') {
                
$this->load->model($this->config->item("rg_folder").'mo_rg_student','std');

                
$con_rs_std = array('stdCode'        => '%'.$stdCode.'%',
                                    
'stdName'        => '%'.$stdName.'%',
                                    
'stdSurname'    => '%'.$stdSurname.'%');
                
$this->contents['rs_std'] = $this->std->qryStdJoinPfCurSySstElv($con_rs_std);
            } else {
                
$this->contents['str_fault'] = $this->config->item('str_fault');
            }

            
$this->output($this->config->item("rg_folder")."v_searchStudentInfo");
        } else {
            
$this->std_showHis();
        }
    }
    function 
tc_editStdMBInfo($tb=0,$id=0) {
        
$this->load->model($this->config->item("ppc_folder").'mo_prefix','pf');
        
$this->load->model($this->config->item("rg_folder").'mo_rg_config','cfg');
        
$this->load->model($this->config->item("rg_folder").'mo_rg_student','std');
        
$this->load->model($this->config->item("rg_folder").'mo_rg_studentdetails','sdt');
        
$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_person','prs');
        
$this->load->model($this->config->item("rg_folder").'mo_rg_classteacher','ctc');
        
$this->load->model($this->config->item("rg_folder").'mo_rg_adviser','adv');

        
$tc 'tc_';

        
$tab $this->input->post('tab')=='' ? ($tb==$tb) : $this->input->post('tab');
        
$stdId $this->input->post('stdId')=="" $id $this->input->post('stdId');
        
$act 'Y';
        
$data['prs'] = 'Y';
        
$data['tc'] = $tc;

        
$data['act'] = (isset($act) && ($act=='Y')) ? $act 'N';
        
$data['tab'] = $tab;
        
$data['stdId'] = $stdId;
        
$data['qu_cfg'] = $this->cfg->qryCfg();
        
$data['acY'] = $this->session->userdata('acY');
        
$data['tmId'] = $this->session->userdata('tmId');
        
$rs_tm $this->tm->get_options('','','','n');
        
$rs_sy $this->sy->get_options('','','','n');
        
$rs_pf $this->pf->get_options();

        
$this->std->stdId $stdId;
        
$std $this->std->get_by_key();
    
        
//--[data for v_showStudentDetails]--
        
$qu_std $this->std->qryStdMB($stdId);
        
$con_ctc = array();
        
$con_adv = array();
        if(
$qu_std->num_rows()) {
            
$con_ctc = array('ctcCurId'    => $qu_std->row()->stdCurId,
                             
'ctcSyId'    => $qu_std->row()->stdSyId,
                             
'ctcAcY'    => $this->session->userdata('acY'));
            
$con_adv = array('advStdId'    => $qu_std->row()->stdId,
                             
'advAcY'    => $this->session->userdata('acY'),
                             
'advSyId'    => $qu_std->row()->stdSyId);
        }

        
$data['ctc'] = $this->ctc->qryCtcJoinPrs($con_ctc);
        
$data['adv'] = $this->adv->qryAdvJoinPrs($con_adv);
        
$data['qu_std'] = $qu_std;

        if(isset(
$act) && $act=="Y")
            
$this->contents['showDetails'] = $this->load->view($this->config->item('rg_folder').'v_showStudentDetails',$data,TRUE);
        
//--[data for v_showStudentDetails]--

        
if($tab==1) {
            
$this->load->model($this->config->item("rg_folder").'mo_rg_entrytype','et');
            
$this->load->model($this->config->item("rg_folder").'mo_rg_preadmit','pa');
            
$this->load->model($this->config->item("rg_folder").'mo_rg_healthprivilege','hp');

            
$data['rs_pf'] = $rs_pf;

            
$con_parent = array('sdtStdId'    => $stdId);
            
$data['parent'] = $this->sdt->qrySdtJoinPfDtApPrv($con_parent);
            
$data['rs_et'] = $this->et->get_options('','','','n');
            
$data['rs_pa'] = $this->pa->get_options('','','','n');
            
$data['rs_hp'] = $this->hp->get_options('','','','n');

            
$this->contents['showDetails'] = $this->load->view($this->config->item('rg_folder').'v_showStudentDetails',$data,TRUE);
            
$this->contents['v'] = $this->load->view($this->config->item('rg_folder').'v_editStudentMBInfo1',$data,TRUE);
        } else if(
$tab==2) {
            
$this->load->model($this->config->item("rg_folder").'mo_rg_edudegree','edg');
            
$this->load->model($this->config->item("rg_folder").'mo_rg_maritalstatus','ms');
            
$this->load->model($this->config->item("rg_folder").'mo_rg_recruitmenttype','rt');
            
$this->load->model($this->config->item("ppc_folder").'mo_nation','nt');
            
$this->load->model($this->config->item("ppc_folder").'mo_religion','rlg');
            
$this->load->model($this->config->item("ppc_folder").'mo_province','prv');
            
$this->load->model($this->config->item("ppc_folder").'mo_country','cnt');

            
$ord_rs_edg = array('edgName'    => '');
            
$data['rs_edg'] = $this->edg->get_options('',$ord_rs_edg);

            
$ord_rs_nt = array('nationName'    => '');
            
$data['rs_nt'] = $this->nt->get_options('',$ord_rs_nt);

            
$ord_rs_rlg = array('religionName'    => '');
            
$data['rs_rlg'] = $this->rlg->get_options('',$ord_rs_rlg);

            
$ord_rs_prv = array('provinceName'    => '');
            
$data['rs_prv'] = $this->prv->get_options('',$ord_rs_prv);

            
$ord_rs_cnt = array('countryName'    => '');
            
$data['rs_cnt'] = $this->cnt->get_options('',$ord_rs_cnt);

            
$ord_rs_ms = array('msName'    => '');
            
$data['rs_ms'] = $this->ms->get_options('',$ord_rs_ms);

            
$data['rs_rt'] = $this->rt->get_options();

            
$opt = array();
            
$opt[''] = "";
            
$opt['P'] = "ผ่าน";
            
$opt['F'] = "ไม่ผ่าน";
            
$data['rs_occExamResult'] = $opt;
            
$data['qu_sdt'] = $this->sdt->qrySdtMB($stdId);

            
$opt2 = array();
            
$opt2[''] = "";
            
$opt2[1] = "กำลังทำงานอยู่";
            
$opt2[2] = "ลาศึกษาต่อ";
            
$opt2[3] = "ลาออก";
            
$data['rs_workstatus'] = $opt2;

            
$opt3 = array();
            
$opt3[1] = "มีชีวิตอยู่";
            
$opt3[2] = "หย่าร้าง";
            
$opt3[3] = "ตาย";
            
$data['rs_status'] = $opt3;

            
$data['home'] = $this->sdt->qryAddrOfHomeJoinDtApPrv($stdId);
            
$data['current'] = $this->sdt->qryAddrOfCurrentJoinDtApPrv($stdId);
            
$data['work'] = $this->sdt->qryAddrOfWorkJoinDtApPrv($stdId);
            
$data['father'] = $this->sdt->qryAddrOfFatherJoinDtApPrv($stdId);
            
$data['mother'] = $this->sdt->qryAddrOfMotherJoinDtApPrv($stdId);
            
$data['contact'] = $this->sdt->qryAddrOfContactJoinDtApPrv($stdId);
            
$data['graduate'] = $this->sdt->qryAddrOfGraduateJoinDtApPrv($stdId);

            
$this->contents['v'] = $this->load->view($this->config->item('rg_folder').'v_editStudentMBInfo2',$data,TRUE);
        } else if(
$tab==3) {
            
$this->load->model($this->config->item("rg_folder").'mo_rg_studentactivity','sac');

            
$data['rs_tm'] = $rs_tm;
            
$data['rs_sy'] = $rs_sy;

            
$data['qu_std'] = $std;
            
$data['rs_sac'] = $this->sac->qrySacBySacStdIdAndGEAdYJoinTmSy($stdId,$std->row()->stdAdY);

            
$this->contents['v'] = $this->load->view($this->config->item('rg_folder').'v_editStudentMBInfo3',$data,TRUE);
        } else if(
$tab==4) {
            
$this->load->model($this->config->item("rg_folder").'mo_rg_studentabsent','sab');

            
$data['rs_sy'] = $rs_sy;
            
$data['rs_sab'] = $this->sab->qrySabBySabStdIdAndGEAdYJoinSy($stdId,$std->row()->stdAdY);

            
$con_qu_std = array('stdId'    => $stdId);
            
$data['qu_std'] = $std;

            
$opt = array();
            
$opt[1] = "ลาป่วย";
            
$opt[2] = "ลากิจ";
            
$opt[3] = "ขาดเรียน";
            
$data['rs_absentCause'] = $opt;

            
$this->contents['v'] = $this->load->view($this->config->item('rg_folder').'v_editStudentMBInfo4',$data,TRUE);
        } else if(
$tab==5) {
            
$this->load->model($this->config->item("rg_folder").'mo_rg_studentbehavior','sbe');

            
$data['rs_tm'] = $rs_tm;
            
$data['qu_std'] = $std;

            
$data['rs_sbe'] = $this->sbe->qrySbeBySbeStdIdAndGEAdYJoinTmDcp($stdId,$std->row()->stdAdY);

            
$this->contents['v'] = $this->load->view($this->config->item('rg_folder').'v_editStudentMBInfo5',$data,TRUE);
        } else if(
$tab==6) {
            
$this->load->model($this->config->item("rg_folder").'mo_rg_studentreward','srw');

            
$data['qu_std'] = $std;

            
$con_rs_srw = array('srwStdId'    => $stdId);
            
$ord_rs_srw = array('srwReceiveDate'    => 'DESC');
            
$data['rs_srw'] = $this->srw->qrySrw($con_rs_srw,$ord_rs_srw);

            
$this->contents['v'] = $this->load->view($this->config->item('rg_folder').'v_editStudentMBInfo6',$data,TRUE);
        }

        
$this->contents['act'] = $data['act'];
        
$this->contents['tab'] = $tab;

        
$this->output($this->config->item("rg_folder")."v_editStudentMBInfoTC"$this->session->flashdata('msg'));
    }
    function 
std_editStdMBInfo($tb=0$id=0) {
        
$this->load->model($this->config->item("ppc_folder").'mo_prefix','pf');
        
$this->load->model($this->config->item("rg_folder").'mo_rg_config','cfg');
        
$this->load->model($this->config->item("rg_folder").'mo_rg_student','std');
        
$this->load->model($this->config->item("rg_folder").'mo_rg_studentdetails','sdt');
        
$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_person','prs');
        
$this->load->model($this->config->item("rg_folder").'mo_rg_classteacher','ctc');
        
$this->load->model($this->config->item("rg_folder").'mo_rg_adviser','adv');

        
// นักศึกษา
        
$con_std_login = array('stdCode'    => $this->session->userdata('UsPsCode'));
        
$std_login $this->std->qryStd($con_std_login);

        
// เช็คนักศึกษา
        
if($std_login->num_rows()) {
            
$stdId_login $std_login->row()->stdId;
            
$tab $this->input->post('tab')=='' ? ($tb==$tb) : $this->input->post('tab');
            
$stdId $this->input->post('stdId')=="" $stdId_login $this->input->post('stdId');
            
$act 'Y';
        } else {
            
$tab $this->input->post('tab')=='' ? ($tb==$tb) : $this->input->post('tab');
            
$stdId $this->input->post('stdId')=="" $id $this->input->post('stdId');
        }

        
$data['act'] = (isset($act) && ($act=='Y')) ? $act 'N';
        
$data['tab'] = $tab;
        
$data['stdId'] = $stdId;
        
$data['qu_cfg'] = $this->cfg->qryCfg();
        
$data['acY'] = $this->session->userdata('acY');
        
$data['tmId'] = $this->session->userdata('tmId');
        
$rs_tm $this->tm->get_options('','','','n');
        
$rs_sy $this->sy->get_options('','','','n');
        
$rs_pf $this->pf->get_options();

        
$this->std->stdId $stdId;
        
$std $this->std->get_by_key();
        
//--[data for v_showStudentDetails]--
        
$qu_std $this->std->qryStdMB($stdId);
        
$con_ctc = array();
        
$con_adv = array();
        if(
$qu_std->num_rows()) {
            
$con_ctc = array('ctcCurId'    => $qu_std->row()->stdCurId,
                             
'ctcSyId'    => $qu_std->row()->stdSyId,
                             
'ctcAcY'    => $this->session->userdata('acY'));
            
$con_adv = array('advStdId'    => $qu_std->row()->stdId,
                             
'advAcY'    => $this->session->userdata('acY'),
                             
'advSyId'    => $qu_std->row()->stdSyId);
        }

        
$data['ctc'] = $this->ctc->qryCtcJoinPrs($con_ctc);
        
$data['adv'] = $this->adv->qryAdvJoinPrs($con_adv);
        
$data['qu_std'] = $qu_std;

        if(isset(
$act) && $act=="Y")
            
$this->contents['showDetails'] = $this->load->view($this->config->item('rg_folder').'v_showStudentDetails',$data,TRUE);
        
//--[data for v_showStudentDetails]--

        
if($tab==1) {
            
$this->load->model($this->config->item("rg_folder").'mo_rg_entrytype','et');
            
$this->load->model($this->config->item("rg_folder").'mo_rg_preadmit','pa');
            
$this->load->model($this->config->item("rg_folder").'mo_rg_healthprivilege','hp');

            
$data['rs_pf'] = $rs_pf;

            
$con_parent = array('sdtStdId'    => $stdId);
            
$data['parent'] = $this->sdt->qrySdtJoinPfDtApPrv($con_parent);
            
$data['rs_et'] = $this->et->get_options('','','','n');
            
$data['rs_pa'] = $this->pa->get_options('','','','n');
            
$data['rs_hp'] = $this->hp->get_options('','','','n');

            
$this->contents['showDetails'] = $this->load->view($this->config->item('rg_folder').'v_showStudentDetails',$data,TRUE);
            
$this->contents['v'] = $this->load->view($this->config->item('rg_folder').'v_editStudentMBInfo1',$data,TRUE);
        } else if(
$tab==2) {
            
$this->load->model($this->config->item("rg_folder").'mo_rg_edudegree','edg');
            
$this->load->model($this->config->item("rg_folder").'mo_rg_maritalstatus','ms');
            
$this->load->model($this->config->item("rg_folder").'mo_rg_recruitmenttype','rt');
            
$this->load->model($this->config->item("ppc_folder").'mo_nation','nt');
            
$this->load->model($this->config->item("ppc_folder").'mo_religion','rlg');
            
$this->load->model($this->config->item("ppc_folder").'mo_province','prv');
            
$this->load->model($this->config->item("ppc_folder").'mo_country','cnt');

            
$ord_rs_edg = array('edgName'    => '');
            
$data['rs_edg'] = $this->edg->get_options('',$ord_rs_edg);

            
$ord_rs_nt = array('nationName'    => '');
            
$data['rs_nt'] = $this->nt->get_options('',$ord_rs_nt);

            
$ord_rs_rlg = array('religionName'    => '');
            
$data['rs_rlg'] = $this->rlg->get_options('',$ord_rs_rlg);

            
$ord_rs_prv = array('provinceName'    => '');
            
$data['rs_prv'] = $this->prv->get_options('',$ord_rs_prv);

            
$ord_rs_cnt = array('countryName'    => '');
            
$data['rs_cnt'] = $this->cnt->get_options('',$ord_rs_cnt);

            
$ord_rs_ms = array('msName'    => '');
            
$data['rs_ms'] = $this->ms->get_options('',$ord_rs_ms);

            
$data['rs_rt'] = $this->rt->get_options();

            
$opt = array();
            
$opt[''] = "";
            
$opt['P'] = "ผ่าน";
            
$opt['F'] = "ไม่ผ่าน";
            
$data['rs_occExamResult'] = $opt;
            
$data['qu_sdt'] = $this->sdt->qrySdtMB($stdId);
            
$opt2 = array();
            
$opt2[''] = "";
            
$opt2[1] = "กำลังทำงานอยู่";
            
$opt2[2] = "ลาศึกษาต่อ";
            
$opt2[3] = "ลาออก";
            
$data['rs_workstatus'] = $opt2;

            
$opt3 = array();
            
$opt3[1] = "มีชีวิตอยู่";
            
$opt3[2] = "หย่าร้าง";
            
$opt3[3] = "ตาย";
            
$data['rs_status'] = $opt3;

            
$data['home'] = $this->sdt->qryAddrOfHomeJoinDtApPrv($stdId);
            
$data['current'] = $this->sdt->qryAddrOfCurrentJoinDtApPrv($stdId);
            
$data['work'] = $this->sdt->qryAddrOfWorkJoinDtApPrv($stdId);
            
$data['father'] = $this->sdt->qryAddrOfFatherJoinDtApPrv($stdId);
            
$data['mother'] = $this->sdt->qryAddrOfMotherJoinDtApPrv($stdId);
            
$data['contact'] = $this->sdt->qryAddrOfContactJoinDtApPrv($stdId);
            
$data['graduate'] = $this->sdt->qryAddrOfGraduateJoinDtApPrv($stdId);

            
$this->contents['v'] = $this->load->view($this->config->item('rg_folder').'v_editStudentMBInfo2',$data,TRUE);
        } else if(
$tab==3) {
            
$this->load->model($this->config->item("rg_folder").'mo_rg_studentactivity','sac');

            
$data['rs_tm'] = $rs_tm;
            
$data['rs_sy'] = $rs_sy;

            
$data['qu_std'] = $std;
            
$data['rs_sac'] = $this->sac->qrySacBySacStdIdAndGEAdYJoinTmSy($stdId,$std->row()->stdAdY);

            
$this->contents['v'] = $this->load->view($this->config->item('rg_folder').'v_editStudentMBInfo3',$data,TRUE);
        } else if(
$tab==4) {
            
$this->load->model($this->config->item("rg_folder").'mo_rg_studentabsent','sab');

            
$data['rs_sy'] = $rs_sy;
            
$data['rs_sab'] = $this->sab->qrySabBySabStdIdAndGEAdYJoinSy($stdId,$std->row()->stdAdY);

            
$con_qu_std = array('stdId'    => $stdId);
            
$data['qu_std'] = $std;

            
$opt = array();
            
$opt[1] = "ลาป่วย";
            
$opt[2] = "ลากิจ";
            
$opt[3] = "ขาดเรียน";
            
$data['rs_absentCause'] = $opt;

            
$this->contents['v'] = $this->load->view($this->config->item('rg_folder').'v_editStudentMBInfo4',$data,TRUE);
        } else if(
$tab==5) {
            
$this->load->model($this->config->item("rg_folder").'mo_rg_studentbehavior','sbe');

            
$data['rs_tm'] = $rs_tm;
            
$data['qu_std'] = $std;

            
$data['rs_sbe'] = $this->sbe->qrySbeBySbeStdIdAndGEAdYJoinTmDcp($stdId,$std->row()->stdAdY);

            
$this->contents['v'] = $this->load->view($this->config->item('rg_folder').'v_editStudentMBInfo5',$data,TRUE);
        } else if(
$tab==6) {
            
$this->load->model($this->config->item("rg_folder").'mo_rg_studentreward','srw');

            
$data['qu_std'] = $std;

            
$con_rs_srw = array('srwStdId'    => $stdId);
            
$ord_rs_srw = array('srwReceiveDate'    => 'DESC');
            
$data['rs_srw'] = $this->srw->qrySrw($con_rs_srw,$ord_rs_srw);

            
$this->contents['v'] = $this->load->view($this->config->item('rg_folder').'v_editStudentMBInfo6',$data,TRUE);
        }else if(
$tab== 7){
            
$data['std'] = $std;
            
$this->contents['v'] = $this->load->view($this->config->item('rg_folder').'v_editStudentMBInfo7',$data,TRUE);
        }

        
$this->contents['act'] = $data['act'];
        
$this->contents['tab'] = $tab;

        
$this->output($this->config->item("rg_folder")."v_editStudentMBInfo"$this->session->flashdata('msg'));
    }
    function 
std_insertStdMBInfo1() {
        
$this->load->library('form_validation');
        
$this->form_validation->set_error_delimiters('<div class="error">','</div>');
        
$this->form_validation->set_rules('stdId',' ','trim|required|xss_clean');
        
$this->form_validation->set_rules('tab',' ','trim|required|xss_clean');
        
$this->form_validation->set_rules('stdPfId',' ','trim|required|xss_clean');
        
$this->form_validation->set_rules('stdName',' ','trim|required|xss_clean');
        
$this->form_validation->set_rules('stdSurname',' ','trim|required|xss_clean');
        
$this->form_validation->set_rules('sdtPfIdParent',' ','trim|xss_clean');
        
$this->form_validation->set_rules('sdtParentName',' ','trim|xss_clean');
        
$this->form_validation->set_rules('sdtParentSurname',' ','trim|xss_clean');
        
$this->form_validation->set_rules('sdtParentRelationship',' ','trim|xss_clean');
        
$this->form_validation->set_rules('sdtParentAddr',' ','trim|xss_clean');
        
$this->form_validation->set_rules('dtNameParent',' ','trim|xss_clean');
        
$this->form_validation->set_rules('sdtDtIdParent',' ','trim|xss_clean');
        
$this->form_validation->set_rules('apNameParent',' ','trim|xss_clean');
        
$this->form_validation->set_rules('sdtApIdParent',' ','trim|xss_clean');
        
$this->form_validation->set_rules('prvNameParent',' ','trim|xss_clean');
        
$this->form_validation->set_rules('sdtPrvIdParent',' ','trim|xss_clean');
        
$this->form_validation->set_rules('sdtParentPostCode',' ','trim|integer|min_length[5]|xss_clean');
        
$this->form_validation->set_rules('sdtParentPhoneNo',' ','trim|xss_clean'); // integer|min_length[9]|
        
$this->form_validation->set_rules('sdtParentMobileNo',' ','trim|xss_clean'); // integer|min_length[10]|
        
$this->form_validation->set_rules('sdtParentOccupation',' ','trim|xss_clean');
        
$this->form_validation->set_rules('sdtParentIncome',' ','trim|integer|xss_clean');
        
$this->form_validation->set_rules('sdtParentEmail',' ','trim|xss_clean');
        
$this->form_validation->set_rules('soName',' ','trim|xss_clean');
        
$this->form_validation->set_rules('stdSoId',' ','trim|required|xss_clean');
        
$this->form_validation->set_rules('prvNameSo',' ','trim|xss_clean');
        
$this->form_validation->set_rules('stdEtId',' ','trim|required|xss_clean');
        
$this->form_validation->set_rules('stdPaId',' ','trim|xss_clean');
        
$this->form_validation->set_rules('sdtCanRefund',' ','trim|xss_clean');
        
$this->form_validation->set_rules('sdtHpId',' ','trim|xss_clean');

        if(
$this->form_validation->run() == true) {
            
$this->load->model($this->config->item("rg_folder").'mo_rg_student','std');
            
$this->load->model($this->config->item("rg_folder").'mo_rg_studentdetails','sdt');

            
$stdId $this->input->post('stdId');
            
$tab $this->input->post('tab');
            
$stdPfId $this->input->post('stdPfId');
            
$stdName $this->input->post('stdName');
            
$stdSurname $this->input->post('stdSurname');
            
$sdtPfIdParent $this->input->post('sdtPfIdParent');
            
$sdtParentName $this->input->post('sdtParentName');
            
$sdtParentSurname $this->input->post('sdtParentSurname');
            
$sdtParentRelationship $this->input->post('sdtParentRelationship');
            
$sdtParentAddr $this->input->post('sdtParentAddr');
            
$sdtDtIdParent $this->input->post('sdtDtIdParent');
            
$sdtApIdParent $this->input->post('sdtApIdParent');
            
$sdtPrvIdParent $this->input->post('sdtPrvIdParent');
            
$sdtParentPostCode $this->input->post('sdtParentPostCode');
            
$sdtParentPhoneNo $this->input->post('sdtParentPhoneNo');
            
$sdtParentMobileNo $this->input->post('sdtParentMobileNo');
            
$sdtParentOccupation $this->input->post('sdtParentOccupation');
            
$sdtParentIncome $this->input->post('sdtParentIncome');
            
$sdtParentEmail $this->input->post('sdtParentEmail');
            
$stdSoId $this->input->post('stdSoId');
            
$stdEtId $this->input->post('stdEtId');
            
$stdPaId $this->input->post('stdPaId');
            
$sdtCanRefund $this->input->post('sdtCanRefund');
            
$sdtHpId $this->input->post('sdtHpId');

            
$flgmsg 0;
            
$this->db->trans_begin();
            
$this->std->stdId $stdId;
            
$this->std->get_by_key(TRUE);
            
$this->std->stdPfId $stdPfId;
            
$this->std->stdName $stdName;
            
$this->std->stdSurname $stdSurname;
            
$this->std->stdSoId $stdSoId;
            
$this->std->stdEtId $stdEtId;
            
$this->std->stdPaId $stdPaId;
            
$this->std->stdUpdateDate date('Y-m-d H:i:s');
            
$this->std->stdUpdateUsLogin $this->session->userdata('UsLogin');
//            if($this->std->stdSstId!=4) {
//                $this->std->update();
//            }

            
if(strpos('1234'$this->std->stdSstId) !== false) {
                
$this->std->update();
            }


            
$this->sdt->sdtStdId $stdId;
            
$this->sdt->get_by_key(TRUE);
            
$this->sdt->sdtPfIdParent = ($sdtPfIdParent) ? $sdtPfIdParent NULL;
            
$this->sdt->sdtParentName $sdtParentName;
            
$this->sdt->sdtParentSurname $sdtParentSurname;
            
$this->sdt->sdtParentRelationship $sdtParentRelationship;
            
$this->sdt->sdtParentAddr $sdtParentAddr;
            
$this->sdt->sdtDtIdParent = ($sdtDtIdParent) ? $sdtDtIdParent NULL;
            
$this->sdt->sdtApIdParent = ($sdtApIdParent) ? $sdtApIdParent NULL;
            
$this->sdt->sdtPrvIdParent = ($sdtPrvIdParent) ? $sdtPrvIdParent NULL;
            
$this->sdt->sdtParentPostCode $sdtParentPostCode;
            
$this->sdt->sdtParentPhoneNo $sdtParentPhoneNo;
            
$this->sdt->sdtParentMobileNo $sdtParentMobileNo;
            
$this->sdt->sdtParentOccupation $sdtParentOccupation;
            
$this->sdt->sdtParentIncome $sdtParentIncome;
            
$this->sdt->sdtParentEmail $sdtParentEmail;
            
$this->sdt->sdtCanRefund $sdtCanRefund;
            
$this->sdt->sdtHpId = ($sdtHpId) ? $sdtHpId NULL;

            if(
strpos('1234'$this->std->stdSstId) !== false) {
                
$this->sdt->update();
                
$flgmsg 10;
            } else {
                
$flgmsg 20;
            }

//            if($this->std->stdSstId!=4) {
//                $this->sdt->update();
//                $flgmsg = 10;
//            } else {
//                $flgmsg = 22;
//            }

            
if($this->db->trans_status() === false) {
                
$this->db->trans_rollback();
                
$this->session->set_flashdata('msg'$flgmsg);
            } else {
                
$this->db->trans_commit();
                
$this->session->set_flashdata('msg'$flgmsg);
            }

            
redirect($this->config->item("rg_folder")."studentinfo/std_editStdMBInfo/$tab/$stdId");
        } else {
            
$this->std_editStdMBInfo();
        }
    }
    function 
std_insertStdMBInfo2() {
        
$this->load->library('form_validation');
        
$this->form_validation->set_error_delimiters('<div class="error">','</div>');
        
$this->form_validation->set_rules('stdId',' ','trim|required|xss_clean');
        
$this->form_validation->set_rules('stdCode',' ','trim|required|xss_clean');
        
$this->form_validation->set_rules('tab',' ','trim|required|xss_clean');
        
$this->form_validation->set_rules('stdNameE',' ','trim|required|xss_clean');
        
$this->form_validation->set_rules('stdSurnameE',' ','trim|required|xss_clean');
        
$this->form_validation->set_rules('sdtOldName',' ','trim|xss_clean');
        
$this->form_validation->set_rules('sdtEdgIdPre',' ','trim|xss_clean');
        
$this->form_validation->set_rules('sdtEmail',' ','trim|required|xss_clean');
        
$this->form_validation->set_rules('sdtPicturePath','รูปภาพนักศึกษา','trim|xss_clean');
        
$this->form_validation->set_rules('sdtSex',' ','trim|xss_clean');
        
$this->form_validation->set_rules('sdtBloodGroup',' ','trim|alpha|xss_clean');
        
$this->form_validation->set_rules('sdtNtId',' ','trim|xss_clean');
        
$this->form_validation->set_rules('sdtRlgId',' ','trim|xss_clean');
        
$this->form_validation->set_rules('sdtBirthDate',' ','trim|xss_clean');
        
$this->form_validation->set_rules('sdtPrvIdBirth',' ','trim|xss_clean');
        
$this->form_validation->set_rules('sdtCntId',' ','trim|xss_clean');
        
$this->form_validation->set_rules('sdtMsId',' ','trim|xss_clean');
        
$this->form_validation->set_rules('sdtWeight',' ','trim|numeric|xss_clean');
        
$this->form_validation->set_rules('sdtRtId',' ','trim|xss_clean');
        
$this->form_validation->set_rules('sdtHeight',' ','trim|numeric|xss_clean');
        
$this->form_validation->set_rules('sdtOccExamResult',' ','trim|xss_clean');
        
/* ---- */
        
$this->form_validation->set_rules('sdtHomeAddr',' ','trim|xss_clean');
        
$this->form_validation->set_rules('dtNameHome',' ','trim|xss_clean');
        
$this->form_validation->set_rules('sdtDtIdHome',' ','trim|xss_clean');
        
$this->form_validation->set_rules('apNameHome',' ','trim|xss_clean');
        
$this->form_validation->set_rules('sdtApIdHome',' ','trim|xss_clean');
        
$this->form_validation->set_rules('prvNameHome',' ','trim|xss_clean');
        
$this->form_validation->set_rules('sdtPrvIdHome',' ','trim|xss_clean');
        
$this->form_validation->set_rules('sdtHomePostCode',' ','trim|integer|min_length[5]|xss_clean'); 
        
$this->form_validation->set_rules('sdtHomePhoneNo',' ','trim|xss_clean'); // integer|min_length[9]|
        /* ---- */
        
$this->form_validation->set_rules('sdtCurrentAddr',' ','trim|xss_clean');
        
$this->form_validation->set_rules('dtNameCurrent',' ','trim|xss_clean');
        
$this->form_validation->set_rules('sdtDtIdCurrent',' ','trim|xss_clean');
        
$this->form_validation->set_rules('apNameCurrent',' ','trim|xss_clean');
        
$this->form_validation->set_rules('sdtApIdCurrent',' ','trim|xss_clean');
        
$this->form_validation->set_rules('prvNameCurrent',' ','trim|xss_clean');
        
$this->form_validation->set_rules('sdtPrvIdCurrent',' ','trim|xss_clean');
        
$this->form_validation->set_rules('sdtCurrentPostCode',' ','trim|integer|min_length[5]|xss_clean');
        
$this->form_validation->set_rules('sdtCurrentPhoneNo',' ','trim|xss_clean'); // integer|min_length[9]|
        /* ---- */
        
$this->form_validation->set_rules('sdtWorkName',' ','trim|xss_clean');
        
$this->form_validation->set_rules('sdtWorkAddr',' ','trim|xss_clean');
        
$this->form_validation->set_rules('dtNameWork',' ','trim|xss_clean');
        
$this->form_validation->set_rules('sdtDtIdWork',' ','trim|xss_clean');
        
$this->form_validation->set_rules('apNameWork',' ','trim|xss_clean');
        
$this->form_validation->set_rules('sdtApIdWork',' ','trim|xss_clean');
        
$this->form_validation->set_rules('prvNameWork',' ','trim|xss_clean');
        
$this->form_validation->set_rules('sdtPrvIdWork',' ','trim|xss_clean');
        
$this->form_validation->set_rules('sdtWorkPostCode',' ','trim|integer|min_length[5]|xss_clean');
        
$this->form_validation->set_rules('sdtWorkPhoneNo',' ','trim|xss_clean');  // integer|min_length[9]|
        
$this->form_validation->set_rules('sdtWorkSalary',' ','trim|integer|xss_clean');
        
$this->form_validation->set_rules('sdtWorkStatus',' ','trim|xss_clean');
        
$this->form_validation->set_rules('sdtWorkPosition',' ','trim|xss_clean');
        
/* ---- */
        
$this->form_validation->set_rules('sdtFatherName',' ','trim|xss_clean');
        
$this->form_validation->set_rules('sdtFatherSurname',' ','trim|xss_clean');
        
$this->form_validation->set_rules('sdtFatherStatus',' ','trim|xss_clean');
        
$this->form_validation->set_rules('sdtFatherAddr',' ','trim|xss_clean');
        
$this->form_validation->set_rules('dtNameFather',' ','trim|xss_clean');
        
$this->form_validation->set_rules('sdtDtIdFather',' ','trim|xss_clean');
        
$this->form_validation->set_rules('apNameFather',' ','trim|xss_clean');
        
$this->form_validation->set_rules('sdtApIdFather',' ','trim|xss_clean');
        
$this->form_validation->set_rules('prvNameFather',' ','trim|xss_clean');
        
$this->form_validation->set_rules('sdtPrvIdFather',' ','trim|xss_clean');
        
$this->form_validation->set_rules('sdtFatherPostCode',' ','trim|integer|min_length[5]|xss_clean');
        
$this->form_validation->set_rules('sdtFatherPhoneNo',' ','trim|xss_clean'); // integer|min_length[9]|
        
$this->form_validation->set_rules('sdtFatherOccupation',' ','trim|xss_clean');
        
/* ---- */
        
$this->form_validation->set_rules('sdtMotherName',' ','trim|xss_clean');
        
$this->form_validation->set_rules('sdtMotherSurname',' ','trim|xss_clean');
        
$this->form_validation->set_rules('sdtMotherStatus',' ','trim|xss_clean');
        
$this->form_validation->set_rules('sdtMotherAddr',' ','trim|xss_clean');
        
$this->form_validation->set_rules('dtNameMother',' ','trim|xss_clean');
        
$this->form_validation->set_rules('sdtDtIdMother',' ','trim|xss_clean');
        
$this->form_validation->set_rules('apNameMother',' ','trim|xss_clean');
        
$this->form_validation->set_rules('sdtApIdMother',' ','trim|xss_clean');
        
$this->form_validation->set_rules('prvNameMother',' ','trim|xss_clean');
        
$this->form_validation->set_rules('sdtPrvIdMother',' ','trim|xss_clean');
        
$this->form_validation->set_rules('sdtMotherPostCode',' ','trim|integer|min_length[5]|xss_clean');
        
$this->form_validation->set_rules('sdtMotherPhoneNo',' ','trim|xss_clean'); // integer|min_length[9]|
        
$this->form_validation->set_rules('sdtMotherOccupation',' ','trim|xss_clean');
        
/* ---- */
        
$this->form_validation->set_rules('sdtContactName',' ','trim|xss_clean');
        
$this->form_validation->set_rules('sdtContactAddr',' ','trim|xss_clean');
        
$this->form_validation->set_rules('dtNameContact',' ','trim|xss_clean');
        
$this->form_validation->set_rules('sdtDtIdContact',' ','trim|xss_clean');
        
$this->form_validation->set_rules('apNameContact',' ','trim|xss_clean');
        
$this->form_validation->set_rules('sdtApIdContact',' ','trim|xss_clean');
        
$this->form_validation->set_rules('prvNameContact',' ','trim|xss_clean');
        
$this->form_validation->set_rules('sdtPrvIdContact',' ','trim|xss_clean');
        
$this->form_validation->set_rules('sdtContactPostCode',' ','trim|integer|min_length[5]|xss_clean');
        
$this->form_validation->set_rules('sdtContactPhoneNo',' ','trim|xss_clean'); // integer|min_length[9]|
        /* ---- */
        
$this->form_validation->set_rules('sdtGraduateAddr',' ','trim|xss_clean');
        
$this->form_validation->set_rules('dtNameGrad',' ','trim|xss_clean');
        
$this->form_validation->set_rules('sdtDtIdGraduate',' ','trim|xss_clean');
        
$this->form_validation->set_rules('apNameGrad',' ','trim|xss_clean');
        
$this->form_validation->set_rules('sdtApIdGraduate',' ','trim|xss_clean');
        
$this->form_validation->set_rules('prvNameGrad',' ','trim|xss_clean');
        
$this->form_validation->set_rules('sdtPrvIdGraduate',' ','trim|xss_clean');
        
$this->form_validation->set_rules('sdtGraduatePostCode',' ','trim|integer|min_length[5]|xss_clean');
        
$this->form_validation->set_rules('sdtGraduatePhoneNo',' ','trim|xss_clean'); //integer|min_length[9]|

        
$config['upload_path'] = $this->config->item('rg_upload_pictureStd');
        
$config['allowed_types'] = 'jpg';
        
$config['max_width'] = $this->config->item('rg_allowed_width');
        
$config['max_height'] = $this->config->item('rg_allowed_height');
        
$config['max_size']    = $this->config->item('rg_upload_size');
        
$this->load->library('upload');
        foreach(
$_FILES as $key => $value) {
            if(
$_FILES['sdtPicturePath']['name']!=""){
                if(
file_exists($this->config->item('rg_upload_pictureStd').$this->input->post('stdCode').".jpg")) {
                    
rename ($this->config->item('rg_upload_pictureStd').$this->input->post('stdCode').".jpg"$this->config->item('rg_upload_pictureStd').$this->input->post('stdCode')."_old.jpg");
                }

                
$config['file_name'] = $this->input->post('stdCode');
                
$this->upload->initialize($config);
                if (
$this->upload->do_upload($key)){
                    if(
file_exists($this->config->item('rg_upload_pictureStd').$this->input->post('stdCode')."_old.jpg")) {
                        
unlink($this->config->item('rg_upload_pictureStd').$this->input->post('stdCode')."_old.jpg");
                    }

                    
$data = array('upload_data' => $this->upload->data());
                    
$path $data['upload_data']['file_name'];
                } else {
                    if(
file_exists($this->config->item('rg_upload_pictureStd').$this->input->post('stdCode')."_old.jpg")) {
                        
rename ($this->config->item('rg_upload_pictureStd').$this->input->post('stdCode')."_old.jpg"$this->config->item('rg_upload_pictureStd').$this->input->post('stdCode').".jpg");
                    }

                    
$error = array('error' => $this->upload->display_errors());
                    
$this->form_validation->set_rules('sdtPicturePath'trim($error['error']), 'callback_checkupload');
                }
            }
        }

        
///** mua update uoc_std */
        
$mua $this->load->database('mua'TRUE);
        
$qgetStd =  $mua->query('SELECT * 
                      FROM  regist.`rg_Student` 
                      WHERE  regist.`rg_Student`.`stdId` ='
.$this->input->post('stdId'));
        
$getStd $qgetStd->result();
        
$UocSTD_FAT_CITIZEN_ID $this->input->post('UocSTD_FAT_CITIZEN_ID');
        
$UocSTD_MOT_CITIZEN_ID $this->input->post('UocSTD_MOT_CITIZEN_ID');
        
$UocSTD_DEFORM_ID $this->input->post('UocSTD_DEFORM_ID');
        
$UocSTD_DEFORMCARD_ID $this->input->post('UocSTD_DEFORMCARD_ID');
        
$UocSTD_DEFORMCARD_STARTDATE  $this->input->post('UocSTD_DEFORMCARD_STARTDATE') ? date$this->input->post('UocSTD_DEFORMCARD_STARTDATE')):'0000-00-00';
        
$UocSTD_DEFORMCARD_ENDDATE $this->input->post('UocSTD_DEFORMCARD_ENDDATE') ? date$this->input->post('UocSTD_DEFORMCARD_ENDDATE')):'0000-00-00';
        
$UocSTD_TALENT $this->input->post('UocSTD_TALENT');
        
$UocSTD_HOUSE_ID $this->input->post('HOUSE_ID');
        
//$sql_UpdateUocStd = "Update uoc_std set FAT_CITIZEN_ID = '".$UocSTD_FAT_CITIZEN_ID."' where STD_ID = ".$UocSTD_id;
        //$mua->query($sql_UpdateUocStd);
        
$data = array(
            
'FAT_CITIZEN_ID' => $UocSTD_FAT_CITIZEN_ID ,
            
'MOT_CITIZEN_ID' => $UocSTD_MOT_CITIZEN_ID,
            
'DEFORM_ID' => $UocSTD_DEFORM_ID,
            
'DEFORMCARD_ID' => $UocSTD_DEFORMCARD_ID,
            
'DEFORMCARD_STARTDATE' => $UocSTD_DEFORMCARD_STARTDATE,
            
'DEFORMCARD_ENDDATE' => $UocSTD_DEFORMCARD_ENDDATE,
            
'TALENT' => $UocSTD_TALENT,
            
'HOUSE_ID'=> $UocSTD_HOUSE_ID
        
);
        
$mua->where('STD_ID'$getStd[0]->stdCode);
        
$mua->update('uoc_std'$data); 
       
///** mua update uoc_std */


        
if($this->form_validation->run() == true) {
            
$this->load->model($this->config->item("rg_folder").'mo_rg_studentdetails','sdt');
            
$this->load->model($this->config->item("rg_folder").'mo_rg_student','std');

            
$flgmsg 0;
            
$this->db->trans_begin();
            
$stdId $this->input->post('stdId');
            
$tab $this->input->post('tab');
            
$stdNameE $this->input->post('stdNameE');
            
$stdSurnameE $this->input->post('stdSurnameE');
            
$sdtOldName $this->input->post('sdtOldName');
            
$sdtEdgIdPre $this->input->post('sdtEdgIdPre');
            
$sdtEmail $this->input->post('sdtEmail');
            
$sdtSex $this->input->post('sdtSex');
            
$sdtBloodGroup $this->input->post('sdtBloodGroup');
            
$sdtNtId $this->input->post('sdtNtId');
            
$sdtRlgId $this->input->post('sdtRlgId');
            
$sdtBirthDate splitDateForm2($this->input->post('sdtBirthDate'),'-');
            
$sdtPrvIdBirth $this->input->post('sdtPrvIdBirth');
            
$sdtCntId $this->input->post('sdtCntId');
            
$sdtMsId $this->input->post('sdtMsId');
            
$sdtWeight $this->input->post('sdtWeight');
            
$sdtRtId $this->input->post('sdtRtId');
            
$sdtHeight $this->input->post('sdtHeight');
            
$sdtOccExamResult $this->input->post('sdtOccExamResult');
            
/* ------- */
            
$sdtHomeAddr $this->input->post('sdtHomeAddr');
            
$sdtDtIdHome $this->input->post('sdtDtIdHome');
            
$sdtApIdHome $this->input->post('sdtApIdHome');
            
$sdtPrvIdHome $this->input->post('sdtPrvIdHome');
            
$sdtHomePostCode $this->input->post('sdtHomePostCode');
            
$sdtHomePhoneNo $this->input->post('sdtHomePhoneNo');
            
/* ------- */
            
$sdtCurrentAddr $this->input->post('sdtCurrentAddr');
            
$sdtDtIdCurrent $this->input->post('sdtDtIdCurrent');
            
$sdtApIdCurrent $this->input->post('sdtApIdCurrent');
            
$sdtPrvIdCurrent $this->input->post('sdtPrvIdCurrent');
            
$sdtCurrentPostCode $this->input->post('sdtCurrentPostCode');
            
$sdtCurrentPhoneNo $this->input->post('sdtCurrentPhoneNo');
            
/* ---- */
            
$sdtWorkName $this->input->post('sdtWorkName');
            
$sdtWorkAddr $this->input->post('sdtWorkAddr');
            
$sdtDtIdWork $this->input->post('sdtDtIdWork');
            
$sdtApIdWork $this->input->post('sdtApIdWork');
            
$sdtPrvIdWork $this->input->post('sdtPrvIdWork');
            
$sdtWorkPostCode $this->input->post('sdtWorkPostCode');
            
$sdtWorkPhoneNo $this->input->post('sdtWorkPhoneNo');
            
$sdtWorkSalary $this->input->post('sdtWorkSalary');
            
$sdtWorkStatus $this->input->post('sdtWorkStatus');
            
$sdtWorkPosition $this->input->post('sdtWorkPosition');
            
/* ---- */
            
$sdtFatherName $this->input->post('sdtFatherName');
            
$sdtFatherSurname $this->input->post('sdtFatherSurname');
            
$sdtFatherStatus $this->input->post('sdtFatherStatus');
            
$sdtFatherAddr $this->input->post('sdtFatherAddr');
            
$sdtDtIdFather $this->input->post('sdtDtIdFather');
            
$sdtApIdFather $this->input->post('sdtApIdFather');
            
$sdtPrvIdFather $this->input->post('sdtPrvIdFather');
            
$sdtFatherPostCode $this->input->post('sdtFatherPostCode');
            
$sdtFatherPhoneNo $this->input->post('sdtFatherPhoneNo');
            
$sdtFatherOccupation $this->input->post('sdtFatherOccupation');
            
/* ---- */
            
$sdtMotherName $this->input->post('sdtMotherName');
            
$sdtMotherSurname $this->input->post('sdtMotherSurname');
            
$sdtMotherStatus $this->input->post('sdtMotherStatus');
            
$sdtMotherAddr $this->input->post('sdtMotherAddr');
            
$sdtDtIdMother $this->input->post('sdtDtIdMother');
            
$sdtApIdMother $this->input->post('sdtApIdMother');
            
$sdtPrvIdMother $this->input->post('sdtPrvIdMother');
            
$sdtMotherPostCode $this->input->post('sdtMotherPostCode');
            
$sdtMotherPhoneNo $this->input->post('sdtMotherPhoneNo');
            
$sdtMotherOccupation $this->input->post('sdtMotherOccupation');
            
/* ---- */
            
$sdtContactName $this->input->post('sdtContactName');
            
$sdtContactAddr $this->input->post('sdtContactAddr');
            
$sdtDtIdContact $this->input->post('sdtDtIdContact');
            
$sdtApIdContact $this->input->post('sdtApIdContact');
            
$sdtPrvIdContact $this->input->post('sdtPrvIdContact');
            
$sdtContactPostCode $this->input->post('sdtContactPostCode');
            
$sdtContactPhoneNo $this->input->post('sdtContactPhoneNo');
            
/* ---- */
            
$sdtGraduateAddr $this->input->post('sdtGraduateAddr');
            
$sdtDtIdGraduate $this->input->post('sdtDtIdGraduate');
            
$sdtApIdGraduate $this->input->post('sdtApIdGraduate');
            
$sdtPrvIdGraduate $this->input->post('sdtPrvIdGraduate');
            
$sdtGraduatePostCode $this->input->post('sdtGraduatePostCode');
            
$sdtGraduatePhoneNo $this->input->post('sdtGraduatePhoneNo');

            
$this->std->stdId $stdId;
            
$this->std->get_by_key(TRUE);
            
$this->std->stdNameE trim(strtoupper($stdNameE));
            
$this->std->stdSurnameE trim(strtoupper($stdSurnameE));
            
$this->std->stdId $stdId;
            
//$this->std->stdId = $stdId;

            
$this->sdt->sdtStdId $stdId;
            
$this->sdt->get_by_key(TRUE);
            
$this->sdt->sdtOldName trim($sdtOldName);
            
$this->sdt->sdtEdgIdPre $sdtEdgIdPre;
            
$this->sdt->sdtEmail $sdtEmail;
            
$this->sdt->sdtSex $sdtSex;
            
$this->sdt->sdtBloodGroup trim(strtoupper($sdtBloodGroup));
            
$this->sdt->sdtNtId = ($sdtNtId) ? $sdtNtId NULL;
            
$this->sdt->sdtRlgId = ($sdtRlgId) ? $sdtRlgId NULL;
            
$this->sdt->sdtBirthDate $sdtBirthDate;
            
$this->sdt->sdtPrvIdBirth = ($sdtPrvIdBirth) ? $sdtPrvIdBirth NULL;
            
$this->sdt->sdtCntId = ($sdtCntId) ? $sdtCntId NULL;
            
$this->sdt->sdtMsId = ($sdtMsId) ? $sdtMsId NULL;
            
$this->sdt->sdtWeight $sdtWeight;
            
$this->sdt->sdtPicturePath = isset($path) ? $path $this->sdt->sdtPicturePath;
            
$this->sdt->sdtRtId = ($sdtRtId) ? $sdtRtId NULL;
            
$this->sdt->sdtHeight $sdtHeight;
            
$this->sdt->sdtOccExamResult $sdtOccExamResult;
            
/* ------- */
            
$this->sdt->sdtHomeAddr $sdtHomeAddr;
            
$this->sdt->sdtDtIdHome = ($sdtDtIdHome) ? $sdtDtIdHome NULL;
            
$this->sdt->sdtApIdHome = ($sdtApIdHome) ? $sdtApIdHome NULL;
            
$this->sdt->sdtPrvIdHome = ($sdtPrvIdHome) ? $sdtPrvIdHome NULL;
            
$this->sdt->sdtHomePostCode $sdtHomePostCode;
            
$this->sdt->sdtHomePhoneNo $sdtHomePhoneNo;
            
/* ------- */
            
$this->sdt->sdtCurrentAddr $sdtCurrentAddr;
            
$this->sdt->sdtDtIdCurrent = ($sdtDtIdCurrent) ? $sdtDtIdCurrent NULL;
            
$this->sdt->sdtApIdCurrent = ($sdtApIdCurrent) ? $sdtApIdCurrent NULL;
            
$this->sdt->sdtPrvIdCurrent = ($sdtPrvIdCurrent) ? $sdtPrvIdCurrent NULL;
            
$this->sdt->sdtCurrentPostCode $sdtCurrentPostCode;
            
$this->sdt->sdtCurrentPhoneNo $sdtCurrentPhoneNo;
            
/* ------- */
            
$this->sdt->sdtWorkName $sdtWorkName;
            
$this->sdt->sdtWorkAddr $sdtWorkAddr;
            
$this->sdt->sdtDtIdWork = ($sdtDtIdWork) ? $sdtDtIdWork NULL;
            
$this->sdt->sdtApIdWork = ($sdtApIdWork) ? $sdtApIdWork NULL;
            
$this->sdt->sdtPrvIdWork = ($sdtPrvIdWork) ? $sdtPrvIdWork NULL;
            
$this->sdt->sdtWorkPostCode $sdtWorkPostCode;
            
$this->sdt->sdtWorkPhoneNo $sdtWorkPhoneNo;
            
$this->sdt->sdtWorkSalary $sdtWorkSalary;
            
$this->sdt->sdtWorkStatus $sdtWorkStatus;
            
$this->sdt->sdtWorkPosition $sdtWorkPosition;
            
/* ------- */
            
$this->sdt->sdtFatherName $sdtFatherName;
            
$this->sdt->sdtFatherSurname $sdtFatherSurname;
            
$this->sdt->sdtFatherStatus $sdtFatherStatus;
            
$this->sdt->sdtFatherAddr $sdtFatherAddr;
            
$this->sdt->sdtDtIdFather = ($sdtDtIdFather) ? $sdtDtIdFather NULL;
            
$this->sdt->sdtApIdFather = ($sdtApIdFather) ? $sdtApIdFather NULL;
            
$this->sdt->sdtPrvIdFather = ($sdtPrvIdFather) ? $sdtPrvIdFather NULL;
            
$this->sdt->sdtFatherPostCode $sdtFatherPostCode;
            
$this->sdt->sdtFatherPhoneNo $sdtFatherPhoneNo;
            
$this->sdt->sdtFatherOccupation $sdtFatherOccupation;
            
/* ------- */
            
$this->sdt->sdtMotherName $sdtMotherName;
            
$this->sdt->sdtMotherSurname $sdtMotherSurname;
            
$this->sdt->sdtMotherStatus $sdtMotherStatus;
            
$this->sdt->sdtMotherAddr $sdtMotherAddr;
            
$this->sdt->sdtDtIdMother = ($sdtDtIdMother) ? $sdtDtIdMother NULL;
            
$this->sdt->sdtApIdMother = ($sdtApIdMother) ? $sdtApIdMother NULL;
            
$this->sdt->sdtPrvIdMother = ($sdtPrvIdMother) ? $sdtPrvIdMother NULL;
            
$this->sdt->sdtMotherPostCode $sdtMotherPostCode;
            
$this->sdt->sdtMotherPhoneNo $sdtMotherPhoneNo;
            
$this->sdt->sdtMotherOccupation $sdtMotherOccupation;
            
/* ------- */
            
$this->sdt->sdtContactName $sdtContactName;
            
$this->sdt->sdtContactAddr $sdtContactAddr;
            
$this->sdt->sdtDtIdContact = ($sdtDtIdContact) ? $sdtDtIdContact NULL;
            
$this->sdt->sdtApIdContact = ($sdtApIdContact) ? $sdtApIdContact NULL;
            
$this->sdt->sdtPrvIdContact = ($sdtPrvIdContact) ? $sdtPrvIdContact NULL;
            
$this->sdt->sdtContactPostCode $sdtContactPostCode;
            
$this->sdt->sdtContactPhoneNo $sdtContactPhoneNo;
            
/* ------- */
            
$this->sdt->sdtGraduateAddr $sdtGraduateAddr;
            
$this->sdt->sdtDtIdGraduate = ($sdtDtIdGraduate) ? $sdtDtIdGraduate NULL;
            
$this->sdt->sdtApIdGraduate = ($sdtApIdGraduate) ? $sdtApIdGraduate NULL;
            
$this->sdt->sdtPrvIdGraduate = ($sdtPrvIdGraduate) ? $sdtPrvIdGraduate NULL;
            
$this->sdt->sdtGraduatePostCode $sdtGraduatePostCode;
            
$this->sdt->sdtGraduatePhoneNo $sdtGraduatePhoneNo;
//            if($this->std->stdSstId!=4) {
//                $this->sdt->update();
//                $this->std->update();
//                $flgmsg = 10;
//            } else 
//                $flgmsg = 22;

            
if(strpos('1234'$this->std->stdSstId) !== false) {
                
$this->sdt->update();
                
$this->std->update();
                
$flgmsg 10;
            } else {
                
$flgmsg 20;
            }

            

            if(
$this->db->trans_status() === false) {
                
$this->db->trans_rollback();
                
$flgmsg 20;
                
$this->session->set_flashdata('msg'$flgmsg);
            } else {
                
$this->db->trans_commit();
                
$this->session->set_flashdata('msg'$flgmsg);
            }

            
redirect($this->config->item("rg_folder")."studentinfo/std_editStdMBInfo/$tab/$stdId");
        } else {
            
$this->std_editStdMBInfo();
        }
    }
    function 
std_insertStdMBInfo3() {
        
$this->load->library('form_validation');
        
$this->form_validation->set_error_delimiters('<div class="error">','</div>');
        
$this->form_validation->set_rules('tab',' ','trim|required|xss_clean');
        
$this->form_validation->set_rules('stdId',' ','trim|required|xss_clean');
        
$this->form_validation->set_rules('stdAdY',' ','trim|required|xss_clean');
        
$this->form_validation->set_rules('sacTmId',' ','trim|required|xss_clean');
        
$this->form_validation->set_rules('sacAcY',' ','trim|callback_checkAdY|callback_checkPreAdY|is_natural_no_zero|required|xss_clean');
        
$this->form_validation->set_rules('sacSyId',' ','trim|required|xss_clean');
        
$this->form_validation->set_rules('sacName',' ','trim|required|xss_clean');
        
$this->form_validation->set_rules('sacPosition',' ','trim|required|xss_clean');
        
$this->form_validation->set_rules('sacFrDate','วันที่เข้าร่วม','trim|callback_checkFrDate[sacToDate]|callback_checkPreDate[sacAcY]|callback_checkBetweenDateSac|xss_clean');
        
$this->form_validation->set_rules('sacToDate','วันที่สิ้นสุด','trim|callback_checkPreDate[sacAcY]|callback_checkBetweenDateSac|xss_clean');

        if(
$this->form_validation->run() == true) {
            
$this->load->model($this->config->item("rg_folder").'mo_rg_studentactivity','sac');
            
$this->load->model($this->config->item("rg_folder").'mo_rg_student','std');

            
$tab $this->input->post('tab');
            
$stdId $this->input->post('stdId');
            
$sacTmId $this->input->post('sacTmId');
            
$sacAcY $this->input->post('sacAcY');
            
$sacSyId $this->input->post('sacSyId');
            
$sacName $this->input->post('sacName');
            
$sacPosition $this->input->post('sacPosition');
            
$sacFrDate splitDateForm2($this->input->post('sacFrDate'),'-');
            
$sacToDate splitDateForm2($this->input->post('sacToDate'),'-');

            
$con_rs_sac = array('sacStdId'    => $stdId,
                                
'sacTmId'    => $sacTmId,
                                
'sacAcY'    => $sacAcY,
                                
'sacSyId'    => $sacSyId,
                                
'sacName'    => $sacName,
                                
'sacFrDate'    => $sacFrDate,
                                
'sacToDate'    => $sacToDate);
            
$rs_sac $this->sac->qrySac($con_rs_sac);

            
//---[]--- check สถานะเด็ก
            
$this->std->stdId $stdId;
            
$this->std->get_by_key(TRUE);

            
$flgmsg 0;
            
$this->db->trans_begin();
            if(!
$rs_sac->num_rows()) {
                
$this->sac->sacSeq $this->sac->getNextSacSeqBySacStdId($stdId);
                
$this->sac->sacStdId $stdId;
                
$this->sac->sacName $sacName;
                
$this->sac->sacAcY $sacAcY;
                
$this->sac->sacFrDate $sacFrDate;
                
$this->sac->sacToDate $sacToDate;
                
$this->sac->sacPosition $sacPosition;
                
$this->sac->sacSyId $sacSyId;
                
$this->sac->sacTmId $sacTmId;

                if(
strpos('1234'$this->std->stdSstId) !== false) {
                    
$this->sac->insert();
                    
$flgmsg 10;
                } else {
                    
$flgmsg 20;
                }
            }

            
$this->session->set_flashdata('msg'21);

            if(
$this->db->trans_status() === false) {
                
$this->db->trans_rollback();
                if(
$flgmsg)
                    
$this->session->set_flashdata('msg'$flgmsg);
                } else {
                
$this->db->trans_commit();
                if(
$flgmsg)
                    
$this->session->set_flashdata('msg'$flgmsg);
            }

            
redirect($this->config->item("rg_folder")."studentinfo/std_editStdMBInfo/$tab/$stdId");
        } else {
            
$this->std_editStdMBInfo();
        }
    }
    function 
std_insertStdMBInfo4() {
        
$this->load->library('form_validation');
        
$this->form_validation->set_error_delimiters('<div class="error">','</div>');
        
$this->form_validation->set_rules('tab',' ','trim|required|xss_clean');
        
$this->form_validation->set_rules('stdId',' ','trim|required|xss_clean');
        
$this->form_validation->set_rules('stdAdY',' ','trim|required|xss_clean');
        
$this->form_validation->set_rules('sabAcY',' ','trim|callback_checkAdY|callback_checkPreAdY|is_natural_no_zero|required|xss_clean');
        
$this->form_validation->set_rules('sabSyId',' ','trim|required|xss_clean');
        
$this->form_validation->set_rules('sabCause',' ','trim|xss_clean');
        
$this->form_validation->set_rules('sabFrDate','วันที่เริ่ม','trim|callback_checkFrDate[sabToDate]|callback_checkPreDate[sabAcY]|callback_checkBetweenDate|xss_clean');
        
$this->form_validation->set_rules('sabToDate','วันที่สิ้นสุด','trim|callback_checkPreDate[sabAcY]|callback_checkBetweenDate|xss_clean');

        if(
$this->form_validation->run() == true) {
            
$this->load->model($this->config->item("rg_folder").'mo_rg_studentabsent','sab');
            
$this->load->model($this->config->item("rg_folder").'mo_rg_student','std');

            
$tab $this->input->post('tab');
            
$stdId $this->input->post('stdId');
            
$sabAcY $this->input->post('sabAcY');
            
$sabSyId $this->input->post('sabSyId');
            
$sabCause $this->input->post('sabCause');
            
$sabFrDate splitDateForm2($this->input->post('sabFrDate'),'-');
            
$sabToDate splitDateForm2($this->input->post('sabToDate'),'-');

            
$con_rs_sab = array('sabStdId'    => $stdId,
                                
'sabAcY'    => $sabAcY,
                                
'sabSyId'    => $sabSyId,
                                
'sabFrDate'    => $sabFrDate,
                                
'sabToDate'    => $sabToDate);
            
$rs_sab $this->sab->qrySab($con_rs_sab);
            
$date $this->sab->qryBetWeenDateNotSabStdId($sabFrDate,$sabToDate,$stdId);

            
//---[]--- check สถานะเด็ก
            
$this->std->stdId $stdId;
            
$this->std->get_by_key(TRUE);

            
$flgmsg 0;
            
$this->db->trans_begin();
            if(!
$rs_sab->num_rows() && !$date->num_rows()) {
                
$this->sab->sabSeq $this->sab->getNextSabSeqBySabStdId($stdId);
                
$this->sab->sabStdId $stdId;
                
$this->sab->sabFrDate $sabFrDate;
                
$this->sab->sabToDate $sabToDate;
                
$this->sab->sabFrDate $sabFrDate;
                
$this->sab->sabAcY $sabAcY;
                
$this->sab->sabCause $sabCause;
                
$this->sab->sabSyId $sabSyId;

                if(
strpos('1234'$this->std->stdSstId) !== false) {
                    
$this->sab->insert();
                    
$flgmsg 10;
                } else {
                    
$flgmsg 20;
                }
            }

            
$this->session->set_flashdata('msg'21);

            if(
$this->db->trans_status() === false) {
                
$this->db->trans_rollback();
                if(
$flgmsg)
                    
$this->session->set_flashdata('msg'$flgmsg);
                } else {
                
$this->db->trans_commit();
                if(
$flgmsg)
                    
$this->session->set_flashdata('msg'$flgmsg);
            }

            
redirect($this->config->item("rg_folder")."studentinfo/std_editStdMBInfo/$tab/$stdId");
        } else {
            
$this->std_editStdMBInfo();
        }
    }
    function 
std_insertStdMBInfo5() {
        
$this->load->library('form_validation');
        
$this->form_validation->set_error_delimiters('<div class="error">','</div>');
        
$this->form_validation->set_rules('tab',' ','trim|required|xss_clean');
        
$this->form_validation->set_rules('stdId',' ','trim|required|xss_clean');
        
$this->form_validation->set_rules('stdAdY',' ','trim|required|xss_clean');
        
$this->form_validation->set_rules('sbeAcY',' ','trim|callback_checkAdY|callback_checkPreAdY|is_natural_no_zero|required|xss_clean');
        
$this->form_validation->set_rules('sbeTmId',' ','trim|xss_clean');
        
$this->form_validation->set_rules('sbeDescription',' ','trim|required|xss_clean');
        
$this->form_validation->set_rules('dcpName',' ','trim|xss_clean');
        
$this->form_validation->set_rules('sbeDcpId',' ','trim|required|xss_clean');
        
$this->form_validation->set_rules('sbeCutPoint',' ','trim|xss_clean');
        
$this->form_validation->set_rules('sbeRecordDate','วันที่เกิดเหตุ','trim|callback_checkSbeFrDate[sbeApproveDate]|callback_checkPreDate[sbeAcY]|required|xss_clean');
        
$this->form_validation->set_rules('sbeApproveDate','วันที่อนุมัติ','trim|callback_checkPreDate[sbeAcY]|required|xss_clean');

        if(
$this->form_validation->run() == true) {
            
$this->load->model($this->config->item("rg_folder").'mo_rg_studentbehavior','sbe');
            
$this->load->model($this->config->item("rg_folder").'mo_rg_student','std');

            
$tab $this->input->post('tab');
            
$stdId $this->input->post('stdId');
            
$sbeAcY $this->input->post('sbeAcY');
            
$sbeTmId $this->input->post('sbeTmId');
            
$sbeDescription $this->input->post('sbeDescription');
            
$sbeDcpId $this->input->post('sbeDcpId');
            
$sbeCutPoint $this->input->post('sbeCutPoint');
            
$sbeRecordDate splitDateForm2($this->input->post('sbeRecordDate'),'-');
            
$sbeApproveDate splitDateForm2($this->input->post('sbeApproveDate'),'-');

            
$con_rs_sbe = array('sbeStdId'            => $stdId,
                                
'sbeDescription'    => $sbeDescription,
                                
'sbeAcY'            => $sbeAcY,
                                
'sbeTmId'            => $sbeTmId,
                                
'sbeDcpId'            => $sbeDcpId,
                                
'sbeCutPoint'        => $sbeCutPoint);
            
$rs_sbe $this->sbe->qrySbe($con_rs_sbe);

            
//---[]--- check สถานะเด็ก
            
$this->std->stdId $stdId;
            
$this->std->get_by_key(TRUE);

            
$flgmsg 0;
            
$this->db->trans_begin();
            if(!
$rs_sbe->num_rows()) {
                
$this->sbe->sbeSeq $this->sbe->getNextSbeSeqBySbeStdId($stdId);
                
$this->sbe->sbeStdId $stdId;
                
$this->sbe->sbeCreateDate date('Y-m-d H:i:s');
                
$this->sbe->sbeRecordDate $sbeRecordDate;
                
$this->sbe->sbeAcY $sbeAcY;
                
$this->sbe->sbeDescription $sbeDescription;
                
$this->sbe->sbeCutPoint $sbeCutPoint;
                
$this->sbe->sbeApproveDate $sbeApproveDate;
                
$this->sbe->sbeTmId $sbeTmId;
                
$this->sbe->sbeDcpId $sbeDcpId;
                
$this->sbe->sbePrsId $this->session->userdata('UsLogin');

                if(
strpos('1234'$this->std->stdSstId) !== false) {
                    
$this->sbe->insert();
                    
$flgmsg 10;
                } else {
                    
$flgmsg 20;
                }
            }

            
$this->session->set_flashdata('msg'21);

            if(
$this->db->trans_status() === false) {
                
$this->db->trans_rollback();
                if(
$flgmsg)
                    
$this->session->set_flashdata('msg'$flgmsg);
                } else {
                
$this->db->trans_commit();
                if(
$flgmsg)
                    
$this->session->set_flashdata('msg'$flgmsg);
            }

            
redirect($this->config->item("rg_folder")."studentinfo/std_editStdMBInfo/$tab/$stdId");
        } else {
            
$this->std_editStdMBInfo();
        }
    }
    function 
std_insertStdMBInfo6() {
        
$this->load->library('form_validation');
        
$this->form_validation->set_error_delimiters('<div class="error">','</div>');
        
$this->form_validation->set_rules('tab',' ','trim|required|xss_clean');
        
$this->form_validation->set_rules('stdId',' ','trim|required|xss_clean');
        
$this->form_validation->set_rules('stdAdY',' ','trim|required|xss_clean');
        
$this->form_validation->set_rules('srwRewardName',' ','trim|required|xss_clean');
        
$this->form_validation->set_rules('srwDescription',' ','trim|required|xss_clean');
        
$this->form_validation->set_rules('srwReceiveDate','วันที่รับรางวัล','trim|callback_checkPreDate[stdAdY]|xss_clean');

        if(
$this->form_validation->run() == true) {
            
$this->load->model($this->config->item("rg_folder").'mo_rg_studentreward','srw');
            
$this->load->model($this->config->item("rg_folder").'mo_rg_student','std');

            
$tab $this->input->post('tab');
            
$stdId $this->input->post('stdId');
            
$adY $this->input->post('stdAdY');
            
$srwRewardName $this->input->post('srwRewardName');
            
$srwDescription $this->input->post('srwDescription');
            
$srwReceiveDate splitDateForm2($this->input->post('srwReceiveDate'),'-');

            
$con_rs_srw = array('srwStdId'            => $stdId,
                                
'srwRewardName'        => $srwRewardName,
                                
'srwDescription'    => $srwDescription,
                                
'srwReceiveDate'    => $srwReceiveDate);
            
$rs_srw $this->srw->qrySrw($con_rs_srw);

            
//---[]--- check สถานะเด็ก
            
$this->std->stdId $stdId;
            
$this->std->get_by_key(TRUE);

            
$flgmsg 0;
            
$this->db->trans_begin();
            if(!
$rs_srw->num_rows()) {
                
$this->srw->srwSeq $this->srw->getNextSrwSeqBySrwStdId($stdId);
                
$this->srw->srwStdId $stdId;
                
$this->srw->srwReceiveDate $srwReceiveDate;
                
$this->srw->srwRewardName $srwRewardName;;
                
$this->srw->srwDescription $srwDescription;

                if(
strpos('1234'$this->std->stdSstId) !== false) {
                    
$this->srw->insert();
                    
$flgmsg 10;
                } else {
                    
$flgmsg 20;
                }
            }

            
$this->session->set_flashdata('msg'21);

            if(
$this->db->trans_status() === false) {
                
$this->db->trans_rollback();
                if(
$flgmsg)
                    
$this->session->set_flashdata('msg'$flgmsg);
                } else {
                
$this->db->trans_commit();
                if(
$flgmsg)
                    
$this->session->set_flashdata('msg'$flgmsg);
            }

            
redirect($this->config->item("rg_folder")."studentinfo/std_editStdMBInfo/$tab/$stdId");
        } else {
            
$this->std_editStdMBInfo();
        }
    }
    function 
std_deleteStdMBInfo2() {
        
$this->load->model($this->config->item("rg_folder").'mo_rg_studentactivity','sac');

        
$sacStdId $this->input->post('sacStdId');
        
$sacSeq $this->input->post('sacSeq');
        
$tab $this->input->post('tab');
        
$stdId $this->input->post('stdId');

        
$this->sac->sacStdId $sacStdId;
        
$this->sac->sacSeq $sacSeq;
        
$this->sac->delete();

        if(
$this->db->trans_status() === false) {
            
$this->db->trans_rollback();
            
$this->session->set_flashdata('msg'41);
        } else {
            
$this->db->trans_commit();
            
$this->session->set_flashdata('msg'30);
        }

        
redirect($this->config->item("rg_folder")."studentinfo/std_editStdMBInfo/$tab/$stdId");
    }
    function 
std_deleteStdMBInfo4() {
        
$this->load->model($this->config->item("rg_folder").'mo_rg_studentabsent','sab');

        
$sabSeq $this->input->post('sabSeq');
        
$sabStdId $this->input->post('sabStdId');
        
$tab $this->input->post('tab');
        
$stdId $this->input->post('stdId');

        
$this->sab->sabSeq $sabSeq;
        
$this->sab->sabStdId $sabStdId;
        
$this->sab->delete();

        if(
$this->db->trans_status() === false) {
            
$this->db->trans_rollback();
            
$this->session->set_flashdata('msg'41);
        } else {
            
$this->db->trans_commit();
            
$this->session->set_flashdata('msg'30);
        }

        
redirect($this->config->item("rg_folder")."studentinfo/std_editStdMBInfo/$tab/$stdId");
    }
    function 
std_deleteStdMBInfo5() {
        
$this->load->model($this->config->item("rg_folder").'mo_rg_studentbehavior','sbe');

        
$sbeSeq $this->input->post('sbeSeq');
        
$sbeStdId $this->input->post('sbeStdId');
        
$tab $this->input->post('tab');
        
$stdId $this->input->post('stdId');

        
$this->sbe->sbeSeq $sbeSeq;
        
$this->sbe->sbeStdId $sbeStdId;
        
$this->sbe->delete();

        if(
$this->db->trans_status() === false) {
            
$this->db->trans_rollback();
            
$this->session->set_flashdata('msg'41);
        } else {
            
$this->db->trans_commit();
            
$this->session->set_flashdata('msg'30);
        }

        
redirect($this->config->item("rg_folder")."studentinfo/std_editStdMBInfo/$tab/$stdId");
    }
    function 
std_deleteStdMBInfo6() {
        
$this->load->model($this->config->item("rg_folder").'mo_rg_studentreward','srw');

        
$srwStdId $this->input->post('srwStdId');
        
$srwSeq $this->input->post('srwSeq');
        
$tab $this->input->post('tab');
        
$stdId $this->input->post('stdId');

        
$this->srw->srwStdId $srwStdId;
        
$this->srw->srwSeq $srwSeq;
        
$this->srw->delete();

        if(
$this->db->trans_status() === false) {
            
$this->db->trans_rollback();
            
$this->session->set_flashdata('msg'41);
        } else {
            
$this->db->trans_commit();
            
$this->session->set_flashdata('msg'30);
        }

        
redirect($this->config->item("rg_folder")."studentinfo/std_editStdMBInfo/$tab/$stdId");
    }
    
// ##### end stdMB

    // ##### start stdCensus
    
function showCensus() {
        
$this->load->model($this->config->item("rg_folder").'mo_rg_config','cfg');

        
$this->contents['qu_cfg'] = $this->cfg->qryCfg();

        
$this->output($this->config->item("rg_folder")."v_showCensus");
    }
    function 
addCensus() {
        
$this->load->library('form_validation');
        
$this->form_validation->set_error_delimiters('<div class="error">','</div>');
        
$this->form_validation->set_rules('curName',' ','trim|xss_clean');
        
$this->form_validation->set_rules('curId',' ','trim|required|xss_clean');
        
$this->form_validation->set_rules('adY',' ','trim|required|xss_clean');
        
$this->form_validation->set_rules('tmIdAdmit',' ','trim|xss_clean');
        
$this->form_validation->set_rules('syId',' ','trim|xss_clean');
        
$this->form_validation->set_rules('stdSyId',' ','trim|required|callback_checkSy|xss_clean');
        
$this->form_validation->set_rules('move',' ','trim|xss_clean');

        if(
$this->input->post('move')=='I') {
            
$this->form_validation->set_rules('addr',' ','trim|required|xss_clean');
            
$this->form_validation->set_rules('dtNameCurrent',' ','trim|required|xss_clean');
            
$this->form_validation->set_rules('sdtDtIdCurrent',' ','trim|required|xss_clean');
            
$this->form_validation->set_rules('apNameCurrent',' ','trim|required|xss_clean');
            
$this->form_validation->set_rules('sdtApIdCurrent',' ','trim|required|xss_clean');
            
$this->form_validation->set_rules('prvNameCurrent',' ','trim|required|xss_clean');
            
$this->form_validation->set_rules('sdtPrvIdCurrent',' ','trim|required|xss_clean');
            
$this->form_validation->set_rules('sdtCurrentPostCode',' ','trim|required|is_natural_no_zero|min_length[5]|xss_clean');
        }

        if(
$this->form_validation->run() == true) {
            
$this->load->model($this->config->item("rg_folder").'mo_rg_curriculum','cur');
            
$this->load->model($this->config->item("rg_folder").'mo_rg_studyyear','sy');
            
$this->load->model($this->config->item("rg_folder").'mo_rg_student','std');
            
$this->load->model($this->config->item("rg_folder").'mo_rg_studentdetails','sdt');
            
$this->load->model($this->config->item("rg_folder").'mo_rg_config','cfg');

            
$curId $this->input->post('curId');
            
$adY $this->input->post('adY');
            
$syId $this->input->post('stdSyId');
            
$move $this->input->post('move');
            
$addr $this->input->post('addr');
            
$dtNameCurrent $this->input->post('dtNameCurrent');
            
$apNameCurrent $this->input->post('apNameCurrent');
            
$prvNameCurrent $this->input->post('prvNameCurrent');
            
$sdtDtIdCurrent $this->input->post('sdtDtIdCurrent');
            
$sdtApIdCurrent $this->input->post('sdtApIdCurrent');
            
$sdtPrvIdCurrent $this->input->post('sdtPrvIdCurrent');
            
$sdtCurrentPostCode $this->input->post('sdtCurrentPostCode');

            
$this->contents['addr'] = $addr;
            
$this->contents['dtNameCurrent'] = $dtNameCurrent;
            
$this->contents['apNameCurrent'] = $apNameCurrent;
            
$this->contents['prvNameCurrent'] = $prvNameCurrent;
            
$this->contents['sdtDtIdCurrent'] = $sdtDtIdCurrent;
            
$this->contents['sdtApIdCurrent'] = $sdtApIdCurrent;
            
$this->contents['sdtPrvIdCurrent'] = $sdtPrvIdCurrent;
            
$this->contents['sdtCurrentPostCode'] = $sdtCurrentPostCode;
            
$this->contents['move'] = $move;
            
$this->contents['str_move'] = ($move=="I") ? "ย้ายทะเบียนเข้าสู่" "ย้ายทะเบียนจาก";

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

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

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

            
$con_rs_std = array('stdCurId'    => $curId,
                                
'stdAdY'    => $adY,
                                
'stdSyId'    => $syId,
                                
'stdSstId'    => '1');
            
$ord_rs_std = array('stdCode'    => '');
            
$rs_std $this->std->qryStdJoinPf($con_rs_std,$ord_rs_std);

            
$i 0;
            
$arr = array();
            if(
$rs_std->num_rows()) {
                foreach(
$rs_std->result() as $row_std) {
                    
$sdt_currentAddr $this->sdt->qryAddrOfCurrentJoinDtApPrv($row_std->stdId);
                    
$sdt_graduateAddr $this->sdt->qryAddrOfGraduateJoinDtApPrv($row_std->stdId);

                    
$arr[$i]['stdId'] = $row_std->stdId;
                    
$arr[$i]['stdCode'] = $row_std->stdCode;
                    
$arr[$i]['std'] = $row_std->prefixName.$row_std->stdName.' '.$row_std->stdSurname;

                    
// ที่อยู่ปัจจุบัน
                    
$arr[$i]['currentAddr'] = 
                    (
is_null($sdt_currentAddr->row()->sdtCurrentAddr) ? '' $sdt_currentAddr->row()->sdtCurrentAddr).
                    (
is_null($sdt_currentAddr->row()->dtNameCurrent) ? '' ' ต.'.$sdt_currentAddr->row()->dtNameCurrent).
                    (
is_null($sdt_currentAddr->row()->apNameCurrent) ? '' ' อ.'.$sdt_currentAddr->row()->apNameCurrent).
                    (
is_null($sdt_currentAddr->row()->prvNameCurrent) ? '' ' จ.'.$sdt_currentAddr->row()->prvNameCurrent.' ').
                    (
is_null($sdt_currentAddr->row()->sdtCurrentPostCode) ? '' $sdt_currentAddr->row()->sdtCurrentPostCode);

                    
// ที่อยู่หลังจบการศึกษา
                    
$arr[$i]['graduateAddr'] = 
                    (
is_null($sdt_graduateAddr->row()->sdtGraduateAddr) ? '' $sdt_graduateAddr->row()->sdtGraduateAddr).
                    (
is_null($sdt_graduateAddr->row()->dtNameGrad) ? '' ' ต.'.$sdt_graduateAddr->row()->dtNameGrad).
                    (
is_null($sdt_graduateAddr->row()->apNameGrad) ? '' ' อ.'.$sdt_graduateAddr->row()->apNameGrad).
                    (
is_null($sdt_graduateAddr->row()->prvNameGrad) ? '' ' จ.'.$sdt_graduateAddr->row()->prvNameGrad.' ').
                    (
is_null($sdt_graduateAddr->row()->sdtGraduatePostCode) ? '' $sdt_graduateAddr->row()->sdtGraduatePostCode);

                    
$i++;
                }
            }
            
$this->contents['arr'] = $arr;
            
            
$this->output($this->config->item("rg_folder")."v_addCensus");
        } else {
            
$this->showCensus();
        }
    }
    function 
census_insert_update() {
        
$this->load->model($this->config->item("rg_folder").'mo_rg_studentdetails','sdt');

        
$addr $this->input->post('addr');
        
$sdtDtIdCurrent $this->input->post('sdtDtIdCurrent');
        
$sdtApIdCurrent $this->input->post('sdtApIdCurrent');
        
$sdtPrvIdCurrent $this->input->post('sdtPrvIdCurrent');
        
$sdtCurrentPostCode $this->input->post('sdtCurrentPostCode');
        
$cnt $this->input->post('cnt');
        
$move $this->input->post('move');

        
$this->db->trans_begin();
        for(
$i=0$i<$cnt$i++) {
            if(
$this->input->post('chk'.$i)=='Y') {
                
$this->sdt->sdtStdId $this->input->post('stdId'.$i);
                
$this->sdt->get_by_key(TRUE);

                if(
$move=="I") {
                    
$this->sdt->sdtCurrentAddr $addr;
                    
$this->sdt->sdtCurrentPostCode $sdtCurrentPostCode;
                    
$this->sdt->sdtDtIdCurrent $sdtDtIdCurrent;
                    
$this->sdt->sdtApIdCurrent $sdtApIdCurrent;
                    
$this->sdt->sdtPrvIdCurrent $sdtPrvIdCurrent;
                } else {
                    
$this->sdt->sdtCurrentAddr $this->sdt->sdtGraduateAddr;
                    
$this->sdt->sdtCurrentPostCode $this->sdt->sdtGraduatePostCode;
                    
$this->sdt->sdtDtIdCurrent $this->sdt->sdtDtIdGraduate;
                    
$this->sdt->sdtApIdCurrent $this->sdt->sdtApIdGraduate;
                    
$this->sdt->sdtPrvIdCurrent $this->sdt->sdtPrvIdGraduate;
                }
                
$this->sdt->update();
            }
        }
        if(
$this->db->trans_status() === false) {
            
$this->db->trans_rollback();
        } else {
            
$this->db->trans_commit();
        }

        
redirect($this->config->item("rg_folder")."studentinfo/showCensus");
    }
    
// ##### end stdCensus

    // ##### start checkDebtStudent
    
function showDebt(){
        
$this->load->model($this->config->item("rg_folder").'mo_rg_student','std');
        
$this->load->model($this->config->item("rg_folder").'mo_rg_organization','org');
        
$this->load->model($this->config->item("rg_folder").'mo_rg_debt','dbt');
        
        
$stdCode $this->session->userdata('UsLogin');

        
$con_qu_std = array('stdCode' =>    $stdCode);
        
$qu_std $this->std->qryStdJoinPfCurSySstElv($con_qu_std,'');
        
$this->contents['qu_std'] = $qu_std;
        
        
$row_std = (isset($qu_std) && $qu_std!=NULL) ? $qu_std->row() : NULL;
        
        
$ord_rs_org = array('orgId'=>'');
        
$rs_org $this->org->qryOrg('',$ord_rs_org,'');
         
$arr = array();
        
$i 0;
        foreach(
$rs_org->result() as $row_org) {
            
$con_rs_dbt = array('dbtStdId'    => $row_std->stdId,
                                
'dbtOrgId'    => $row_org->orgId,
                                
'dbtRefNo'    => '');
            
$ord_rs_dbt = array(
            
'dbtAcY'=>'',
            
'dbtTmId'=>'',
            
'dbtSeq'=>''
            
);
            
$rs_dbt $this->dbt->qryDbt($con_rs_dbt,$ord_rs_dbt);
            
            
$arr[$i]['org'] = $row_org;
            
$arr[$i]['dbt'] = $rs_dbt;

            
$i++;
        }
        
        
$con_sumDbtAmt = array('dbtStdId'    => $row_std->stdId,
                                
'dbtRefNo'    => ''
                             
//  'dbtAcY'        => $acY,
                              // 'dbtTmId'    => $tmId
                              
);
        
$this->contents['sumDbtAmt'] = $this->dbt->getSumAmt($con_sumDbtAmt);
        
$this->contents['arr'] = $arr;
        
        
$this->load->model($this->config->item("ppc_folder").'mo_level','lv');
        
$this->lv->levelId $row_std->curElvId;
        
$this->contents['qu_lv'] = $this->lv->get_by_key();
        
        
$this->output($this->config->item("rg_folder")."v_std_showDbt");
    }
    
// ##### end checkDebtStudent

    // ##### start callback
    
function checkPreAdY($str) {
        
$sacAcY $str;
        
$stdAdY $this->input->post('stdAdY');

        if(
$sacAcY $stdAdY) {
            
$this->form_validation->set_message('checkPreAdY','ไม่ใช่ข้อมูลการทำกิจกรรมขณะศึกษาในวิทยาลัยนี้');
            return 
false;
        } else
            return 
true;
    }
    function 
checkPreDate($str,$field) {
        
$adYDate splitDateForm($str,'-');
        
$stdAdY $this->input->post('stdAdY');
        
$acY $this->input->post($field);
        
$adY substr($adYDate04);

        if(
$acY $adY && $acY!='') {
            
$this->form_validation->set_message('checkPreDate','ไม่ใช่ประวัติความประพฤติขณะศึกษาในวิทยาลัยนี้');
            return 
false;
        } else 
            return 
true;
    }
    
// ##### end callback
}
?>

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