Subversion Repositories ALCASAR

Rev

Rev 2226 | Rev 2315 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log

<?php
# $Id $

/********************
* READ CONF FILES   *
*********************/
define ("CONF_FILE", "/usr/local/etc/alcasar.conf");
define ("ACC_ACCESS_LOG", "/var/Save/security/acc_access.log");
$conf_files=array(CONF_FILE,ACC_ACCESS_LOG);
foreach ($conf_files as $file){
if (!file_exists($file)){
        exit("Requested file ".$file." isn't present");}
if (!is_readable($file)){
        exit("Can't read the file ".$file);}
}
// Read CONF_FILE
$file_conf = fopen(CONF_FILE, 'r'); # retrieve the version number
while (!feof($file_conf)) {
        $tampon = fgets($file_conf, 4096);
        if ((strpos($tampon, '=') !== false) && (substr($tampon, 0, 1) !== '#')) {
                $tmp = explode('=', $tampon);
                $conf[$tmp[0]] = trim($tmp[1]);
        }
}
fclose($file_conf);
?>
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN//2.0">
<HTML>
<!-- written by Rexy ! -->
<HEAD>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<TITLE>menu</TITLE>
<link rel="stylesheet" href="/css/style.css" type="text/css">
</HEAD>
<?
// retrieve the user's profil
exec('sudo alcasar-profil.sh -l | cut -d":" -f2 2>&1', $output);
$user_htdigest=$_SERVER['PHP_AUTH_USER'];

if(strpos($output[0], $user_htdigest))
{
        $right=1;
}
elseif(strpos($output[1], $user_htdigest))
{
        $right=2;
}
elseif(strpos($output[2], $user_htdigest))
{
        $right=3;
}
else
{
        exit();
}

$installed_version = $conf['VERSION'];

# Choice of language
if(isset($_SERVER['HTTP_ACCEPT_LANGUAGE']))
{
        $Langue = explode(",",$_SERVER['HTTP_ACCEPT_LANGUAGE']);
        $Language = strtolower(substr(chop($Langue[0]),0,2));
}
if($Language == 'fr')
{
        $l_home = "ACCUEIL";
        $l_system = "SYSTÈME";
        $l_auth = "AUTHENTIFICATION";
        $l_filter = "FILTRAGE";
        $l_statistics = "STATISTIQUES";
        $l_backup = "SAUVEGARDES";
        $l_activity = "Activité";
        $l_blacklist = "Liste noire";
        $l_whitelist = "Liste blanche";
        $l_network = "Réseau";
        $l_ldap = "Ldap/A.D.";
        $l_access_nb = "Nb d'accès à l'ACC";
        $l_create_user = "Créer des utilisateurs";
        $l_edit_user = "Gérer les utilisateurs";
        $l_create_group = "Créer un groupe";
        $l_edit_group = "Gérer les groupe";
        $l_import_empty = "Importer / Vider";
        $l_protocols = "Protocoles";
        $l_stat_user_day = "Par connexion";
        $l_stat_con = "Journal global";
        $l_stat_daily ="Usage journalier";
        $l_stat_global_network="Trafic global";
        $l_stat_detail_network="Trafic détaillé";
        $l_security="Sécurité";
        $l_menu="Menu";
        $l_gammu="Auto enregistrement (SMS)";
        $l_archive="Archivage";
        $l_log="Générer les journaux";
        $l_backup_archive="Archives";
        $l_activity_report="Rapport d'activité";
        $l_backup_log="Journaux d'imputabilité";
        $l_since="depuis le :";
}
else
{
        $Language = 'en';
        $l_home = "HOME";
        $l_system = "SYSTEM";
        $l_auth = "AUTHENTICATION";
        $l_filter = "FILTERING";
        $l_statistics = "STATISTICS";
        $l_backup = "BACKUPS";
        $l_activity = "Activity";
        $l_blacklist = "Blacklist";
        $l_whitelist = "Whitelist";
        $l_network = "Network";
        $l_ldap = "Ldap/A.D.";
        $l_access_nb = "ACC access Nbr";
        $l_create_user = "Create users";
        $l_edit_user = "Manage users";
        $l_create_group = "Create a group";
        $l_edit_group = "Manage groups";
        $l_import_empty = "Import / Empty";
        $l_protocols= "Protocols";
        $l_stat_user_day = "By connexion";
        $l_stat_con = "Global accounting";
        $l_stat_daily ="daily use";
        $l_stat_global_network="global trafic";
        $l_stat_detail_network="detailed trafic";
        $l_security="security";
        $l_menu="Main";
        $l_gammu="Auto registration (SMS)";
        $l_backup_archive="Archives";
        $l_backup_log="Log generation";
        $l_activity_report="Activity report";
        $l_since="since";
}
echo "
        <TABLE width=\"100%\" border=0 cellspacing=0 cellpadding=0>
        <tr><th>$l_menu</th></tr>
        <tr><td bgcolor=\"#FFCC66\"><img src=\"/images/pix.gif\" width=1 height=2></td></tr>
