!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/models/eregis-13022565/   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:     mo_rg_realstudyplan.php (9.94 KB)      -rwxr-xr-x
Select action/file-type:
(+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php
include_once("da_rg_RealStudyPlan.php");
class 
Mo_rg_realstudyplan extends Da_rg_RealStudyPlan {

    
/**
     * หน้าที่ของฟังก์ชั่น คือ ต่อสตริงของ sql->order by รูปแบบที่ 2
     *
     * @access    public
     * @param    array condition โดยรูปแบบของ array จะอยู่ในรูป condition('key' => value)
     * @return    string con โดยอยู่ในรูปแบบ ORDER $field
     * @todo    use
     */
    
public function checkOrderBy_2($condition="") {
        
$con "";
        if(
$condition) {
            
$con .= "ORDER BY";
            foreach (
$condition as $key => $value) {
                if(
$key=="crsCode" || $key=="crsName")
                    
$con .= " CONVERT($value USING tis620) ,";
                else
                    
$con .= " $value ,";
            }
        }
        return 
$con;
    }
    
    
/**
     * หน้าที่ของฟังก์ชั่น คือ หาข้อมูลโปรแกรมการเรียนจริงตามเงื่อนไข
     *
     * @access    public
     * @param    array condition โดยรูปแบบของ array จะอยู่ในรูป condition('key' => value) ไว้สำหรับระบุเงื่อนไขของคำสั่ง SELECT
     * @param    array order โดยรูปแบบของ array จะอยู่ในรูป condition('key' => value) ไว้สำหรับระบุเงื่อนไขการเรียงลำดับ ORDER BY
     * @param    array group โดยรูปแบบของ array จะอยู่ในรูป condition('key' => value) ไว้สำหรับระบุเงื่อนไขการจัดกลุ่ม GROUP BY
     * @return    query >= 1 rows : rg_RealStudyPlan.*
     * @todo    use
     */
    
public function qryRsp($condition="",$order="",$group="") {
        
$where $this->checkCondition($condition);
        
$order $this->checkOrderBy($order);
        
$group $this->checkGroupBy($group);

        
$c1 substr($where0, -3);
        
$c2 substr($order0, -1);
        
$c3 substr($group0, -1);

        
$sql "SELECT *
                    FROM $this->rg_dbname.rg_RealStudyPlan
                    $c1
                    $c3
                    $c2"
;
        
$query $this->db->query($sql);
        return 
$query;
    }

    
/**
     * หน้าที่ของฟังก์ชั่น คือ หาข้อมูลโปรแกรมการเรียนจริง รายวิชาที่เปิดสอน และข้อมูลรายวิชาตามเงื่อนไข
     *
     * @access    public
     * @param    array condition โดยรูปแบบของ array จะอยู่ในรูป condition('key' => value) ไว้สำหรับระบุเงื่อนไขของคำสั่ง SELECT
     * @param    array order โดยรูปแบบของ array จะอยู่ในรูป condition('key' => value) ไว้สำหรับระบุเงื่อนไขการเรียงลำดับ ORDER BY
     * @param    array group โดยรูปแบบของ array จะอยู่ในรูป condition('key' => value) ไว้สำหรับระบุเงื่อนไขการจัดกลุ่ม GROUP BY
     * @return    query >= 1 rows : rg_RealStudyPlan.*, rg_CourseOpen.*, rg_Course.*
     * @todo    use
     */
    
public function qryRspJoinCoCrs($condition="",$order="",$group="") {
        
$where $this->checkCondition($condition);
        
$order $this->checkOrderBy($order);
        
$group $this->checkGroupBy($group);

        
$c1 substr($where0, -3);
        
$c2 substr($order0, -1);
        
$c3 substr($group0, -1);

        
$sql "SELECT *
                FROM $this->rg_dbname.rg_RealStudyPlan
                INNER JOIN $this->rg_dbname.rg_CourseOpen ON rspCoId=coId
                INNER JOIN $this->rg_dbname.rg_Course ON coCrsId=crsId
                $c1
                $c3
                $c2"
;
        
$query $this->db->query($sql);
        return 
$query;
    }

    
/**
     * หน้าที่ของฟังก์ชั่น คือ หาข้อมูลโปรแกรมการเรียนจริง และข้อมูลรายวิชาตามเงื่อนไข
     *
     * @access    public
     * @param    array condition โดยรูปแบบของ array จะอยู่ในรูป condition('key' => value) ไว้สำหรับระบุเงื่อนไขของคำสั่ง SELECT
     * @param    array order โดยรูปแบบของ array จะอยู่ในรูป condition('key' => value) ไว้สำหรับระบุเงื่อนไขการเรียงลำดับ ORDER BY
     * @param    array group โดยรูปแบบของ array จะอยู่ในรูป condition('key' => value) ไว้สำหรับระบุเงื่อนไขการจัดกลุ่ม GROUP BY
     * @return    query >= 1 rows : rg_RealStudyPlan.*, rg_Course.*
     * @todo    use
     */
    
public function qryRspJoinCrs($condition="",$order="",$group="") {
        
$where $this->checkCondition($condition);
        
$order $this->checkOrderBy($order);
        
$group $this->checkGroupBy($group);

        
$c1 substr($where0, -3);
        
$c2 substr($order0, -1);
        
$c3 substr($group0, -1);

        
$sql "SELECT *
                FROM $this->rg_dbname.rg_RealStudyPlan
                INNER JOIN $this->rg_dbname.rg_Course ON rspCrsId=crsId
                $c1
                $c3
                $c2"
;
        
$query $this->db->query($sql);
        return 
$query;
    }
    
/* ##### เพิ่มส่วน GROUP BY ##### */
    /**
     * หน้าที่ของฟังก์ชั่น คือ หาข้อมูลชั้นปีที่มีการกำหนดโปรแกรมการเรียนจริง
     *
     * @access    public
     * @param    $rspAdY คือ ปีการศึกษาที่เข้า
     * @param    $rspCurId คือ รหัสหลักสูตร
     * @return    query >= 1 rows : rspSyId
     * @todo    use
     */
    
public function qryByAdYANDCurIdGroupSyId($rspAdY,$rspCurId) {
        
$sql "SELECT rspSyId
                FROM $this->rg_dbname.rg_RealStudyPlan
                WHERE rspAdY=?
                AND rspCurId=?
                GROUP BY rspSyId"
;
        
$query=$this->db->query($sql,array($rspAdY,$rspCurId));
        return 
$query;
    }

    
/**
     * หน้าที่ของฟังก์ชั่น คือ หาข้อมูลชั้นปีที่มีการกำหนดโปรแกรมการเรียนจริง
     *
     * @access    public
     * @param    $rspAdY คือ ปีการศึกษาที่เข้า
     * @param    $rspCurId คือ รหัสหลักสูตร
     * @param    $rspSyId คือ รหัสชั้นปี
     * @return    query >= 1 rows : rspTmId
     * @todo    use
     */
    
public function qryByAdYANDCurIdANDSyIdGroupTmId($rspAdY,$rspCurId,$rspSyId) {
        
$sql "SELECT rspTmId
                FROM $this->rg_dbname.rg_RealStudyPlan
                WHERE rspAdY=?
                AND rspCurId=?
                AND rspSyId=?
                GROUP BY rspTmId"
;
        
$query=$this->db->query($sql,array($rspAdY,$rspCurId,$rspSyId));
        return 
$query;
    }

    
/**
     * หน้าที่ของฟังก์ชั่น คือ หาผลรวมของหน่วยกิตที่กำหนดในโปรแกรมการเรียนจริงตามเงื่อนไข
     *
     * @access    public
     * @param    array condition โดยรูปแบบของ array จะอยู่ในรูป condition('key' => value) ไว้สำหรับระบุเงื่อนไขของคำสั่ง SELECT
     * @return    num: ผลรวมของหน่วยกิตที่กำหนดในโปรแกรมการเรียนจริง
     * @todo    use
     */
    
public function getSumCreditTotal($condition="") {
        
$where $this->checkCondition($condition);

        
$c1 substr($where0, -3);

        
$sql "SELECT SUM(crsCreditTotal) AS num
                FROM $this->rg_dbname.rg_RealStudyPlan
                INNER JOIN $this->rg_dbname.rg_CourseOpen ON rspCoId=coId
                INNER JOIN $this->rg_dbname.rg_Course ON coCrsId=crsId
                $c1"
;
        
$query $this->db->query($sql);
        return 
$query->row()->num;
    }

    
/**
     * หน้าที่ของฟังก์ชั่น คือ query โปรแกรมการเรียนจริงสำหรับรายงาน Ris133
     *
     * @access    public
     * @param    $curId  คือ รหัสหลักสูตร
     * @param    $adY คือ ปีการศึกษาที่เข้าี่
     * @param    $syId คือ ชั้นปี
     * @return        query
     * @todo        use
     */
    
public function rsRealStudyPlanForRis133($curId,$adY,$syId) {
        
$sql "SELECT rsp.*, cs.csCdId1, cs.csCreditTotal, cd.cdName, co.*
                    FROM $this->rg_dbname.rg_RealStudyPlan AS rsp
                    LEFT JOIN (SELECT csCdId1, csCurId, MAX(csCreditTotal) AS csCreditTotal FROM $this->rg_dbname.rg_CurriculumStructure GROUP BY csCdId1) AS cs ON rsp.rspCurId = cs.csCurId
                    LEFT JOIN $this->rg_dbname.rg_Condition AS cd ON rsp.rspCdId1 = cd.cdId
                    LEFT JOIN $this->rg_dbname.rg_Course AS co ON rsp.rspCrsId = co.crsId
                    WHERE rsp.rspCurId=? AND rsp.rspAdY=? AND rsp.rspSyId=?
                    ORDER BY rsp.rspTmId ASC"
;
        
$query $this->db->query($sql,array($curId$adY$syId));
        return 
$query;
    }

    public function 
qryRspJoinCoCrsGroupCrsId($condition="") {
        
$where $this->checkCondition($condition);
        
//$order = $this->checkOrderBy($order);
        //$group = $this->checkGroupBy($group);

        
$c1 substr($where0, -3);
        
//$c2 = substr($order, 0, -1);
        //$c3 = substr($group, 0, -1);

        
$sql "SELECT crs.*
                FROM $this->rg_dbname.rg_RealStudyPlan
                INNER JOIN $this->rg_dbname.rg_CourseOpen ON rspCoId=coId
                INNER JOIN $this->rg_dbname.rg_Course crs ON coCrsId=crsId
                INNER JOIN $this->rg_dbname.rg_CourseOpenStudent ON coId=cosCoId
                $c1
                GROUP BY crsId
                ORDER BY CONVERT(crsCode USING TIS620),
                CONVERT(crsName USING TIS620)"
;
        
$query $this->db->query($sql);
        return 
$query;
    }
}
?>

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