Subversion Repositories ALCASAR

Compare Revisions

Ignore whitespace Rev 565 → Rev 566

/web/index.php
3,11 → 3,13
$hostname = "alcasar";
$network_pb = False;
$cert_add = "http://alcasar/certs";
 
$direct_access = False;
$diagnostic = "eth0 link down";
$remote_ip = ($_SERVER['REMOTE_ADDR']);
$tab = array();$user = array();
$connection_history = "";
$nb_connection_history = 3;
 
# on discrimine les accès directs sur Alcasar par rapport aux redirections (blacklist ou pannes rso)
if (($_SERVER['HTTP_HOST'] == $private_ip) || preg_match ("/^alcasar/", $_SERVER['HTTP_HOST']) || preg_match ("/^$hostname/", $_SERVER['HTTP_POST']))
{
15,14 → 17,45
exec ("sudo /usr/sbin/chilli_query list|grep $remote_ip" , $tab);
$user = explode (" ", $tab[0]);
}
#### Affichage des 3 dernières connexions de $user[5]
function secondsToDuration($seconds = null){
if ($seconds == null) return "";
 
#### Connexion DB à faire !
#### Avec retour 3 dernière connexion de $user[5]
$result_user = "3 dernières connexions :";
$temp = $seconds % 3600;
$time[0] = ( $seconds - $temp ) / 3600 ; // hours
$time[2] = $temp % 60 ; // seconds
$time[1] = ( $temp - $time[2] ) / 60; // minutes
return $time[0]." h ".$time[2]." m ".$time[1]." s";
}
 
