-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathexample1.php
More file actions
22 lines (20 loc) · 766 Bytes
/
Copy pathexample1.php
File metadata and controls
22 lines (20 loc) · 766 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
<?php
require_once('../CSPGenerator.php');
// Allow use of style="..." inline CSS.
// Unsafe because a css injection can then control how the page looks.
CSPGenerator::getInstance()->addStylesrc("'unsafe-inline'");
// To avoid this it's recommended to use a stylesheets file instead and use classes and id's only in html.
// Set the headers, always call this method before any content output.
CSPGenerator::getInstance()->Parse();
// Start content output.
?><!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>example1 - allow (unsafe)inline css</title>
</head>
<body>
<!-- The following text is allowed to be centred because 'unsafe-inline' is added the CSP header. -->
<p style="text-align: center">testing inline css use</p>
</body>
</html>