-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbootstrap.php
40 lines (33 loc) · 1.35 KB
/
bootstrap.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<?php
require 'vendor/autoload.php';
require 'functions.php';
$dotenv = \Dotenv\Dotenv::create(__DIR__)->load();
$constr = 'mysql:';
$constr .= 'host=' . env('DB_HOSTNAME') . ';';
$constr .= 'dbname=' . env('DB_DATABASE');
if (! empty($_GET['u'])) {
try {
date_default_timezone_set(env('TIMEZONE'));
$db = new PDO($constr, env('DB_USERNAME'), env('DB_PASSWORD'));
$stmt = $db->prepare('
INSERT INTO requests (year, month, day, time, organization, organization_group, client_ip, client_name, client_user, client_group, request_group, request_url)
VALUES (:year, :month, :day, :time, :organization, :organization_group, :client_ip, :client_name, :client_user, :client_group, :request_group, :request_url)
');
$stmt->execute([
':year' => date('Y'),
':month' => date('m'),
':day' => date('d'),
':time' => date('H:i:s'),
':organization' => $_GET['org'],
':organization_group' => $_GET['grp'],
':client_ip' => $_GET['a'],
':client_name' => $_GET['n'],
':client_user' => $_GET['i'],
':client_group' => $_GET['s'],
':request_group' => $_GET['t'],
':request_url' => $_GET['u'],
]);
} catch (PDOException $e) {
echo 'Error: ' . $e->getMessage();
}
}