Subversion Repositories ALCASAR

Rev

Rev 2226 | Rev 2269 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log

Rev Author Line No. Line
2182 tom.houday 1
<?php
2
# $Id $
3
 
2267 richard 4
/********************
5
* READ CONF FILES   *
6
*********************/
7
define ("CONF_FILE", "/usr/local/etc/alcasar.conf");
8
define ("ACC_ACCESS_LOG", "/var/Save/security/acc_access.log");
9
$conf_files=array(CONF_FILE,ACC_ACCESS_LOG);
10
foreach ($conf_files as $file){
11
if (!file_exists($file)){
12
	exit("Requested file ".$file." isn't present");}
13
if (!is_readable($file)){
14
	exit("Can't read the file ".$file);}
15
}
2182 tom.houday 16
// Read CONF_FILE
2267 richard 17
$file_conf = fopen(CONF_FILE, 'r'); # retrieve the version number
2182 tom.houday 18
while (!feof($file_conf)) {
19
	$tampon = fgets($file_conf, 4096);
20
	if ((strpos($tampon, '=') !== false) && (substr($tampon, 0, 1) !== '#')) {
21
		$tmp = explode('=', $tampon);
22
		$conf[$tmp[0]] = trim($tmp[1]);
23
	}
24
}
25
fclose($file_conf);
26
?>
374 richard 27
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN//2.0">
28
<HTML>
29
<!-- written by Rexy ! -->
30
<HEAD>
31
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
32
<TITLE>menu</TITLE>
33
<link rel="stylesheet" href="/css/style.css" type="text/css">
34
</HEAD>
35
<?
2267 richard 36
// retrieve the user's profil
1911 raphael.pi 37
exec('sudo alcasar-profil.sh -l | cut -d":" -f2 2>&1', $output);
38
$user_htdigest=$_SERVER['PHP_AUTH_USER'];
39
 
40
if(strpos($output[0], $user_htdigest))
41
{
42
	$right=1;
43
}
44
elseif(strpos($output[1], $user_htdigest))
45
{
46
	$right=2;
47
}
48
elseif(strpos($output[2], $user_htdigest))
49
{
50
	$right=3;
51
}
52
else
53
{
54
	exit();
55
}
56
 
2182 tom.houday 57
$installed_version = $conf['VERSION'];
1911 raphael.pi 58
 
