<?php

require '../../vendor/autoload.php';

use Helpers\Securite\Securite;

$url = explode('/', $_SERVER['REQUEST_URI']);
$urlRacine = str_replace('oxaprocsso', 'oxaproc', $url[1]);

if(isset($_GET["passage"]) && $_GET["passage"] == "1")
{

    // phpcs:ignoreFile 
    Helpers\Session\Session::initSessionActive();

    header("Location : /" . $urlRacine . "/index/sso-connexion/interne/dispatcher/" .
        str_replace(
            '+',
            'spluss',
            str_replace(
                '=',
                'segals',
                str_replace('/', 'sslachs', Securite::creationTokenCSRFForSSOInterne())
            )
        ), true, 301);
} else {
    header("Location : /" . $urlRacine . "/index/connexion/ssointerne", true, 301);
    
}
exit;
