ninegitea/src/Controller/SondeController.php

44 lines
1.4 KiB
PHP
Raw Normal View History

2021-07-20 13:04:47 +02:00
<?php
namespace App\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
class SondeController extends AbstractController
{
public function sonde()
{
// Debug sonde
$fgdebug = ($this->getParameter("appEnv")!="PROD");
// Calcul du login
$user=$this->getUser();
if($user) $loginsonde=crypt($user->getUsername(),"dkywqZPYNHtWDnSxACjXVcIsFuaiQT");
else $loginsonde="";
// Calcul du profil
$profilsonde="visiteur";
if($user) {
$profilsonde="utilisateur";
$attributes=$this->get('session')->get('attributes');
if(isset($attributes["ENTPersonProfils"])) $profilsonde=$attributes["ENTPersonProfils"];
}
// Calcul de la provenance
$e = explode('.', $_SERVER["REMOTE_ADDR"]);
$s = sizeof($e);
if(($e[0]=="172"&&$e[1]=="30")||($e[0]=="172"&&$e[1]=="16")||($e[0]=="10"&&($e[1]=="77"||$e[1]=="93"||$e[1]=="94")))
$provenancesonde='interne';
else
$provenancesonde='externe';
$url=$this->getParameter("sondeUrl");
2023-12-22 13:53:10 +01:00
$app=$this->getParameter("appName");
2021-07-20 13:04:47 +02:00
$urlsonde = $url."?appli=$app&profil=$profilsonde&login=$loginsonde&provenance=$provenancesonde&fgdebug=$fgdebug";
return $this->render('Sonde/sonde.html.twig',['urlsonde' => $urlsonde]);
}
}