Subversion Repositories ALCASAR

Rev

Blame | Last modification | View Log

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><!-- written by Rexy - 3abtux -->
<HEAD>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<TITLE>Exceptions</TITLE>
<link rel="stylesheet" href="/css/style.css" type="text/css">
</HEAD>
<body>
<?
# Choice of language
$Language = 'en';
if(isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])){
  $Langue = explode(",",$_SERVER['HTTP_ACCEPT_LANGUAGE']);
  $Language = strtolower(substr(chop($Langue[0]),0,2)); }
if($Language == 'fr'){
  $l_trusted_sites = "Sites Internet de confiance";
  $l_trusted_sites_explain1 = "Entrez ici les noms de site ou d'URLs Internet pouvant &ecirc;tre joints sans authentification";
  $l_trusted_sites_explain2 = "Entrez un noms par ligne";
  $l_trusted_sites_list = "Liste de sites Internet de confiance";
  $l_trusted_urls_list = "Liste d'URLs Internet de confiance";
  $l_trusted_mac = "&Eacute;quipements de confiance";
  $l_trusted_mac_explain1 = "Entrez ici les adresses MAC des &eacute;quipements autorisés à joindre Internet sans authentification";
  $l_trusted_mac_explain2 = "Entrez une adresse MAC par ligne";
  $l_trusted_mac_list = "Liste des adresses MAC de confiance";
  $l_submit = "Enregistrer";
}
else {
  $l_trusted_sites = "Trusted Internet sites";
  $l_trusted_sites_explain1 = "Enter name of Internet sites or URLS that could be joined without authentication";
  $l_trusted_sites_explain2 = "Enter one name per line";
  $l_trusted_sites_list = "Trusted Internet sites list";
  $l_trusted_urls_list = "Trusted Internet URLs list";
  $l_trusted_mac = "Trusted Equipments";
  $l_trusted_mac_explain1 = "Enter MAC address of equipments that could contact Internet without authentification";
  $l_trusted_mac_explain2 = "Enter one Mac address per line";
  $l_trusted_mac_list = "Trusted MAC addresses list";
  $l_submit = "Submit";
}
if (isset($_POST['choix'])){ 
        switch ($_POST['choix'])
        {
        case 'MAJ_UAMALLOWED' :
                $nb_domain=0;
                $tab_domains = explode ("\n", $_POST['trusted_domains']);
                $fichier=fopen("/etc/chilli/alcasar-uamdomain","w+");
                fputs ($fichier, "HS_UAMDOMAINS=\"");
                foreach ($tab_domains as $domain ){
                        $tr_domain=trim($domain);
                        $nb_domain++;
                        if ($tr_domain != ""){
                                if ($nb_domain>1) fputs ($fichier, ",".$tr_domain);
                                else fputs ($fichier, $tr_domain);
                                }
                        }       
                fputs ($fichier, "\"");
                fclose($fichier);
                unset($_POST['trusted_domains']);
                unset($nb_domain);
                $nb_url=0;
                $tab_urls = explode ("\n", $_POST['trusted_urls']);
                $fichier=fopen("/etc/chilli/alcasar-uamallowed","w+");
                fputs ($fichier, "HS_UAMALLOW=\"");
                foreach ($tab_urls as $url ){
                        $tr_url=trim($url);
                        $nb_url++;
                        if ($tr_url != ""){
                                if ($nb_url>1) fputs ($fichier, ",".$tr_url);
                                else fputs ($fichier, $tr_url);
                                }
                        }
                fputs ($fichier, "\"");
                fclose($fichier);
                unset($_POST['trusted_urls']);
                unset($nb_url);
                exec ("sudo service chilli restart");
                unset ($_POST['choix']);
                break;
        case 'MAJ_MACALLOWED' :
                $nb_mac=0;
                $tab_macs = explode ("\n", $_POST['trusted_macs']);
                $fichier=fopen("/etc/chilli/alcasar-macallowed","w+");
                fputs ($fichier, "HS_MACALLOW=\"");
                foreach ($tab_macs as $macs ){
                        $tr_macs=trim($macs);
                        $nb_mac++;
                        if ($tr_macs != ""){
                                if ($nb_mac>1) fputs ($fichier, ",".$tr_macs);
                                else fputs ($fichier, $tr_macs);
                                }
                        }
                fputs ($fichier, "\"");
                fclose($fichier);
                unset($_POST['trusted_macs']);
                unset($nb_mac);
                exec ("sudo service chilli restart");
                unset ($_POST['choix']);
                break;
        }       
}
?>
<TABLE width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr><th><?php echo $l_trusted_sites ;?></th></tr>
        <tr bgcolor="#FFCC66"><td><img src="/images/pix.gif" width="1" height="2"></td></tr>