$l_connected = "connected"; // a traduire (choix de la langue ci-dessous mais nécessitant de $connection_history)
// si on a pas d'accès à la bdd, la page s'affiche quand même correctement
if ($user[4] != "0"){
if ((is_file("./acc/manager/lib/sql/drivers/mysql/functions.php"))&&(is_file("/etc/freeradius-web/config.php"))){
include_once("/etc/freeradius-web/config.php");
include_once("./acc/manager/lib/sql/drivers/mysql/functions.php");
$sql = "SELECT UserName, AcctStartTime, AcctStopTime, acctsessiontime FROM radacct WHERE UserName='$user[5]' ORDER BY AcctStartTime DESC LIMIT 0 , $nb_connection_history";
$link = @da_sql_pconnect($config); // on affiche pas les erreurs
if ($link){
$res = @da_sql_query($link,$config,$sql); // on affiche pas les erreurs
if ($res){
$connection_history.= "<ul>";
while(($row = @da_sql_fetch_array($res,$config))){
$connected = "";
if ($row[acctstoptime] == "") $connected = " ($l_connected)";
$connection_history.="<li title='$row[username] $row[acctstarttime] $row[acctstoptime] (".secondsToDuration($row[acctsessiontime]).")'>$row[acctstarttime] (".secondsToDuration($row[acctsessiontime]).") $connected</li>";
}
$connection_history.="</ul>";
}
}
}
}
####
 
 
# Choice of language
$Language = 'en';
if(isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])){
39,18 → 72,18
$l_contact_access_deny = "Contactez le responsable de la s&eacute;curit&eacute; (OSSI/RSSI) si vous pensez que ce filtrage est abusif.";
$l_contact_net_pb = "Contactez votre responsable informatique ou votre prestataire Internet pour plus d'information.";
$l_welcome = "Page principale de votre portail captif";
$l_acc_access = "<a href=\"https://$hostname/acc\">Acc&egrave;s au centre de gestion</A>";
$l_install_certif = "<a href=\"$cert_add/certificat_alcasar_ca.crt\">Installer le certificat racine</A>";
$l_install_certif_more = "<a href=\"$cert_add/certificat_alcasar_ca.crt\">Installation du certificat de l'autorit&eacute; racine d'ALCASAR</A>";
$l_acc_access = "<a href=\"https://$hostname/acc\">Acc&egrave;s au centre de gestion</a>";
$l_install_certif = "<a href=\"$cert_add/certificat_alcasar_ca.crt\">Installer le certificat racine</a>";
$l_install_certif_more = "<a href=\"$cert_add/certificat_alcasar_ca.crt\">Installation du certificat de l'autorit&eacute; racine d'ALCASAR</a>";
$l_certif_explain = "Permet l'&eacute;change de donn&eacute;es s&eacute;curis&eacute;es entre votre station de consultation et le portail captif ALCASAR.<BR>Si ce certificat n'est pas enregistr&eacute; sur votre station de consultation, il est possible que des alertes de s&eacute;curit&eacute;s soient &eacute;mises par votre navigateur.<br><br>";
$l_certif_explain_help = "<a href=\"alcasar-certificat.pdf\" target=\"_blank\">Aide pour les certificats</a>";
if ($user[4] == "0") {
$l_logout_explain = "Aucune session de consultation Internet n'est actuellement ouverte sur votre syst&egrave;me.";
$l_logout = "<a href=\"http://www.google.fr\">Ouvrir une session Internet</A>";}
$l_logout = "<a href=\"http://www.google.fr\">Ouvrir une session Internet</a>";}
else {
$l_logout_explain = "Ferme la session de l'usager actuellement connect&eacute;. <br><br>Utilisateur connect&eacute; :<br><br><a href=\"http://$hostname:3990/logoff\" title=\"Deconnecter l'utilisateur $user[5]\"><b>$user[5]</b></a><br><br>$result_user";
$l_logout = "<a href=\"http://$hostname:3990/logoff\">Se d&eacute;connecter d'internet</A>";}
$l_password_change = "<a href=\"https://$hostname/pass\">Changer votre mot de passe</A>";
$l_logout_explain = "Ferme la session de l'usager actuellement connect&eacute;. <br><br>Utilisateur connect&eacute; : <a href=\"http://$hostname:3990/logoff\" title=\"Deconnecter l'utilisateur $user[5]\"><b>$user[5]</b></a><br><br>$nb_connection_history derni&egrave;res connexions :$connection_history";
$l_logout = "<a href=\"http://$hostname:3990/logoff\">Se d&eacute;connecter d'internet</a>";}
$l_password_change = "<a href=\"https://$hostname/pass\">Changer votre mot de passe</a>";
$l_password_change_explain = "Vous redirige sur la page de changement du mot de passe de votre compte d'acc&egrave;s &agrave; internet.<br><br>Vous devez avoir un compte internet valide.";
$l_back_page = "<a href=\"javascript:history.back()\">Page pr&eacute;c&eacute;dente</a>";
}
65,18 → 98,18
$l_contact_access_deny = "Contact your security system manager if you think this filtering is abusive.";
$l_contact_net_pb = "Contact your network responsive or your Internet provider for more information";
$l_welcome = "Your captive portal main page";
$l_acc_access = "<a href=\"https://$hostname/acc\">ALCASAR Control Center</A>";
$l_install_certif = "<a href=\"$cert_add/certificate_alcasar_ca.crt\">Install ALCASAR AC Certificate</A>";
$l_install_certif_more = "<a href=\"$cert_add/certificat_alcasar_ca.cert\">Install ALCASAR AC Certificate</A>";
$l_acc_access = "<a href=\"https://$hostname/acc\">ALCASAR Control Center</a>";
$l_install_certif = "<a href=\"$cert_add/certificate_alcasar_ca.crt\">Install ALCASAR AC Certificate</a>";
$l_install_certif_more = "<a href=\"$cert_add/certificat_alcasar_ca.cert\">Install ALCASAR AC Certificate</a>";
$l_certif_explain = "A TRADUIRE<br><br>";
$l_certif_explain_help = "<a href=\"alcasar-certificat.pdf\" target=\"_blank\">Help for ALCASAR certificate</a>";
if ($user[4] == "0") {
$l_logout_explain = "No Internet consultation session is actualy open on your system";
$l_logout = "<a href=\"http://www.google.fr\">Open an Internet session</A>";}
$l_logout = "<a href=\"http://www.google.fr\">Open an Internet session</a>";}
else {
$l_logout_explain = "Close the session of the user actualy connecterd.<br> User logged-on :<br><br><a href=\"http://$hostname:3990/logoff\" title=\"Disconnect user $user[5]\"><b>$user[5]</b></a><br><br>$result_user";
$l_logout = "<a href=\"http://$hostname:3990/logoff\">Logoff from internet</A>";}
$l_password_change = "<a href=\"https://$hostname/pass\">Change your password</A>";
$l_logout_explain = "Close the session of the user actualy connecterd.<br> User logged-on : <a href=\"http://$hostname:3990/logoff\" title=\"Disconnect user $user[5]\"><b>$user[5]</b></a><br><br>$nb_connection_history last connections :$connection_history";
$l_logout = "<a href=\"http://$hostname:3990/logoff\">Logoff from internet</a>";}
$l_password_change = "<a href=\"https://$hostname/pass\">Change your password</a>";
$l_password_change_explain = "Ridirect you on password change page.<br><br> You should already have an Internet access account.";
$l_back_page = "<a href=\"javascript:history.back()\">Previous page</a>";
}
107,103 → 140,104
$img_internet = $img_connect;
}
 
 
header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
echo "<html><head><title>ALCASAR - $l_title";
?>
</title>
<LINK rel=stylesheet type=text/css href="css/style_intercept.css">
<script>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>ALCASAR - <?php echo $l_title; ?></title>
<meta http-equiv="Cache-control" content="no-cache">
<meta http-equiv="Pragma" content="no-cache">
<link rel="stylesheet" type="text/css" href="css/style_intercept.css">
<script type="text/javascript">
function valoriserDiv5(param){
document.getElementById("box_info").innerHTML = param.innerHTML;
}
</script>
</head>
 