374 richard 59
# Choice of language
1325 richard 60
if(isset($_SERVER['HTTP_ACCEPT_LANGUAGE']))
61
{
62
	$Langue = explode(",",$_SERVER['HTTP_ACCEPT_LANGUAGE']);
63
	$Language = strtolower(substr(chop($Langue[0]),0,2));
374 richard 64
}
1325 richard 65
if($Language == 'fr')
66
{
67
	$l_home = "ACCUEIL";
68
	$l_system = "SYSTÈME";
69
	$l_auth = "AUTHENTIFICATION";
70
	$l_filter = "FILTRAGE";
71
	$l_statistics = "STATISTIQUES";
72
	$l_backup = "SAUVEGARDES";
73
	$l_activity = "Activité";
1521 richard 74
	$l_blacklist = "Liste noire";
75
	$l_whitelist = "Liste blanche";
1536 richard 76
	$l_network = "Réseau";
1325 richard 77
	$l_ldap = "Ldap/A.D.";
2267 richard 78
	$l_access_nb = "Nb d'accès à l'ACC";
2226 richard 79
	$l_create_user = "Créer des utilisateurs";
80
	$l_edit_user = "Gérer les utilisateurs";
1325 richard 81
	$l_create_group = "Créer un groupe";
2226 richard 82
	$l_edit_group = "Gérer les groupe";
1325 richard 83
	$l_import_empty = "Importer / Vider";
1521 richard 84
	$l_protocols = "Protocoles";
2222 richard 85
	$l_stat_user_day = "Par connexion";
86
	$l_stat_con = "Journal global";
1536 richard 87
	$l_stat_daily ="Usage journalier";
88
	$l_stat_global_network="Trafic global";
89
	$l_stat_detail_network="Trafic détaillé";
90
	$l_security="Sécurité";
1325 richard 91
	$l_menu="Menu";
1349 richard 92
	$l_gammu="Auto enregistrement (SMS)";
1911 raphael.pi 93
	$l_archive="Archivage";
94
	$l_log="Générer les journaux";
1952 raphael.pi 95
	$l_backup_archive="Archives";
2009 raphael.pi 96
	$l_activity_report="Rapport d'activité";
2010 raphael.pi 97
	$l_backup_log="Journaux d'imputabilité";
2267 richard 98
	$l_since="depuis le :";
374 richard 99
}
1325 richard 100
else
101
{
102
	$Language = 'en';
103
	$l_home = "HOME";
104
	$l_system = "SYSTEM";
105
	$l_auth = "AUTHENTICATION";
106
	$l_filter = "FILTERING";
107
	$l_statistics = "STATISTICS";
108
	$l_backup = "BACKUPS";
109
	$l_activity = "Activity";
1521 richard 110
	$l_blacklist = "Blacklist";
111
	$l_whitelist = "Whitelist";
1536 richard 112
	$l_network = "Network";
1325 richard 113
	$l_ldap = "Ldap/A.D.";
2267 richard 114
	$l_access_nb = "ACC access Nbr";
2226 richard 115
	$l_create_user = "Create users";
116
	$l_edit_user = "Manage users";
1325 richard 117
	$l_create_group = "Create a group";
2226 richard 118
	$l_edit_group = "Manage groups";
1325 richard 119
	$l_import_empty = "Import / Empty";
1521 richard 120
	$l_protocols= "Protocols";
2222 richard 121
	$l_stat_user_day = "By connexion";
122
	$l_stat_con = "Global accounting";
1325 richard 123
	$l_stat_daily ="daily use";
1536 richard 124
	$l_stat_global_network="global trafic";
125
	$l_stat_detail_network="detailed trafic";
1325 richard 126
	$l_security="security";
127
	$l_menu="Main";
1349 richard 128
	$l_gammu="Auto registration (SMS)";
1952 raphael.pi 129
	$l_backup_archive="Archives";
1911 raphael.pi 130
	$l_backup_log="Log generation";
2009 raphael.pi 131
	$l_activity_report="Activity report";
2267 richard 132
	$l_since="since";
1325 richard 133
}
374 richard 134
echo "
135
	<TABLE width=\"100%\" border=0 cellspacing=0 cellpadding=0>
136
	<tr><th>$l_menu</th></tr>
137
	<tr><td bgcolor=\"#FFCC66\"><img src=\"/images/pix.gif\" width=1 height=2></td></tr>
138
</TABLE>
139
<TABLE width=\"100%\" border=1 cellspacing=0 cellpadding=0>
140
	<tr bgcolor=\"#666666\"><td>
141
		<TABLE width=\"100%\" border=0 cellspacing=0 cellpadding=2>
142
			<tr><td valign=\"middle\" align=\"left\">
143
				<img src=\"/images/right.gif\" height=10 width=10 border=no nosave><A HREF=\"phpsysinfo/\" TARGET=\"REXY2\">$l_home</A></td></tr>";
144
if (isset($_GET['a'])) { $a=$_GET['a']; }
145
	else $a=0;
146
if (isset($_GET['b'])) { $b=$_GET['b']; }
147
	else $b=0;
1911 raphael.pi 148
 
