<?php

/**
 * This script will set cookies for the websites with a custom domain (not in '.opentalent.fr')
 *
 * NB: It is voluntarily kept separated from typo3, in order to stay as light as possible,
 *      because it will be called from the Opentalent front app.
 */

if (
    preg_match("/https?:\/\/(.*\.)?opentalent.fr(\/.*)?/", $_SERVER['HTTP_REFERER'])
    && isset($_REQUEST['BEARER'])
)
{
    setcookie('BEARER', $_REQUEST['BEARER'], 0, "/");
}