<BODY onload="valoriserDiv5(text_conn);">
<body onload="valoriserDiv5(text_conn);">
<?php
if ($direct_access){
echo "
<DIV id=\"cadre_titre\" class=\"titre_controle\">
<P id=\"acces_controle\" class=\"titre_controle\">$l_title</P>";
<div id=\"cadre_titre\" class=\"titre_controle\">
<p id=\"acces_controle\" class=\"titre_controle\">$l_title</p>";
if ($network_pb) {
echo " <SPAN>$l_explain_net_pb</SPAN>";
echo " <span>$l_explain_net_pb</span>";
}
}
else {
echo"
<DIV id=\"cadre_titre\" class=\"titre_refus\">
<P id=\"acces_controle\" class=\"titre_refus\">$l_title</P>";
<div id=\"cadre_titre\" class=\"titre_refus\">
<p id=\"acces_controle\" class=\"titre_refus\">$l_title</p>";
}
?>
<DIV id="boite_logo">
<IMG src="images/organisme.png">
</DIV>
</DIV>
<DIV id="contenu_acces">
<DIV id="box_url">
<div id="boite_logo">
<img src="images/organisme.png">
</div>
</div>
<div id="contenu_acces">
<div id="box_url">
<?php if (! $direct_access){echo "$l_required_domain : $_SERVER[HTTP_HOST]";}?>
</DIV>
</div>
<?php
if ($direct_access){
echo " <DIV id=\"box_bienvenue\">
echo " <div id=\"box_bienvenue\">
$l_welcome
</DIV>
<DIV class=\"box_menu\" id=\"box_conn\" onmouseover=\"valoriserDiv5(text_conn);\">
<SPAN>$l_logout</SPAN>
<IMG src=\"$img_rep$img_internet\">
</DIV>
<DIV class=\"box_menu\" id=\"box_certif\" onmouseover=\"valoriserDiv5(text_certif);\">
<SPAN>$l_install_certif</SPAN>
<IMG src=\"$img_rep$img_certificate\">
</DIV>
 
<DIV class=\"box_menu\" id=\"box_mdp\" onmouseover=\"valoriserDiv5(text_mdp);\">
<IMG src=\"$img_rep$img_pwd\">
<SPAN>$l_password_change</SPAN>
</DIV>
<DIV class=\"box_menu\" id=\"box_acc\" onmouseover=\"valoriserDiv5(text_acc);\">
<SPAN>$l_acc_access</SPAN>
<IMG src=\"$img_rep$img_acc\">
</DIV>
<DIV class=\"div-cache\" id=\"text_conn\">
<H2>$l_logout</H2>
<P>$l_logout_explain</P>
<IMG src=\"$img_rep$img_internet\">
</DIV>
<DIV class=\"div-cache\" id=\"text_certif\">
<H2>$l_install_certif_more</H2>
<P>$l_certif_explain $l_certif_explain_help</P>
<IMG src=\"$img_rep$img_certificate\">
</DIV>
<DIV class=\"div-cache\" id=\"text_mdp\">
<H2>$l_password_change</H2>
<P>$l_password_change_explain</P>
<IMG src=\"$img_rep$img_pwd\">
</DIV>
<DIV class=\"div-cache\" id=\"text_acc\">
<H2>$l_acc_access</H2>
<P>$l_explain</P>
<IMG src=\"$img_rep$img_acc\">
</DIV>
<DIV id=\"box_info\">
</DIV>";
</div>
<div class=\"box_menu\" id=\"box_conn\" onmouseover=\"valoriserDiv5(text_conn);\">
<span>$l_logout</span>
<img src=\"$img_rep$img_internet\">
</div>
<div class=\"box_menu\" id=\"box_certif\" onmouseover=\"valoriserDiv5(text_certif);\">
<span>$l_install_certif</span>
<img src=\"$img_rep$img_certificate\">
</div>
<div class=\"box_menu\" id=\"box_mdp\" onmouseover=\"valoriserDiv5(text_mdp);\">
<img src=\"$img_rep$img_pwd\">
<span>$l_password_change</span>
</div>
<div class=\"box_menu\" id=\"box_acc\" onmouseover=\"valoriserDiv5(text_acc);\">
<span>$l_acc_access</span>
<img src=\"$img_rep$img_acc\">
</div>
<div class=\"div-cache\" id=\"text_conn\">
<h2>$l_logout</h2>
<p>$l_logout_explain</p>
<img src=\"$img_rep$img_internet\">
</div>
<div class=\"div-cache\" id=\"text_certif\">
<h2>$l_install_certif_more</h2>
<p>$l_certif_explain $l_certif_explain_help</p>
<img src=\"$img_rep$img_certificate\">
</div>
<div class=\"div-cache\" id=\"text_mdp\">
<h2>$l_password_change</h2>
<p>$l_password_change_explain</p>
<img src=\"$img_rep$img_pwd\">
</div>
<div class=\"div-cache\" id=\"text_acc\">
<h2>$l_acc_access</h2>
<p>$l_explain</p>
<img src=\"$img_rep$img_acc\">
</div>
<div id=\"box_info\">
</div>";
}
else {
echo "
<DIV id=\"box_refuse\">
<div id=\"box_refuse\">
<img src=\"$img_rep$img_false\">
<P>$l_explain</P>
</DIV>
<DIV id=\"liens_redir\">
<P>$l_back_page</P>
</DIV>";
<p>$l_explain</p>
</div>
<div id=\"liens_redir\">
<p>$l_back_page</p>
</div>";
}
if (($network_pb)&&(! $direct_access)) {
echo " <SPAN>Diagnostic : $diagnostic</SPAN>";
echo " <span>Diagnostic : $diagnostic</span>";
}
 
?>
</DIV>
</BODY>
</div>
</body>
</html>