149
switch($right){
2002 raphael.pi 150
	case 1: #admin
1911 raphael.pi 151
		$selection[0]=$l_system;
152
		$selection[1]=$l_auth;
153
		$selection[2]=$l_filter;
154
		$selection[3]=$l_statistics;
155
		$selection[4]=$l_backup;
156
		$fichier[0]="system.php";
157
		$fichier[1]="auth.php";
158
		$fichier[2]="filtering.php";
159
		$fichier[3]="stat.php";
160
		$fichier[4]="backup.php";
161
		break;
2002 raphael.pi 162
	case 2: #backup
1911 raphael.pi 163
		$selection[0]=$l_backup;
164
		$fichier[0]="backup.php";
165
		break;
2002 raphael.pi 166
	case 3: #manager
1911 raphael.pi 167
		$selection[0]=$l_auth;
168
		$fichier[0]="auth.php";
169
		break;
170
	default:
171
		exit();
172
		break;
173
 
174
}
175
 
374 richard 176
$i=0;
177
$nb1=count($selection);
178
while ($i != $nb1)
179
  {
180
	if ($a==1 AND $i==$b)
181
		{
182
		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>";
183
		include($fichier[$i]);
184
		}
185
	else
186
		{
187
		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>";
188
		}
189
	$i++;
190
  }
1911 raphael.pi 191
 
374 richard 192
?>
193
		</TABLE>
194
	</td></tr>
195
</TABLE>
196
<br>
197
<TABLE width="100%" border="0" cellspacing="0" cellpadding="0">
198
	<tr><th>Doc</th></tr>
199
	<tr bgcolor="#FFCC66"><td><img src="/images/pix.gif" width="1"
200
height="2"></td></tr>
201
</TABLE>
202
<TABLE width="100%" border=1 cellspacing=0 cellpadding=0>
203
	<tr bgcolor="#666666"><td>
204
		<TABLE width="100%" border=0 cellspacing=0 cellpadding=2>
205
			<tr><td valign="middle" align="left"><img src="/images/right.gif" height=10
811 richard 206
width=10 border=no nosave><a href="<? echo "alcasar-$installed_version-presentation-$Language.pdf"; ?>" target="_blank">Presentation</a></td></tr>
374 richard 207
			<tr><td valign="middle" align="left"><img src="/images/right.gif" height=10
811 richard 208
width=10 border=no nosave><a href="<? echo "alcasar-$installed_version-installation-$Language.pdf"; ?>" target="_blank">Installation</a></td></tr>
374 richard 209
			<tr><td valign="middle" align="left"><img src="/images/right.gif" height=10
1025 richard 210
width=10 border=no nosave><a href="<? echo "alcasar-$installed_version-exploitation-$Language.pdf"; ?>" target="_blank">Exploitation</a></td></tr>
686 richard 211
			<tr><td valign="middle" align="left"><img src="/images/right.gif" height=10
212
width=10 border=no nosave><a href="<? echo "alcasar-$installed_version-technique.pdf"; ?>" target="_blank">Technique</a></td></tr>
374 richard 213
		</TABLE>
214
	</td></tr>
215
</TABLE>
216
<BR>
217
<TABLE width="100%" border="0" cellspacing="0" cellpadding="0">
218
	<tr><th><? echo "$l_access_nb"; ?></th></tr>
219
	<tr bgcolor="#FFCC66"><td><img src="/images/pix.gif" width="1" height="2"></td></tr>
220
</TABLE>
221
<TABLE width="100%" border=1 cellspacing=0 cellpadding=0>
222
	<tr bgcolor="#666666"><td>
223
	<TABLE width="100%" border=0 cellspacing=0 cellpadding=0>
224
		<tr><td valign="middle" align="center">
2267 richard 225
		<a href="admin_log.php" target="REXY2">
226
		<?
227
			$tab=file(ACC_ACCESS_LOG);
228
			$counter=count ($tab);
229
			$field=explode("|", $tab[1]);
230
			$first_date_time=$field[0];
231
			$first_date=explode(" ", $first_date_time);
232
			echo "$counter</a><br>";
233
			echo "$l_since $first_date[0]";
374 richard 234
		?>
235
	</TABLE>
236
	</td></tr>
237
</TABLE>
238
</BODY>
239
</HTML>
1911 raphael.pi 240
 
2093 raphael.pi 241