Subversion Repositories ALCASAR

Rev

Rev 2226 | Rev 2269 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log

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