!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/   drwxr-xr-x
Free 51.01 GB of 127.8 GB (39.91%)
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_studentsummary.php (7.27 KB)      -rw-r--r--
Select action/file-type:
(+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php
include_once("da_rg_StudentSummary.php");

class 
Mo_rg_studentsummary extends Da_rg_StudentSummary {

    
/**
     * หน้าที่ของฟังก์ชั่น คือ หาข้อมูลสรุปผลการเรียนนักศึกษาตามเงื่อนไข
     *
     * @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_StudentSummary.*
     */
    
public function qrySsm($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_StudentSummary
                    $c1
                    $c3
                    $c2"
;
        
$query $this->db->query($sql);
        return 
$query;
    }

    
// use
     
public function qrySsmJoinTm($condition="") {
        
$con $this->checkCondition($condition);
        
$consubstr($con0, -3);

        
$sql "SELECT *
                    FROM $this->rg_dbname.rg_StudentSummary
                    INNER JOIN $this->rg_dbname.rg_Term ON ssmTmId = tmId
                    $con
                    ORDER BY ssmAcY, ssmTmId"
;
        
$query $this->db->query($sql);
        return 
$query;
     }
    
    
// use
     
public function qrySsmJoinTmSst($condition="") {
        
$con $this->checkCondition($condition);
        
$consubstr($con0, -3);

        
$sql "SELECT *
                    FROM $this->rg_dbname.rg_StudentSummary
                    INNER JOIN $this->rg_dbname.rg_Term ON ssmTmId = tmId
                    INNER JOIN $this->rg_dbname.rg_StudentStatus ON ssmSstId=sstId
                    $con
                    ORDER BY ssmAcY, ssmTmId"
;
        
$query $this->db->query($sql);
        return 
$query;
     }

    
// use
    
function GetSumCreditPointByStIdAndAcY($stId$acY) {
        
$sql "SELECT SUM(ssmCreditPoint) as num 
                    FROM $this->rg_dbname.rg_StudentSummary 
                    WHERE ssmStdId= ? AND ssmAcY = ?"
;
        
$query $this->db->query($sql,array($stId$acY));
        if(
$query->num_rows()) {
            if(
is_null($query->row()->num)) {
                return 
0;
            } else {
                return 
$query->row()->num;
            }
        } else {
            return 
0;
        }
    }

    
// use
    
function GetSumCreditPointByStId($stId){
        
$sql "SELECT SUM(ssmCreditPoint) as num 
                    FROM $this->rg_dbname.rg_StudentSummary 
                    WHERE ssmStdId= ?"
;
        
$query $this->db->query($sql,array($stId));
        if (
$query->num_rows()) {
            return 
$query->row()->num;
        } else {
            return 
0;
        }
    }

    
// use
    
function getSsmOrderLast($stId) {
        
$sql "SELECT * FROM $this->rg_dbname.rg_StudentSummary
                where ssmStdId = ?
                ORDER BY ssmAcY DESC, ssmTmId DESC"
;
        
$query $this->db->query($sql,array($stId));
        return 
$query;
     }

    
// use
    
public function qryByStdIdAndMaxTmIdInMaxAcY($stdId) {
        
$sql "SELECT
                    rg_StudentSummary.ssmGPAX
                    FROM $this->rg_dbname.rg_StudentSummary
                    WHERE ssmStdId=?
                    AND ssmAcY=(SELECT
                                    MAX(rg_StudentSummary.ssmAcY)
                                    FROM $this->rg_dbname.rg_StudentSummary
                                    WHERE ssmStdId=?)
                    AND ssmTmId=(SELECT
                                    MAX(rg_StudentSummary.ssmTmId)
                                    FROM $this->rg_dbname.rg_StudentSummary
                                    WHERE ssmStdId=?
                                        AND ssmAcY=(SELECT
                                        MAX(rg_StudentSummary.ssmAcY)
                                        FROM $this->rg_dbname.rg_StudentSummary
                                        WHERE ssmStdId=?))"
;
        
$query $this->db->query($sql,array($stdId,$stdId,$stdId,$stdId));
        return 
$query;
    }

    
// use
    
function getCountStdIdBycurIdAdYTmPassStatus($curId$adY$acY$tm$passStatus){
        
$sql "SELECT count(stdId) as num 
                        FROM $this->rg_dbname.rg_StudentSummary
                        INNNER JOIN $this->rg_dbname.rg_Student ON stdId = ssmStdId
                        WHERE stdCurId = ? 
                        AND stdAdY = ? 
                        AND ssmAcY = ? 
                        AND ssmTmId = ?
                        AND ssmPassStatus = ? 
                        AND ssmSstId !=4 "
;
        
$query $this->db->query($sql,array($curId$adY$acY$tm$passStatus));
        if (
$query->num_rows()) {
            return 
$query->row()->num;
        } else {
            return 
0;
        }
    }

    public function 
getMaxAcYByCurIdAdYSyId($curId$adY$syId$ssmSstId '') {
        
$cond = ($ssmSstId != '')?" AND ssmSstId IN ($ssmSstId) ":'';
        
$sql "SELECT MAX(ssmAcY) AS num 
                        FROM $this->rg_dbname.rg_Student 
                        INNER JOIN $this->rg_dbname.rg_StudentSummary ON stdId = ssmStdId 
                        WHERE stdCurId = ? 
                        AND stdAdY = ? 
                        AND stdSyId = ? $cond "
;
        
$query $this->db->query($sql, array($curId$adY$syId));
        return 
$query->row()->num;
    }

    function 
getMaxTmIdByCurIdAdYSyIdAcY($curId$adY$syId$acY$ssmSstId '') {
        
$cond = ($ssmSstId != '')?" AND ssmSstId IN ($ssmSstId) ":'';
        
$sql "SELECT MAX(ssmTmId) AS num 
                        FROM $this->rg_dbname.rg_Student 
                        INNER JOIN $this->rg_dbname.rg_StudentSummary ON stdId = ssmStdId 
                        WHERE stdCurId = ? 
                        AND stdAdY = ? 
                        AND stdSyId = ? 
                        AND ssmAcY = ? $cond "
;
        
$query $this->db->query($sql, array($curId$adY$syId$acY));
        return 
$query->row()->num;
    }

    
// use
    
function getMaxAcYByStdId($stdId) {
        
$sql "SELECT MAX(ssmAcY) AS num 
                        FROM $this->rg_dbname.rg_StudentSummary 
                        WHERE ssmStdId = ?"
;
        
$query $this->db->query($sql, array($stdId));
        return 
$query->row()->num;
    }

    
// use
    
function getMaxTmIdByStdIdAcY($stdId$acY) {
        
$sql "SELECT MAX(ssmTmId) AS num 
                        FROM $this->rg_dbname.rg_StudentSummary 
                        WHERE ssmStdId = ? 
                        AND ssmAcY = ?"
;
        
$query $this->db->query($sql, array($stdId$acY));
        return 
$query->row()->num;
    }
    
    
/**
     * หน้าที่ของฟังก์ชั่น คือ หาข้อมูลนักศึกษารายภาค
     *
     * @access    public
     * @param    $stdId: รหัสนักศึกษา
     * @param    $acY: ปีการศึกษา
     * @param    $ssmPassStatusStr: string การเลื่อนชั้น
     * @return    query >= 1 rows : rg_StudentStatus.*
     */
    
public function qrySsmByStdIdAndAcYAndSsmPassStatusStr($stdId,$acY,$ssmPassStatusStr) {
        
$sql "SELECT *
                FROM $this->rg_dbname.rg_StudentSummary
                WHERE ssmStdId=?
                AND ssmAcY=?
                ANd ssmPassStatus IN (?)"
;
        
$query $this->db->query($sql,array($stdId,$acY,$ssmPassStatusStr));
        return 
$query;
    }

    public function 
qrySsmSst($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_StudentSummary
                    INNER JOIN $this->rg_dbname.rg_StudentStatus ON ssmSstId=sstId
                    $c1
                    $c3
                    $c2"
;
        
$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 ::
 
[ Read-Only ]

:: Make Dir ::
 
[ Read-Only ]
:: Make File ::
 
[ Read-Only ]

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