</TABLE>
<TABLE width=\"100%\" border=1 cellspacing=0 cellpadding=0>
        <tr bgcolor=\"#666666\"><td>
                <TABLE width=\"100%\" border=0 cellspacing=0 cellpadding=2>
                        <tr><td valign=\"middle\" align=\"left\">
                                <img src=\"/images/right.gif\" height=10 width=10 border=no nosave><A HREF=\"phpsysinfo/\" TARGET=\"REXY2\">$l_home</A></td></tr>";
if (isset($_GET['a'])) { $a=$_GET['a']; }
        else $a=0;
if (isset($_GET['b'])) { $b=$_GET['b']; }
        else $b=0;
        
switch($right){
        case 1: #admin
                $selection[0]=$l_system;
                $selection[1]=$l_auth;
                $selection[2]=$l_filter;
                $selection[3]=$l_statistics;
                $selection[4]=$l_backup;
                $fichier[0]="system.php";
                $fichier[1]="auth.php";
                $fichier[2]="filtering.php";
                $fichier[3]="stat.php";
                $fichier[4]="backup.php";
                break;
        case 2: #backup
                $selection[0]=$l_backup;
                $fichier[0]="backup.php";
                break;
        case 3: #manager
                $selection[0]=$l_auth;
                $fichier[0]="auth.php";
                break;
        default:
                exit();
                break;

}

$i=0;
$nb1=count($selection);
while ($i != $nb1)
  {
        if ($a==1 AND $i==$b)
                {
                echo "<tr><td valign=\"middle\" align=\"left\"><img src=\"/images/down2.gif\" height=10 width=10 border=no nosave><a href=\"menu.php?a=0&b=0\"><font color=\"black\"><b>$selection[$i]</b></font></a></td></tr>";
                include($fichier[$i]);
                }
        else
                {
                echo "<tr><td valign=\"middle\" align=\"left\"><img src=\"/images/right.gif\" height=10 width=10 border=no nosave><a href=\"menu.php?a=1&b=$i\">$selection[$i]</a></td></tr>";
                }
        $i++;
  }
                
?>
                </TABLE>
        </td></tr>
</TABLE>
<br>
<TABLE width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr><th>Doc</th></tr>
        <tr bgcolor="#FFCC66"><td><img src="/images/pix.gif" width="1"
height="2"></td></tr>
</TABLE>
<TABLE width="100%" border=1 cellspacing=0 cellpadding=0>
        <tr bgcolor="#666666"><td>
                <TABLE width="100%" border=0 cellspacing=0 cellpadding=2>
                        <tr><td valign="middle" align="left"><img src="/images/right.gif" height=10
width=10 border=no nosave><a href="<? echo "alcasar-$installed_version-presentation-$Language.pdf"; ?>" target="_blank">Presentation</a></td></tr>
                        <tr><td valign="middle" align="left"><img src="/images/right.gif" height=10
width=10 border=no nosave><a href="<? echo "alcasar-$installed_version-installation-$Language.pdf"; ?>" target="_blank">Installation</a></td></tr>
                        <tr><td valign="middle" align="left"><img src="/images/right.gif" height=10
width=10 border=no nosave><a href="<? echo "alcasar-$installed_version-exploitation-$Language.pdf"; ?>" target="_blank">Exploitation</a></td></tr>
                        <tr><td valign="middle" align="left"><img src="/images/right.gif" height=10
width=10 border=no nosave><a href="<? echo "alcasar-$installed_version-technique.pdf"; ?>" target="_blank">Technique</a></td></tr>
                </TABLE>
        </td></tr>
</TABLE>
<BR>
<TABLE width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr><th><? echo "$l_access_nb"; ?></th></tr>
        <tr bgcolor="#FFCC66"><td><img src="/images/pix.gif" width="1" height="2"></td></tr>
</TABLE>
<TABLE width="100%" border=1 cellspacing=0 cellpadding=0>
        <tr bgcolor="#666666"><td>
        <TABLE width="100%" border=0 cellspacing=0 cellpadding=0>
                <tr><td valign="middle" align="center">
                <a href="admin_log.php" target="REXY2">
                <?
                        $tab=file(ACC_ACCESS_LOG);
                        $counter=count ($tab);
                        $field=explode("|", $tab[1]);
                        $first_date_time=$field[0];
                        $first_date=explode(" ", $first_date_time);
                        echo "$counter</a><br>";
                        echo "$l_since $first_date[0]";
                ?>
        </TABLE>
        </td></tr>
</TABLE>
</BODY>
</HTML>