PHP Classes

File: examples/example1.php

Recommend this page to a friend!
  Classes of Tom Postma   PHP Content Security Policy generator   examples/example1.php   Download  
File: examples/example1.php
Role: Example script
Content type: text/plain
Description: Example: how to allow to use style="" attributes in html.
Class: PHP Content Security Policy generator
Generate CSP headers to prevent security attacks
Author: By
Last change:
Date: 6 years ago
Size: 766 bytes


Class file image Download
// Allow use of style="..." inline CSS.
// Unsafe because a css injection can then control how the page looks.
// 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.
// Start content output.
?><!DOCTYPE html>
        <meta charset="UTF-8">
        <title>example1 - allow (unsafe)inline css</title>
        <!-- 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>