Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Чтобы расследовать инциденты, было принято решение сохранять данные о просмотрах страниц и ошибки в PostgreSQL:
- <?php
- /*
- CREATE TABLE http_requests (
- created_at timestamp,
- host text,
- uri text,
- method text,
- params text,
- referer text,
- ip text,
- errors text[]
- );
- */
- $statement = $db->prepare('
- INSERT INTO http_requests (created_at, host, uri, method, params, ip, referer, errors)
- VALUES(:created_at, :host, :uri, :method, :params, :ip, :referer, :errors)
- ');
- $statement->execute([
- 'created_at' => date('Y-m-d H:i:s'),
- 'host' => $_SERVER['HTTP_HOST'],
- 'uri' => explode('?', $_SERVER['REQUEST_URI'], 2)[0],
- 'method' => $_SERVER['REQUEST_METHOD'],
- 'params' => json_encode($_REQUEST),
- 'ip' => $_SERVER['REMOTE_ADDR'],
- 'errors' => $errors,
- ]);
- Вопрос 1: Какие проблемы вы видите в этой реализации? Как их можно решить, не используя другие технологии?
- Вопрос 2: Если бы вы могли выбрать другую технологию, то какую и почему?
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement