!C99Shell v. 2.1 [PHP 8 Update] [02.02.2022]!

Software: Apache/2.4.53 (Unix) OpenSSL/1.1.1o PHP/7.4.29 mod_perl/2.0.12 Perl/v5.34.1. PHP/7.4.29 

uname -a: Linux vps-2738122-x 4.15.0-213-generic #224-Ubuntu SMP Mon Jun 19 13:30:12 UTC 2023 x86_64 

uid=1(daemon) gid=1(daemon) grupos=1(daemon) 

Safe-mode: OFF (not secure)

/opt/lampp/phpmyadmin/vendor/phpmyadmin/sql-parser/src/Statements/   drwxr-xr-x
Free 11.49 GB of 61.93 GB (18.56%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Feedback    Self remove    Logout    


Viewing file:     PurgeStatement.php (3.78 KB)      -rw-r--r--
Select action/file-type:
(+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php
/**
 * `PURGE` statement.
 */

declare(strict_types=1);

namespace 
PhpMyAdmin\SqlParser\Statements;

use 
PhpMyAdmin\SqlParser\Components\Expression;
use 
PhpMyAdmin\SqlParser\Parser;
use 
PhpMyAdmin\SqlParser\Statement;
use 
PhpMyAdmin\SqlParser\Token;
use 
PhpMyAdmin\SqlParser\TokensList;

use function 
in_array;
use function 
trim;

/**
 * `PURGE` statement.
 *
 * PURGE { BINARY | MASTER } LOGS
 *   { TO 'log_name' | BEFORE datetime_expr }
 */
class PurgeStatement extends Statement
{
    
/**
     * The type of logs
     *
     * @var String
     */
    
public $log_type;

    
/**
     * The end option of this query.
     *
     * @var String
     */
    
public $end_option;

    
/**
     * The end expr of this query.
     *
     * @var String
     */
    
public $end_expr;

    
/**
     * @return string
     */
    
public function build()
    {
        
$ret 'PURGE ' $this->log_type ' LOGS '
            
. ($this->end_option !== null ? ($this->end_option ' ' $this->end_expr) : '');

        return 
trim($ret);
    }

    
/**
     * @param Parser     $parser the instance that requests parsing
     * @param TokensList $list   the list of tokens to be parsed
     */
    
public function parse(Parser $parserTokensList $list)
    {
        ++
$list->idx// Skipping `PURGE`.

        /**
         * The state of the parser.
         *
         * @var int
         */
        
$state 0;

        
$prevToken null;
        for (; 
$list->idx $list->count; ++$list->idx) {
            
/**
             * Token parsed at this moment.
             *
             * @var Token
             */
            
$token $list->tokens[$list->idx];

            
// End of statement.
            
if ($token->type === Token::TYPE_DELIMITER) {
                break;
            }

            
// Skipping whitespaces and comments.
            
if (($token->type === Token::TYPE_WHITESPACE) || ($token->type === Token::TYPE_COMMENT)) {
                continue;
            }

            switch (
$state) {
                case 
0:
                    
// parse `{ BINARY | MASTER }`
                    
$this->log_type self::parseExpectedKeyword($parser$token, ['BINARY''MASTER']);
                    break;
                case 
1:
                    
// parse `LOGS`
                    
self::parseExpectedKeyword($parser$token, ['LOGS']);
                    break;
                case 
2:
                    
// parse `{ TO | BEFORE }`
                    
$this->end_option self::parseExpectedKeyword($parser$token, ['TO''BEFORE']);
                    break;
                case 
3:
                    
// parse `expr`
                    
$this->end_expr Expression::parse($parser$list, []);
                    break;
                default:
                    
$parser->error('Unexpected token.'$token);
                    break;
            }

            
$state++;
            
$prevToken $token;
        }

        
// Only one possible end state
        
if ($state === 4) {
            return;
        }

        
$parser->error('Unexpected token.'$prevToken);
    }

    
/**
     * Parse expected keyword (or throw relevant error)
     *
     * @param Parser $parser           the instance that requests parsing
     * @param Token  $token            token to be parsed
     * @param array  $expectedKeywords array of possibly expected keywords at this point
     *
     * @return mixed|null
     */
    
private static function parseExpectedKeyword($parser$token$expectedKeywords)
    {
        if (
$token->type === Token::TYPE_KEYWORD) {
            if (
in_array($token->keyword$expectedKeywords)) {
                return 
$token->keyword;
            }

            
$parser->error('Unexpected keyword'$token);
        } else {
            
$parser->error('Unexpected token.'$token);
        }

        return 
null;
    }
}

:: Command execute ::

Enter:
 
Select:
 

:: Search ::
  - regexp 

:: Upload ::
 
[ Read-Only ]

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

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

--[ c99shell v. 2.1 [PHP 8 Update] [02.02.2022] maintained byC99Shell Github | Generation time: 0.8094 ]--