</TABLE>
<TABLE width="100%" border=0 cellspacing=0 cellpadding=1>
        <tr bgcolor="#666666"><td>
        <TABLE width="100%" border=0 cellspacing=0 cellpadding=2>
                <tr><td valign="middle" align="left">
                <center><?php
                echo "$l_trusted_sites_explain1 <BR>";
                echo "$l_trusted_sites_explain2" ;
                echo "<FORM action='$_SERVER[PHP_SELF]' method='POST'>";?>
                <TABLE cellspacing=2 cellpadding=3 border=1>
                <tr><td width=50% height=100% align=center>
                        <H3><?php echo $l_trusted_sites_list ;?></H3>
                        exemple1 : www.domain1.org<BR>
                        exemple2 : domain2.net<BR>
                        <?php
                                echo "<textarea name='trusted_domains' rows=5 cols=40>";
                                $trusted_domains_file="/etc/chilli/alcasar-uamdomain";
                                $ouvre=fopen($trusted_domains_file,"r");
                                if ($ouvre)
                                        {
                                        while (!feof ($ouvre))
                                                {
                                                $tampon = fgets($ouvre, 4096);
                                                $domains = substr($tampon,15,-1);
                                                $tab_domains = explode (",", $domains);
                                                foreach ($tab_domains as $domain ){
                                                        if ($domain != "\"") echo $domain."\n";
                                                        }
                                                }
                                        }
                                else    {
                                        echo "failed to open $trusted_domains_file";
                                        }
                                fclose($ouvre);
                                echo "</textarea>";
                        ?>
                </td>
                <td  width=50% height=100% align=center>
                        <H3><?php echo $l_trusted_urls_list ;?></H3>
                        exemple1 : www.domain3.net/admin/index.htm<BR>
                        exemple2 : domain4.org/~polux/index.html<BR>
                        <?php
                                echo "<textarea name='trusted_urls' rows=5 cols=40>";
                                $trusted_urls_file="/etc/chilli/alcasar-uamallowed";
                                $ouvre=fopen($trusted_urls_file,"r");
                                if ($ouvre)
                                        {
                                        while (!feof ($ouvre))
                                                {
                                                $tampon = fgets($ouvre, 4096);
                                                $urls = substr($tampon,13,-1);
                                                $tab_urls = explode (",", $urls);
                                                foreach ($tab_urls as $url ){
                                                        if ($url != "\"") echo $url."\n";
                                                        }
                                                }
                                        }
                                else    {
                                        echo "failed to open $trusted_urls_file";
                                        }
                                fclose($ouvre);
                                echo "</textarea>";
                        ?>
                </td></tr>
                </TABLE>
                <input type='hidden' name='choix' value='MAJ_UAMALLOWED'>
                <input type='submit' value='<?php echo $l_submit ;?>'>
                </FORM>
        </td></tr>
        </TABLE>
</TABLE>
<TABLE width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr><th><?php echo $l_trusted_mac ;?></th></tr>
        <tr bgcolor="#FFCC66"><td><img src="/images/pix.gif" width="1" height="2"></td></tr>
</TABLE>
<TABLE width="100%" border=0 cellspacing=0 cellpadding=1>
        <tr bgcolor="#666666"><td>
        <TABLE width="100%" border=0 cellspacing=0 cellpadding=2>
                <tr><td valign="middle" align="left">
                <center><?php
                echo "$l_trusted_mac_explain1 <BR>";
                echo "$l_trusted_mac_explain2";
                echo "<FORM action='$_SERVER[PHP_SELF]' method='POST'>";?>
                <TABLE cellspacing=2 cellpadding=3 border=1>
                <tr><td width=60% height=100% align=center>
                        <H3><?php echo $l_trusted_mac_list ;?></H3>
                        exemple : 12-2f-36-a4-df-43<BR>
                        <?php
                                echo "<textarea name='trusted_macs' rows=5 cols=40>";
                                $trusted_macs_file="/etc/chilli/alcasar-macallowed";
                                $ouvre=fopen($trusted_macs_file,"r");
                                if ($ouvre)
                                        {
                                        while (!feof ($ouvre))
                                                {
                                                $tampon = fgets($ouvre, 4096);
                                                $macs = substr($tampon,13,-1);
                                                $tab_macs = explode (",", $macs);
                                                foreach ($tab_macs as $macs ){
                                                        if ($macs != "\"") echo $macs."\n";
                                                        }
                                                }
                                        }
                                else    {
                                        echo "failed to open $trusted_macs_file";
                                        }
                                fclose($ouvre);
                                echo "</textarea>";
                        ?>
                </td></tr>
                </TABLE>
                <input type='hidden' name='choix' value='MAJ_MACALLOWED'>
                <input type='submit' value='<?php echo $l_submit ;?>'>
                </FORM>
        </td></tr>
</TABLE>
</BODY>
</HTML>