403Webshell
Server IP : 217.160.0.95  /  Your IP : 216.73.216.62
Web Server : Apache
System : Linux infong-uk56 4.4.400-icpu-108 #2 SMP Wed Feb 11 11:51:01 UTC 2026 x86_64
User : u78863098 ( 10368940)
PHP Version : 8.4.24
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /homepages/oneclick/WordPress/7.0/601/scripts/core/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /homepages/oneclick/WordPress/7.0/601/scripts/core/database.php
<?php
namespace Core;

use \PDO;

class Database
{
    private $connection;

    public function __construct($host, $username, $passwd, $dbname)
    {
        if (strpos($host, '.sock', $offset = 0) > 0) {
            $splitHost = explode(':', $host);

            $port = null;
            $socket = $splitHost[1];

            $dsn = 'mysql:unix_socket=' . $socket . ';dbname=' . $dbname;
        } else {
            $port = 3306;
            $socket = null;

            $dsn = 'mysql:host=' . $host . ';port=' . $port . ';dbname=' . $dbname;
        }

        $this->connection = new PDO($dsn, $username, $passwd);
        $this->connection->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
    }

    public function import($schema)
    {
        $inString = false;
        $inComment = false;
        $start = 0;
        $len = strlen($schema);
        $backslash = false;

        for ($i = 0; $i < $len; $i++) {
            if (($schema[$i] == '#' || ($schema[$i] == '-' && $schema[$i + 1] == '-')) && !$inString) {
                $inComment = true;
                continue;
            }

            if ($schema[$i] == "\n" && $inComment) {
                $inComment = false;
                $start = $i + 1;
                continue;
            }

            if ($inComment) {
                continue;
            }

            if ($schema[$i] == ';' && !$inString) {
                $statement = substr($schema, $start, $i - $start);
                if (!preg_match("/^[ \n\r\t]*$/", $statement)) {
                    $this->connection->query($statement);
                }
                $start = $i + 1;
            }

            if ($inString) {
                if ($schema[$i - 1] == '\\') {
                    $backslash = !$backslash;
                } else {
                    $backslash = false;
                }
            }

            if ($schema[$i] == $inString && !$backslash) {
                $inString = false;
            } elseif (($schema[$i] == '"' || $schema[$i] == "'") && !$inString && ($i > 0 && $schema[$i - 1] != '\\')) {
                $inString = $schema[$i];
            }
        }

        if (!$inComment) {
            $statement = substr($schema, $start);

            if (!preg_match("/^[ \n\r\t]*$/", $statement)) {
                $this->connection->query($statement);
            }
        }
    }

    public function drop($prefix)
    {
        $query = "SHOW TABLES LIKE \"$prefix%\"";
        $queryResult = $this->connection->query($query);
        $deleteQuery = "DROP TABLE `{$queryResult->fetchColumn()}`";

        while ($row = $queryResult->fetchColumn()) {
            $deleteQuery .= ", $row";
        }

        $this->connection->query($deleteQuery);
    }

    public function prepareSql($query, $parameters = '')
    {
        return $this->connection->prepare($query)->execute($parameters);
    }

    public function querySql($query)
    {
        $this->connection->query($query);
    }

    public function select($query)
    {
        $query .= ' LIMIT 1;';
        return $this->connection->query($query)->fetchAll(PDO::FETCH_COLUMN, 0)[0];
    }

    /**
     * get all tables which are ending with options
     *
     *
     * @return array
     */
    public function selectOptionsTableNames()
    {
        $query  = "SHOW TABLES LIKE '%options'";
        $result = $this->connection->query($query)->fetchAll(PDO::FETCH_COLUMN, 0);

        return $result;
    }

    public function selectFromRaw($query)
    {
        return $this->connection->query($query)->fetch(PDO::FETCH_COLUMN, 0);
    }

    public function rowCount($table)
    {
        return $this->connection->query("SELECT COUNT(*) FROM `$table`")->fetchColumn();
    }
}

Youez - 2016 - github.com/yon3zu
LinuXploit