if (!empty($params)) {
foreach ($params as &$param) {
if (is_string($param) && trim($param) === '') {
$param = null; // Пустые строки заменяются на NULL
} elseif (is_array($param)) {
$param = json_encode($param); // Преобразуем массив в JSON
}
}
$stmt->bind_param($this->types(...$params), ...$params);
}
$result = $stmt->execute();
if ($result === TRUE) {
$result = new \stdClass();
$data = [];
$query_result = $stmt->get_result();
$result->query = $query_result;
if ($query_result instanceof \mysqli_result) {
while ($row = $query_result->fetch_assoc()) {
$data[] = $row;
}
$query_result->close();
}
$result->num_rows = ($stmt->num_rows == 0 && count($data) != 0) ? count($data) : $stmt->num_rows;
$result->affected = $stmt->affected_rows;
$result->row = isset($data[0]) ? $data[0] : [];
$result->rows = $data;
$result->query = ["sql" => $sql, "params" => $params];
$stmt->close();
return $result;
}
/**
* Special case to deal with Fatal errors and the like.
*
* @return void
*/
public function handleShutdown()
{
// If we reached this step, we are in shutdown handler.
// An exception thrown in a shutdown handler will not be propagated
// to the exception handler. Pass that information along.
$this->canThrowExceptions = false;
$error = $this->system->getLastError();
if ($error && Misc::isLevelFatal($error['type'])) {
// If there was a fatal error,
// it was not handled in handleError yet.
$this->allowQuit = false;
$this->handleError(
$error['type'],
$error['message'],
$error['file'],
$error['line']
);
}
}
/**
* @param InspectorFactoryInterface $factory
*
* @return void
*/
public function setInspectorFactory(InspectorFactoryInterface $factory)
{
$this->inspectorFactory = $factory;
}
public function addFrameFilter($filterCallback)
Key | Value |
_route_ | anime/gintama-1327 |
Key | Value |
GATEWAY_INTERFACE | CGI/1.1 |
PHP_INI_SCAN_DIR | /var/www/www-root/data/php-bin-isp-php83/shiroku.ru: |
REMOTE_ADDR | 216.73.216.206 |
QUERY_STRING | _route_=anime/gintama-1327 |
HTTP_USER_AGENT | Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com) |
DOCUMENT_ROOT | /var/www/www-root/data/www/shiroku.ru |
REMOTE_PORT | 35330 |
REDIRECT_QUERY_STRING | _route_=anime/gintama-1327 |
HTTP_ACCEPT | */* |
SERVER_SIGNATURE | <address>Apache/2.4.52 (Ubuntu) Server at shiroku.ru Port 80</address> |
REDIRECT_REDIRECT_HTTPS | on |
CONTEXT_DOCUMENT_ROOT | /var/www/php-bin-isp-php83/www-root/shiroku.ru/ |
SCRIPT_FILENAME | /var/www/www-root/data/www/shiroku.ru/index.php |
HTTP_HOST | shiroku.ru |
REDIRECT_REDIRECT_STATUS | 200 |
REDIRECT_HANDLER | application/x-httpd-php5 |
REQUEST_URI | /anime/gintama-1327 |
SERVER_SOFTWARE | Apache/2.4.52 (Ubuntu) |
HTTP_CONNECTION | close |
REQUEST_SCHEME | http |
PATH | /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin |
REDIRECT_URL | /index.php |
PHPRC | /var/www/www-root/data/php-bin-isp-php83 |
SERVER_PROTOCOL | HTTP/1.0 |
REDIRECT_HTTPS | on |
HTTP_ACCEPT_ENCODING | gzip, br, zstd, deflate |
REDIRECT_STATUS | 200 |
REQUEST_METHOD | GET |
HTTP_X_FORWARDED_PORT | 443 |
SERVER_ADDR | 127.0.0.1 |
SERVER_ADMIN | webmaster@shiroku.ru |
HTTP_X_FORWARDED_PROTO | https |
CONTEXT_PREFIX | /php-bin/ |
PWD | /var/www/php-bin-isp-php83/www-root/shiroku.ru |
HTTPS | 1 |
SERVER_PORT | 80 |
SCRIPT_NAME | /index.php |
SERVER_NAME | shiroku.ru |
ORIG_SCRIPT_FILENAME | /var/www/php-bin-isp-php83/www-root/shiroku.ru/php |
ORIG_PATH_INFO | /index.php |
ORIG_PATH_TRANSLATED | /var/www/www-root/data/www/shiroku.ru/index.php |
ORIG_SCRIPT_NAME | /php-bin/php |
PHP_SELF | /index.php |
REQUEST_TIME_FLOAT | 1749416341.5865 |
REQUEST_TIME | 1749416341 |
$typeString .= 'b';
break;
case 'boolean':
$typeString .= 'i'; // Считаем boolean как integer
break;
case 'NULL':
$typeString .= 's'; // Мы всё равно указываем 's', но параметр передаем как null
break;
case 'array':
return $this->types(extract($params));
default:
throw new \Exception('Unsupported parameter type: ' . gettype($param));
}
}
return $typeString;
}
public function query($sql, ...$params) {
$stmt = $this->connection->prepare($sql);
if (!$this->connection->errno) {
if (!empty($params)) {
foreach ($params as &$param) {
if (is_string($param) && trim($param) === '') {
$param = null; // Пустые строки заменяются на NULL
} elseif (is_array($param)) {
$param = json_encode($param); // Преобразуем массив в JSON
}
}
$stmt->bind_param($this->types(...$params), ...$params);
}
$result = $stmt->execute();
if ($result === TRUE) {
$result = new \stdClass();
$data = [];
$typeString .= 'b';
break;
case 'boolean':
$typeString .= 'i'; // Считаем boolean как integer
break;
case 'NULL':
$typeString .= 's'; // Мы всё равно указываем 's', но параметр передаем как null
break;
case 'array':
return $this->types(extract($params));
default:
throw new \Exception('Unsupported parameter type: ' . gettype($param));
}
}
return $typeString;
}
public function query($sql, ...$params) {
$stmt = $this->connection->prepare($sql);
if (!$this->connection->errno) {
if (!empty($params)) {
foreach ($params as &$param) {
if (is_string($param) && trim($param) === '') {
$param = null; // Пустые строки заменяются на NULL
} elseif (is_array($param)) {
$param = json_encode($param); // Преобразуем массив в JSON
}
}
$stmt->bind_param($this->types(...$params), ...$params);
}
$result = $stmt->execute();
if ($result === TRUE) {
$result = new \stdClass();
$data = [];
public function __construct($adaptor, $hostname, $username, $password, $database, $port = NULL) {
$class = 'DB\\' . $adaptor;
if (class_exists($class)) {
$this->adaptor = new $class($hostname, $username, $password, $database, $port);
} else {
include DIR_ROOT . "/err.php";
exit;
}
}
/**
*
*
* @param string $sql
*
* @return array
*/
public function query($sql, ...$params) {
return $this->adaptor->query($sql, ...$params);
}
/**
*
*
* @param string $value
*
* @return string
*/
public function escape($value) {
return $this->adaptor->escape($value);
}
/**
*
*
* @return int
*/
public function countAffected() {
return $this->adaptor->countAffected();
$this->db = $registry->get('db');
$this->maxlifetime = ini_get('session.gc_maxlifetime') !== null ? (int)ini_get('session.gc_maxlifetime') : 1440;
$this->gc();
}
public function read($session_id) {
$query = $this->db->query("SELECT `data` FROM `" . DB_PREFIX . "session` WHERE `session_id` = '" . $this->db->escape($session_id) . "' AND `expire` > '" . $this->db->escape(date('Y-m-d H:i:s', time())) . "'");
if ($query->num_rows) {
return json_decode($query->row['data'], true);
} else {
return array();
}
}
public function write($session_id, $data) {
if ($session_id) {
$this->db->query("REPLACE INTO `" . DB_PREFIX . "session` SET `session_id` = '" . $this->db->escape($session_id) . "', `data` = '" . $this->db->escape(json_encode($data)) . "', `expire` = '" . $this->db->escape(date('Y-m-d H:i:s', time() + (int)$this->maxlifetime)) . "'");
}
return true;
}
public function destroy($session_id) {
$this->db->query("DELETE FROM `" . DB_PREFIX . "session` WHERE `session_id` = '" . $this->db->escape($session_id) . "'");
return true;
}
public function gc() {
if (ini_get('session.gc_divisor') && $gc_divisor = (int)ini_get('session.gc_divisor')) {
$gc_divisor = $gc_divisor === 0 ? 100 : $gc_divisor;
} else {
$gc_divisor = 100;
}
if (ini_get('session.gc_probability')) {
$gc_probability = (int)ini_get('session.gc_probability');
$session_id = substr(bin2hex(openssl_random_pseudo_bytes(26)), 0, 26);
}
}
if (preg_match('/^[a-zA-Z0-9,\-]{22,52}$/', $session_id)) {
$this->session_id = $session_id;
} else {
exit('Error: Invalid session ID!');
}
$this->data = $this->adaptor->read($session_id);
return $session_id;
}
/**
*
*/
public function close() {
$this->adaptor->write($this->session_id, $this->data);
}
/**
*
*/
public function destroy() {
$this->adaptor->destroy($this->session_id);
}
}
Key | Value |
_route_ | anime/gintama-1327 |
Key | Value |
GATEWAY_INTERFACE | CGI/1.1 |
PHP_INI_SCAN_DIR | /var/www/www-root/data/php-bin-isp-php83/shiroku.ru: |
REMOTE_ADDR | 216.73.216.206 |
QUERY_STRING | _route_=anime/gintama-1327 |
HTTP_USER_AGENT | Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com) |
DOCUMENT_ROOT | /var/www/www-root/data/www/shiroku.ru |
REMOTE_PORT | 35330 |
REDIRECT_QUERY_STRING | _route_=anime/gintama-1327 |
HTTP_ACCEPT | */* |
SERVER_SIGNATURE | <address>Apache/2.4.52 (Ubuntu) Server at shiroku.ru Port 80</address> |
REDIRECT_REDIRECT_HTTPS | on |
CONTEXT_DOCUMENT_ROOT | /var/www/php-bin-isp-php83/www-root/shiroku.ru/ |
SCRIPT_FILENAME | /var/www/www-root/data/www/shiroku.ru/index.php |
HTTP_HOST | shiroku.ru |
REDIRECT_REDIRECT_STATUS | 200 |
REDIRECT_HANDLER | application/x-httpd-php5 |
REQUEST_URI | /anime/gintama-1327 |
SERVER_SOFTWARE | Apache/2.4.52 (Ubuntu) |
HTTP_CONNECTION | close |
REQUEST_SCHEME | http |
PATH | /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin |
REDIRECT_URL | /index.php |
PHPRC | /var/www/www-root/data/php-bin-isp-php83 |
SERVER_PROTOCOL | HTTP/1.0 |
REDIRECT_HTTPS | on |
HTTP_ACCEPT_ENCODING | gzip, br, zstd, deflate |
REDIRECT_STATUS | 200 |
REQUEST_METHOD | GET |
HTTP_X_FORWARDED_PORT | 443 |
SERVER_ADDR | 127.0.0.1 |
SERVER_ADMIN | webmaster@shiroku.ru |
HTTP_X_FORWARDED_PROTO | https |
CONTEXT_PREFIX | /php-bin/ |
PWD | /var/www/php-bin-isp-php83/www-root/shiroku.ru |
HTTPS | 1 |
SERVER_PORT | 80 |
SCRIPT_NAME | /index.php |
SERVER_NAME | shiroku.ru |
ORIG_SCRIPT_FILENAME | /var/www/php-bin-isp-php83/www-root/shiroku.ru/php |
ORIG_PATH_INFO | /index.php |
ORIG_PATH_TRANSLATED | /var/www/www-root/data/www/shiroku.ru/index.php |
ORIG_SCRIPT_NAME | /php-bin/php |
PHP_SELF | /index.php |
REQUEST_TIME_FLOAT | 1749416341.5865 |
REQUEST_TIME | 1749416341 |