Subversion Repositories ALCASAR

Rev

Rev 688 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log

Rev 688 Rev 841
Line 20... Line 20...
20
  $l_trusted_sites = "Domaines Internet et adresses IP de confiance";
20
  $l_trusted_sites = "Domaines Internet et adresses IP de confiance";
21
  $l_trusted_sites_explain1 = "Entrez ici les noms de domaine Internet ou les adresses IP pouvant être joints sans authentification";
21
  $l_trusted_sites_explain1 = "Entrez ici les noms de domaine Internet ou les adresses IP pouvant être joints sans authentification";
22
  $l_trusted_sites_explain2 = "Entrez un nom de domaine ou une adresse IP par ligne";
22
  $l_trusted_sites_explain2 = "Entrez un nom de domaine ou une adresse IP par ligne";
23
  $l_trusted_sites_list = "Liste de nom de domaine de confiance";
23
  $l_trusted_sites_list = "Liste de nom de domaine de confiance";
24
  $l_trusted_urls_list = "Liste d'adresses IP ou d'adresses de réseau de confiance";
24
  $l_trusted_urls_list = "Liste d'adresses IP ou d'adresses de réseau de confiance";
25
  $l_trusted_mac = "Équipements de confiance";
-
 
26
  $l_trusted_mac_explain = "Entrez ici les adresses MAC des équipements autorisés à joindre Internet sans authentification";
-
 
27
  $l_trusted_mac_list = "Liste d'adresses MAC de confiance";
-
 
28
  $l_trusted_mac_address = "Adresses MAC autorisées";
-
 
29
  $l_trusted_mac_info = "Information équipement";
-
 
30
  $l_trusted_mac_del = "Supprimer de la liste";
-
 
31
  $l_submit = "Enregistrer";
25
  $l_submit = "Enregistrer";
32
  $l_submit2 = "Appliquer";
-
 
33
  $l_add_to_list = "Ajouter";
-
 
34
}
26
}
35
else {
27
else {
36
  $l_error_open_file = "File open error";
28
  $l_error_open_file = "File open error";
37
  $l_trusted_sites = "Trusted Internet domain and IP addresses";
29
  $l_trusted_sites = "Trusted Internet domain and IP addresses";
38
  $l_trusted_sites_explain1 = "Enter Internet domain name or IP addresses that could be joined without authentication";
30
  $l_trusted_sites_explain1 = "Enter Internet domain name or IP addresses that could be joined without authentication";
39
  $l_trusted_sites_explain2 = "Enter one domain name ou one IP address per line";
31
  $l_trusted_sites_explain2 = "Enter one domain name ou one IP address per line";
40
  $l_trusted_sites_list = "Trusted Internet domain list";
32
  $l_trusted_sites_list = "Trusted Internet domain list";
41
  $l_trusted_urls_list = "Trusted IP addresses or networks addresses list";
33
  $l_trusted_urls_list = "Trusted IP addresses or networks addresses list";
42
  $l_trusted_mac = "Trusted Equipments";
-
 
43
  $l_trusted_mac_explain = "Enter MAC address of equipments that could contact Internet without authentication";
-
 
44
  $l_trusted_mac_list = "Trusted MAC addresses list";
-
 
45
  $l_trusted_mac_address = "Allowed MAC adress"; 
-
 
46
  $l_trusted_mac_info = "Equipment information";
-
 
47
  $l_trusted_mac_del = "Delete from list";
-
 
48
  $l_submit = "Submit";
34
  $l_submit = "Submit";
49
  $l_submit2 = "Apply";
-
 
50
  $l_add_to_list = "Add";
-
 
51
}
35
}
52
if (isset($_POST['choix'])){ 
36
if (isset($_POST['choix'])){ 
53
	switch ($_POST['choix'])
37
	switch ($_POST['choix'])
54
	{
38
	{
55
	case 'MAJ_UAMALLOWED' :
39
	case 'MAJ_UAMALLOWED' :
Line 72... Line 56...
72
		fclose($fichier);
56
		fclose($fichier);
73
		unset($_POST['trusted_urls']);
57
		unset($_POST['trusted_urls']);
74
		exec ("sudo service chilli restart");
58
		exec ("sudo service chilli restart");
75
		unset ($_POST['choix']);
59
		unset ($_POST['choix']);
76
		break;
60
		break;
77
case 'new_mac' :
-
 
78
	if (trim($_POST['add_mac']) != "")
-
 
79
		{
-
 
80
		if (is_file ($mac_allowed_list)) # le fichier existe
-
 
81
			{
-
 
82
			$tab=file($mac_allowed_list);
-
 
83
			$insert = true;
-
 
84
			if ($tab)  # le fichier n'est pas vide
-
 
85
				{
-
 
86
				foreach ($tab as $line)  # on teste si l'adresse mac n'est pas déjà présente
-
 
87
					{
-
 
88
					$field=explode("#", $line);
-
 
89
					$mac_addr=trim($field[0],"macallowed=");
-
 
90
					if (trim($_POST['add_mac']) == trim ($mac_addr))
-
 
91
						{
-
 
92
						$insert = false;;
-
 
93
						break;
-
 
94
						}
-
 
95
					}
-
 
96
				}
-
 
97
			if ($insert == true) 
-
 
98
				{
-
 
99
				$line = "macallowed=" . trim($_POST['add_mac']) . " #" . trim($_POST['add_comment']) . "\n";
-
 
100
				$pointeur=fopen($mac_allowed_list,"a");
-
 
101
				fwrite ($pointeur, $line);
-
 
102
				fclose ($pointeur);
-
 
103
				exec ("sudo service chilli restart");
-
 
104
				}
-
 
105
			}
-
 
106
		else {echo "$l_error_open_file $mac_allowed_list";}
-
 
107
		}
-
 
108
	break;
-
 
109
case 'del_mac' :
-
 
110
	$tab=file($mac_allowed_list);
-
 
111
	if ($tab)
-
 
112
		{
-
 
113
		$pointeur=fopen($mac_allowed_list,"w+");
-
 
114
		foreach ($tab as $line)
-
 
115
			{
-
 
116
			$field=explode("#", $line);
-
 
117
			$mac_addr=trim(trim($field[0],"macallowed="));
-
 
118
			$remove_line = false;
-
 
119
			foreach ($_POST as $key => $value)
-
 
120
				{
-
 
121
				if ($mac_addr == $key)
-
 
122
			       		{
-
 
123
					$remove_line = True;
-
 
124
					break;
-
 
125
					}
-
 
126
				}
-
 
127
			if (! $remove_line) {fwrite($pointeur,$line);}
-
 
128
			}
-
 
129
		fclose($pointeur);
-
 
130
		exec ("sudo service chilli restart");
-
 
131
		}
-
 
132
	else {echo "$l_error_open_file $mac_allowed_list";}
-
 
133
	break;
-
 
134
	}	
61
	}	
135
}
62
}
136
?>
63
?>
137
<TABLE width="100%" border="0" cellspacing="0" cellpadding="0">
64
<TABLE width="100%" border="0" cellspacing="0" cellpadding="0">
138
	<tr><th><?php echo $l_trusted_sites ;?></th></tr>
