PHP Classes

File: examples/example7.php

Recommend this page to a friend!
  Classes of Tom Postma  >  PHP Content Security Policy generator  >  examples/example7.php  >  Download  
File: examples/example7.php
Role: Example script
Content type: text/plain
Description: Example: adding the Content Security Policy META tag.
Class: PHP Content Security Policy generator
Generate CSP headers to prevent security attacks
Author: By
Last change: make notice report-to directive in example7.

Signed-off-by: Tom <D9ping@users.noreply.github.com>
Date: 3 years ago
Size: 571 bytes
 

Contents

Class file image Download
<?php
require_once('../CSPGenerator.php');

// Start content output.
?><!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8">
        <title>example7 - CSP in meta tag</title>
        <?php echo CSPGenerator::getInstance()->getMetatagContentSecurityPolicy(); ?>
</head>
    <body>
    The Content Security Policy in the META tag can cannot use frame-ancestors, report-uri,
    report-to or sandbox directives and has currently limited browser support. The META tag CSP<br />
    provides weaker security because an injection before the META tag can still change things.<br />
    </body>
</html>

For more information send a message to info at phpclasses dot org.