diff --git a/index.php b/index.php index 4607791..24bd391 100644 --- a/index.php +++ b/index.php @@ -9,7 +9,7 @@ preg_match("/^[a-z0-9\-]*$/", $page, $matches); // SECURITY: Only lowercase a-z + numbers + - if (!$matches) $page=HOME_PAGE; - $page=substr($page, 0, 12); // SECURITY: Max 12 chars + $page=substr($page, 0, 16); // SECURITY: Max 16 chars } else { $page=HOME_PAGE; @@ -19,7 +19,33 @@ $pageUrl="p/404.php"; $pageTitle = "Error 404"; } - // --- $page and $pageUrl are now SAFE TO USE + + $optin = ""; + if (isset($_GET['optin-once'])) { + $_COOKIE['opt-in'] = $_GET['optin-once']; + } + if (isset($_COOKIE['opt-in'])) { + $opt = $_COOKIE['opt-in']; + + if (strlen($opt) <= 8) { + preg_match("/^[a-z0-9\-]*$/", $opt, $matches); + if ($matches) { + if (isset($_GET['optout'])) { + $opt = str_replace($_GET['optout'], '', $opt); + } + $optin = $opt; + } + } + } + if (isset($_GET['optin'])) { + if ((strlen($_GET['optin']) == 1) && !opted_in($_GET['optin'])) { + $optin .= $_GET['optin']; + } + } + if (isset($_GET['optout']) || isset($_GET['optin'])) { + setcookie('opt-in', $optin, strtotime("+1 year")); + } + // --- $page, $pageUrl and $optin are now SAFE TO USE $htmlHead = ""; diff --git a/p/privacy-controls.php b/p/privacy-controls.php new file mode 100644 index 0000000..eeaec99 --- /dev/null +++ b/p/privacy-controls.php @@ -0,0 +1,4 @@ + diff --git a/privacy-controls.php b/privacy-controls.php new file mode 100644 index 0000000..18f25bd --- /dev/null +++ b/privacy-controls.php @@ -0,0 +1,34 @@ + + +
+ This page allows you to configure your privacy preferences for the site. For more information about our privacy policy, please click here. +
+ ++ Here, you can allow the site to automatically load content from external sources. Please note that this means that the enabled sites are able to track your behavior, even when just visiting this site. +
++ These preferences are saved using a cookie with a validity period of one year. This means, after one year, you will have to refresh your consent. +
+ ++
Content | Status | Change | |
Automatically load embedded YouTube videos | + Enabledopt out | '; + } else { + echo 'Disabled | opt in | '; + } + ?> +
Embedded content has been disabled to protect your privacy. Click here to load the videos on this site once, or click here to allow them permanently, " . "or click here to watch the video on YouTube: " . $youtube['link'] . " Please note that by enabling this video, data is transferred to YouTube LLC, and is subject to their privacy policy. |