65
	<tr><th><?php echo $l_trusted_sites ;?></th></tr>
Line 206... Line 133...
206
		<input type='submit' value='<?php echo $l_submit ;?>'>
133
		<input type='submit' value='<?php echo $l_submit ;?>'>
207
		</FORM>
134
		</FORM>
208
	</td></tr>
135
	</td></tr>
209
	</TABLE>
136
	</TABLE>
210
</TABLE>
137
</TABLE>
211
<TABLE width="100%" border="0" cellspacing="0" cellpadding="0">
-
 
212
	<tr><th><?php echo $l_trusted_mac ;?></th></tr>
-
 
213
	<tr bgcolor="#FFCC66"><td><img src="/images/pix.gif" width="1" height="2"></td></tr>
-
 
214
</TABLE>
-
 
215
 
-
 
216
<table width="100%" border=1 cellspacing=0 cellpadding=1>
-
 
217
<tr><td colspan=2 align="center">
-
 
218
<?
-
 
219
echo "$l_trusted_mac_explain</td></tr>";
-
 
220
echo "<tr><td align='center' valign='middle'>";
-
 
221
echo "<FORM action='$_SERVER[PHP_SELF]' method='POST'>";
-
 
222
echo "<table cellspacing=2 cellpadding=3 border=1>";
-
 
223
echo "<tr><th>$l_trusted_mac_address<th>$l_trusted_mac_info<th>$l_trusted_mac_del</tr>";
-
 
224
// On lit et on affiche le fichier d'exception
-
 
225
$display_form = true;
-
 
226
if (is_file ($mac_allowed_list))
-
 
227
	{
-
 
228
	$tab=file($mac_allowed_list);
-
 
229
	if ($tab)  # le fichier n'est pas vide
-
 
230
		{
-
 
231
		foreach ($tab as $line)
-
 
232
			{
-
 
233
			$field=explode("#", $line);
-
 
234
			$mac_addr=trim(trim($field[0],"macallowed="));
-
 
235
			$mac_info=trim($field[1],"#");
-
 
236
			echo "<tr><td>$mac_addr";
-
 
237
			echo "<td>$mac_info";
-
 
238
			echo "<td><input type='checkbox' name='$mac_addr'>";
-
 
239
			echo "</tr>";
-
 
240
			}
-
 
241
		}
-
 
242
	else { $display_form = false;}
-
 
243
	}
-
 
244
else	{
-
 
245
	echo "$l_error_open_file $mac_allowed_list";
-
 
246
	$display_form = false;
-
 
247
	}
-
 
248
echo "</table>";
-
 
249
if ($display_form)
-
 
250
	{
-
 
251
	echo "<input type='hidden' name='choix' value='del_mac'>";
-
 
252
	echo "<input type='submit' value='$l_submit2'>";
-
 
253
	}
-
 
254
echo "</form></td><td valign='middle' align='center'>";
-
 
255
echo "<FORM action='$_SERVER[PHP_SELF]' method='POST'>";
-
 
256
echo "<table cellspacing=2 cellpadding=3 border=1>";
-
 
257
echo "<tr><th>$l_trusted_mac_address<th>$l_trusted_mac_info";
-
 
258
?>
-
 
259
<td></td></tr>
-
 
260
<tr><td>exemple : 12-2f-36-a4-df-43</td><td>exemple : PC of the boss</td><td></td></tr>
-
 
261
<tr><td><input type='text' name='add_mac' size='17'></td>
-
 
262
<td><input type='text' name='add_comment' size='10'></td>
-
 
263
<input type='hidden' name='choix' value='new_mac'>
-
 
264
<td><input type='submit' value='<?echo"$l_add_to_list";?>'></td>
-
 
265
</tr></table>
-
 
266
</form>
-
 
267
</td></tr>
-
 
268
</table>
-
 
269
</BODY>
138
</BODY>
270
</HTML>
139
</HTML>