]>
Commit | Line | Data |
---|---|---|
67cc3b92 IB |
1 | <?php |
2 | $email_address = 'ismael@bouya.org'; | |
3 | $email_subject = 'Content-Security-Policy violation'; | |
4 | ||
5 | $current_domain = $_SERVER['SERVER_NAME']; | |
6 | $email_subject = $email_subject . ' on ' . $current_domain; | |
7 | ||
8 | http_response_code(204); | |
9 | ||
10 | $json_data = file_get_contents('php://input'); | |
11 | ||
12 | if ($json_data = json_decode($json_data)) { | |
13 | $json_data = json_encode($json_data, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES); | |
14 | ||
15 | $message = "The following Content-Security-Policy violation occurred on " . | |
16 | $current_domain . ":\n\n" . | |
17 | $json_data; | |
18 | mail($email_address, $email_subject, $message, 'Content-Type: text/plain;charset=utf-8'); | |
19 | } |