Subversion Repositories ALCASAR

Rev

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

Rev 1707 Rev 1710
1
<?php
1
<?php
2
/* written by steweb57 & Rexy */
2
/* written by steweb57 & Rexy */
3
 
3
 
4
/********************
4
/********************
5
* TEST CONF FILES   *
5
* CONF FILES EXIST  *
6
*********************/
6
*********************/
7
//define ("ALCASAR_CHILLI", "/etc/chilli.conf");
-
 
8
define ("CONF_FILE", "/usr/local/etc/alcasar.conf");
7
define ("CONF_FILE", "/usr/local/etc/alcasar.conf");
9
define ("ETHERS_FILE", "/usr/local/etc/alcasar-ethers");
8
define ("ETHERS_FILE", "/usr/local/etc/alcasar-ethers");
10
$conf_files=array(CONF_FILE,ETHERS_FILE);
9
$conf_files=array(CONF_FILE,ETHERS_FILE);
11
foreach ($conf_files as $file){
10
foreach ($conf_files as $file){
12
if (!file_exists($file)){
11
if (!file_exists($file)){
13
	exit("Requested file ".$file." isn't present");}
12
	exit("Requested file ".$file." isn't present");}
14
if (!is_readable($file)){
13
if (!is_readable($file)){
15
	exit("Can't read the file ".$file);}
14
	exit("Can't read the file ".$file);}
16
}
15
}
17
 
16
 
18
# Choice of language
17
# Choice of language
19
$Language = 'en';
18
$Language = 'en';
20
if(isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])){
19
if(isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])){
21
	$Langue		= explode(",",$_SERVER['HTTP_ACCEPT_LANGUAGE']);
20
	$Langue		= explode(",",$_SERVER['HTTP_ACCEPT_LANGUAGE']);
22
	$Language	= strtolower(substr(chop($Langue[0]),0,2)); }
21
	$Language	= strtolower(substr(chop($Langue[0]),0,2)); }
23
if($Language == 'fr'){
22
if($Language == 'fr'){
24
	$l_network_title	= "Configuration réseau";
23
	$l_network_title	= "Configuration réseau";
25
	$l_extif_legend		= " (Interface connectée à Internet)";
24
	$l_extif_legend		= " (Interface connectée à Internet)";
26
	$l_intif_legend		= " (Réseau de consultation)";
25
	$l_intif_legend		= " (Réseau de consultation)";
27
	$l_internet_legend	= "INTERNET";
26
	$l_internet_legend	= "INTERNET";
28
	$l_ip_adr			= "Adresse IP";
27
	$l_ip_adr			= "Adresse IP";
29
	$l_ip_mask			= "Masque";
28
	$l_ip_mask			= "Masque";
30
	$l_ip_router		= "Passerelle";
29
	$l_ip_router		= "Passerelle";
31
	$l_ip_public		= "Adresse IP publique";
30
	$l_ip_public		= "Adresse IP publique";
32
	$l_ip_dns1			= "DNS1";
31
	$l_ip_dns1			= "DNS1";
33
	$l_ip_dns2			= "DNS2";
32
	$l_ip_dns2			= "DNS2";
34
	$l_dhcp_title		= "Service DHCP";
33
	$l_dhcp_title		= "Service DHCP";
35
	$l_dhcp_state		= "Mode actuel";
34
	$l_dhcp_state		= "Mode actuel";
36
	$l_DHCP_on		= "actif";
35
	$l_DHCP_on		= "actif";
37
	$l_DHCP_off		= "inactif";
36
	$l_DHCP_off		= "inactif";
38
	$l_DHCP_off_explain	= "! Avant d'arrêter le serveur DHCP, vous devez renseigner les paramètres d'un serveur externe (cf. documentation).";
37
	$l_DHCP_off_explain	= "! Avant d'arrêter le serveur DHCP, vous devez renseigner les paramètres d'un serveur externe (cf. documentation).";
39
	$l_static_dhcp_title	= "Réservation d'adresses IP statiques";
38
	$l_static_dhcp_title	= "Réservation d'adresses IP statiques";
40
	$l_mac_address		= "Adresse MAC";
39
	$l_mac_address		= "Adresse MAC";
41
	$l_ip_address		= "Adresse IP";
40
	$l_ip_address		= "Adresse IP";
42
	$l_mac_del			= "Supprimer de la liste";
41
	$l_mac_del			= "Supprimer de la liste";
43
	$l_add_to_list		= "Ajouter";
42
	$l_add_to_list		= "Ajouter";
44
	$l_apply			= "Appliquer les changements";
43
	$l_apply			= "Appliquer les changements";
45
 
44
 
46
} else {
45
} else {
47
	$l_network_title	= "Network configuration";
46
	$l_network_title	= "Network configuration";
48
	$l_extif_legend		= " (Internet connected interface)";
47
	$l_extif_legend		= " (Internet connected interface)";
49
	$l_intif_legend		= " (Private network)";
48
	$l_intif_legend		= " (Private network)";
50
	$l_internet_legend	= "INTERNET";
49
	$l_internet_legend	= "INTERNET";
51
	$l_ip_adr			= "IP Address";
50
	$l_ip_adr			= "IP Address";
52
	$l_ip_mask			= "Mask";
51
	$l_ip_mask			= "Mask";
53
	$l_ip_router		= "Gateway";
52
	$l_ip_router		= "Gateway";
54
	$l_ip_public		= "Public IP address";
53
	$l_ip_public		= "Public IP address";
55
	$l_ip_dns1			= "DNS1 :";
54
	$l_ip_dns1			= "DNS1 :";
56
	$l_ip_dns2			= "DNS2";
55
	$l_ip_dns2			= "DNS2";
57
	$l_dhcp_title		= "DHCP service";
56
	$l_dhcp_title		= "DHCP service";
58
	$l_dhcp_state		= "Current mode";
57
	$l_dhcp_state		= "Current mode";
59
	$l_DHCP_on		= "enabled";
58
	$l_DHCP_on		= "enabled";
60
	$l_DHCP_off		= "disabled";
59
	$l_DHCP_off		= "disabled";
61
	$l_DHCP_off_explain	= "! Before disabling the DHCP server, you must write the extern DHCP parameters in the config file (see Documentation)";
60
	$l_DHCP_off_explain	= "! Before disabling the DHCP server, you must write the extern DHCP parameters in the config file (see Documentation)";
62
	$l_static_dhcp_title	= "Static IP addresses reservation";
61
	$l_static_dhcp_title	= "Static IP addresses reservation";
63
	$l_mac_address		= "MAC Address";
62
	$l_mac_address		= "MAC Address";
64
	$l_ip_address		= "IP Address";
63
	$l_ip_address		= "IP Address";
65
	$l_mac_del			= "Delete from list";
64
	$l_mac_del			= "Delete from list";
66
	$l_add_to_list		= "Add";
65
	$l_add_to_list		= "Add";
67
	$l_apply			= "Apply changes";
66
	$l_apply			= "Apply changes";
68
}
67
}
69
if (isset($_POST['choix'])){$choix=$_POST['choix'];} else {$choix="";}
68
if (isset($_POST['choix'])){$choix=$_POST['choix'];} else {$choix="";}
70
switch ($choix)
69
switch ($choix)
71
{
70
{
72
case 'DHCP_On' :
71
case 'DHCP_On' :
73
	exec ("sudo /usr/local/sbin/alcasar-dhcp.sh -on");
72
	exec ("sudo /usr/local/sbin/alcasar-dhcp.sh -on");
74
	break;
73
	break;
75
case 'DHCP_Off' :
74
case 'DHCP_Off' :
76
	exec ("sudo /usr/local/sbin/alcasar-dhcp.sh -off");
75
	exec ("sudo /usr/local/sbin/alcasar-dhcp.sh -off");
77
	break;
76
	break;
78
case 'new_mac' :
77
case 'new_mac' :
79
	if ((trim($_POST['add_mac']) != "") and (trim($_POST['add_ip']) != ""))
78
	if ((trim($_POST['add_mac']) != "") and (trim($_POST['add_ip']) != ""))
80
		{
79
		{
81
		$tab=file(ETHERS_FILE);
80
		$tab=file(ETHERS_FILE);
82
		$insert="True";
81
		$insert="True";
83
		if ($tab)  # le fichier n'est pas vide
82
		if ($tab)  # the file isn't empty
84
			{
83
			{
85
			foreach ($tab as $line)  # verify that MAC or IP addresses doesn't exist
84
			foreach ($tab as $line)  # verify that MAC or IP addresses doesn't exist
86
				{
85
				{
87
				$field=explode(" ", $line);
86
				$field=explode(" ", $line);
88
				$mac_addr=trim($field[0]);$ip_addr=trim($field[1]);
87
				$mac_addr=trim($field[0]);$ip_addr=trim($field[1]);
89
				if (strcasecmp(trim($_POST['add_mac']),trim($mac_addr)) == 0)
88
				if (strcasecmp(trim($_POST['add_mac']),trim($mac_addr)) == 0)
90
					{
89
					{
91
					$insert="False";
90
					$insert="False";
92
					break;
91
					break;
93
					}
92
					}
94
				if (strcasecmp(trim($_POST['add_ip']), trim($ip_addr)) == 0)
93
				if (strcasecmp(trim($_POST['add_ip']), trim($ip_addr)) == 0)
95
					{
94
					{
96
					$insert="False";
95
					$insert="False";
97
					break;
96
					break;
98
					}
97
					}
99
				}
98
				}
100
			}
99
			}
101
		if ($insert == "True") 
100
		if ($insert == "True") 
102
			{
101
			{
103
			$line = trim($_POST['add_mac']) . " " . trim($_POST['add_ip']) . "\n";
102
			$line = trim($_POST['add_mac']) . " " . trim($_POST['add_ip']) . "\n";
104
			$pointeur=fopen(ETHERS_FILE,"a");
103
			$pointeur=fopen(ETHERS_FILE,"a");
105
			fwrite ($pointeur, $line);
104
			fwrite ($pointeur, $line);
106
			fclose ($pointeur);
105
			fclose ($pointeur);
107
			exec ("sudo /usr/bin/systemctl reload chilli");
106
			exec ("sudo /usr/bin/systemctl reload chilli");
108
			}
107
			}
109
		}
108
		}
110
	break;
109
	break;
111
case 'del_mac' :
110
case 'del_mac' :
112
	$tab=file(ETHERS_FILE);
111
	$tab=file(ETHERS_FILE);
113
	if ($tab)
112
	if ($tab)
114
		{
113
		{
115
		$pointeur=fopen(ETHERS_FILE,"w+");
114
		$pointeur=fopen(ETHERS_FILE,"w+");
116
		foreach ($tab as $line)
115
		foreach ($tab as $line)
117
			{
116
			{
118
			$field=explode(" ", $line);
117
			$field=explode(" ", $line);
119
			$mac_addr=trim($field[0]);
118
			$mac_addr=trim($field[0]);
120
			$remove_line = False;
119
			$remove_line = False;
121
			foreach ($_POST as $key => $value)
120
			foreach ($_POST as $key => $value)
122
				{
121
				{
123
				if ($mac_addr == $key)
122
				if ($mac_addr == $key)
124
			       		{
123
			       		{
125
					$remove_line = True;
124
					$remove_line = True;
126
					break;
125
					break;
127
					}
126
					}
128
				}
127
				}
129
			if (! $remove_line) {fwrite($pointeur,$line);}
128
			if (! $remove_line) {fwrite($pointeur,$line);}
130
			}
129
			}
131
		fclose($pointeur);
130
		fclose($pointeur);
132
		exec ("sudo /usr/bin/systemctl reload chilli");
131
		exec ("sudo /usr/bin/systemctl reload chilli");
133
		}
132
		}
134
	break;
133
	break;
135
}
134
}
136
 
135
 
137
// Fonction de test de connectivité internet
136
// Fonction de test de connectivité internet
138
function internetTest(){
137
function internetTest(){
139
	$host = "www.google.fr"; # Google Test
138
	$host = "www.google.fr"; # Google Test
140
	$port = "80";
139
	$port = "80";
141
	//var $num;	//non utilisé
140
	//var $num;	//not used
142
	//var $error;	//non utilisé
141
	//var $error;	//not used
143
	
142
	
144
	if (! $sock = @fsockopen($host, $port, $num, $error, 5)) {
143
	if (! $sock = @fsockopen($host, $port, $num, $error, 5)) {
145
		return false;
144
		return false;
146
	} else {
145
	} else {
147
		fclose($sock);
146
		fclose($sock);
148
		return true;
147
		return true;
149
	}
148
	}
150
}
149
}
151
/********************************************************
-
 
152
*		Lecture du fichier ALCASAR_CHILLI	*
-
 
153
*		     (not need any more)		*
-
 
154
*********************************************************/
-
 
155
//$ouvre=fopen(ALCASAR_CHILLI,"r");
-
 
156
//if ($ouvre){
-
 
157
//	while (!feof ($ouvre))
-
 
158
//	{
-
 
159
//		$tampon = fgets($ouvre, 4096);
-
 
160
//		if (strpos($tampon,"=")!==false){
-
 
161
//			$tmp = explode("=",$tampon);
-
 
162
//			$chilli[$tmp[0]] = $tmp[1];
-
 
163
//		}
-
 
164
//	}
-
 
165
//}else{
-
 
166
//	exit("Erreur d'ouverture du fichier ".ALCASAR_CHILLI);
-
 
167
//}
-
 
168
//fclose($ouvre);
-
 
169
 
150
 
170
/***********************************
151
/***********************************
171
*	Read ALCASAR_CONF_FILE     *
152
*	Read ALCASAR_CONF_FILE     *
172
************************************/
153
************************************/
173
$ouvre=fopen(CONF_FILE,"r");
154
$ouvre=fopen(CONF_FILE,"r");
174
if ($ouvre){
155
if ($ouvre){
175
	while (!feof ($ouvre))
156
	while (!feof ($ouvre))
176
	{
157
	{
177
		$tampon = fgets($ouvre, 4096);
158
		$tampon = fgets($ouvre, 4096);
178
		if (strpos($tampon,"=")!==false){
159
		if (strpos($tampon,"=")!==false){
179
			$tmp = explode("=",$tampon);
160
			$tmp = explode("=",$tampon);
180
			$conf[$tmp[0]] = $tmp[1];
161
			$conf[$tmp[0]] = $tmp[1];
181
		}
162
		}
182
	}
163
	}
183
}else{
164
}else{
184
	exit("Erreur d'ouverture du fichier ".CONF_FILE);
165
	exit("Erreur d'ouverture du fichier ".CONF_FILE);
185
}
166
}
186
fclose($ouvre);
167
fclose($ouvre);
187
 
168
 
188
/************************
169
/************************
189
*	TO DO		*
170
*	TO DO		*
190
*************************/
171
*************************/
191
//modification de la conf réseau  --> V3.0
172
//modification de la conf réseau  --> V3.0
192
 
173
 
193
?><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
174
?><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
194
<html><!-- written by steweb57 & rexy -->
175
<html><!-- written by steweb57 & rexy -->
195
<head>
176
<head>
196
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
177
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
197
<title><?php echo $l_network_title; ?></title>
178
<title><?php echo $l_network_title; ?></title>
198
<link rel="stylesheet" href="/css/style.css" type="text/css">
179
<link rel="stylesheet" href="/css/style.css" type="text/css">
199
<script type="text/javascript">
180
<script type="text/javascript">
200
function MAC_Control(formulaire){
181
function MAC_Control(formulaire){
201
/*MAC control (upper case and '-' separator*/
182
/*MAC control (upper case and '-' separator*/
202
	var regex1 = /^([0-9a-fA-F]{2}(-|:)){5}[0-9a-fA-F]{2}$/; //vérification adresse mac
183
	var regex1 = /^([0-9a-fA-F]{2}(-|:)){5}[0-9a-fA-F]{2}$/; //vérification adresse mac
203
	if (regex1.test(document.forms[formulaire].add_mac.value)){
184
	if (regex1.test(document.forms[formulaire].add_mac.value)){
204
		document.forms[formulaire].add_mac.value=document.forms[formulaire].add_mac.value.toUpperCase().replace(/:/g, '-');
185
		document.forms[formulaire].add_mac.value=document.forms[formulaire].add_mac.value.toUpperCase().replace(/:/g, '-');
205
		return true;
186
		return true;
206
	} else {
187
	} else {
207
		alert("Invalid MAC address");//non internationnalisé
188
		alert("Invalid MAC address");//non internationnalisé
208
		return false;
189
		return false;
209
	}
190
	}
210
}
191
}
211
</script>
192
</script>
212
</head>
193
</head>
213
<body>
194
<body>
214
<table width="100%" border="0" cellspacing="0" cellpadding="0">
195
<table width="100%" border="0" cellspacing="0" cellpadding="0">
215
	<tr><th><?php echo $l_network_title; ?></th></tr>
196
	<tr><th><?php echo $l_network_title; ?></th></tr>
216
	<tr bgcolor="#FFCC66"><td><img src="/images/pix.gif" width="1" height="2"></td></tr>
197
	<tr bgcolor="#FFCC66"><td><img src="/images/pix.gif" width="1" height="2"></td></tr>
217
</table>
198
</table>
218
<TABLE width="100%" border=1 cellspacing=0 cellpadding=1>
199
<TABLE width="100%" border=1 cellspacing=0 cellpadding=1>
219
	<tr><td valign="middle" align="left">
200
	<tr><td valign="middle" align="left">
220
	<fieldset>
201
	<fieldset>
221
	<legend><?php echo $l_internet_legend;
202
	<legend><?php echo $l_internet_legend;
222
 	if (InternetTest()){
203
 	if (InternetTest()){
223
		echo " <img src='/images/state_ok.gif'>";
204
		echo " <img src='/images/state_ok.gif'>";
224
		$IP_PUB = exec ("wget http://checkip.dyndns.org/ -O - -o /dev/null | cut -d: -f 2 | cut -d\< -f 1");}
205
		$IP_PUB = exec ("wget http://checkip.dyndns.org/ -O - -o /dev/null | cut -d: -f 2 | cut -d\< -f 1");}
225
	else 	{
206
	else 	{
226
		echo " <img src='/images/state_error.gif'>";
207
		echo " <img src='/images/state_error.gif'>";
227
		$IP_PUB = "-.-.-.-";}
208
		$IP_PUB = "-.-.-.-";}
228
	?></legend>
209
	?></legend>
229
	<table>
210
	<table>
230
		<tr><td><?php echo $l_ip_public." : </td><td>".$IP_PUB;?></td></tr>
211
		<tr><td><?php echo $l_ip_public." : </td><td>".$IP_PUB;?></td></tr>
231
		<tr><td><?php echo $l_ip_dns1." : </td><td>".$conf["DNS1"];?></td></tr>
212
		<tr><td><?php echo $l_ip_dns1." : </td><td>".$conf["DNS1"];?></td></tr>
232
		<tr><td><?php echo $l_ip_dns2." : </td><td>".$conf["DNS2"];?></td></tr>
213
		<tr><td><?php echo $l_ip_dns2." : </td><td>".$conf["DNS2"];?></td></tr>
233
	</table>
214
	</table>
234
	</fieldset>
215
	</fieldset>
235
	</td><td>
216
	</td><td>
236
	<fieldset>
217
	<fieldset>
237
	<legend><?php echo $conf["EXTIF"].$l_extif_legend; ?></legend>
218
	<legend><?php echo $conf["EXTIF"].$l_extif_legend; ?></legend>
238
	<table>
219
	<table>
239
		<tr><td><?php echo $l_ip_adr." : </td><td>".$conf["PUBLIC_IP"];?></td></tr>
220
		<tr><td><?php echo $l_ip_adr." : </td><td>".$conf["PUBLIC_IP"];?></td></tr>
240
		<tr><td><?php echo $l_ip_router." : </td><td>".$conf["GW"];?></td></tr>
221
		<tr><td><?php echo $l_ip_router." : </td><td>".$conf["GW"];?></td></tr>
241
	</table>
222
	</table>
242
	</fieldset>
223
	</fieldset>
243
	</td><td>
224
	</td><td>
244
	<fieldset>
225
	<fieldset>
245
	<legend><?php echo $conf["INTIF"].$l_intif_legend; ?></legend>
226
	<legend><?php echo $conf["INTIF"].$l_intif_legend; ?></legend>
246
	<table>
227
	<table>
247
		<tr><td><?php echo $l_ip_adr." : </td><td>".$conf["PRIVATE_IP"];?></td></tr>
228
		<tr><td><?php echo $l_ip_adr." : </td><td>".$conf["PRIVATE_IP"];?></td></tr>
248
	</table>
229
	</table>
249
	</fieldset>
230
	</fieldset>
250
	</td></tr>
231
	</td></tr>
251
</table>
232
</table>
252
<table width="100%" border="0" cellspacing="0" cellpadding="0">
233
<table width="100%" border="0" cellspacing="0" cellpadding="0">
253
	<tr><th><?php echo $l_dhcp_title;?></th></tr>
234
	<tr><th><?php echo $l_dhcp_title;?></th></tr>
254
	<tr bgcolor="#FFCC66"><td><img src="/images/pix.gif" width="1" height="2"></td></tr>
235
	<tr bgcolor="#FFCC66"><td><img src="/images/pix.gif" width="1" height="2"></td></tr>
255
</table>
236
</table>
256
<table width="100%" border=1 cellspacing=0 cellpadding=0>
237
<table width="100%" border=1 cellspacing=0 cellpadding=0>
257
<tr><td colspan="2" valign="middle" align="left">
238
<tr><td colspan="2" valign="middle" align="left">
258
<?
239
<?
259
$dhcp_state=trim($conf["DHCP"]);
240
$dhcp_state=trim($conf["DHCP"]);
260
echo "<CENTER><H3>$l_dhcp_state : ${"l_DHCP_".$dhcp_state}</H3></CENTER>";
241
echo "<CENTER><H3>$l_dhcp_state : ${"l_DHCP_".$dhcp_state}</H3></CENTER>";
261
echo "<FORM action='$_SERVER[PHP_SELF]' method=POST>";
242
echo "<FORM action='$_SERVER[PHP_SELF]' method=POST>";
262
echo "<select name='choix'>";
243
echo "<select name='choix'>";
263
echo "<option value=\"DHCP_Off\" ";if (!strcmp($dhcp_state,"off")) echo "selected";echo ">$l_DHCP_off";
244
echo "<option value=\"DHCP_Off\" ";if (!strcmp($dhcp_state,"off")) echo "selected";echo ">$l_DHCP_off";
264
echo "<option value=\"DHCP_On\" ";if (!strcmp($dhcp_state,"on")) echo "selected";echo ">$l_DHCP_on";
245
echo "<option value=\"DHCP_On\" ";if (!strcmp($dhcp_state,"on")) echo "selected";echo ">$l_DHCP_on";
265
echo "</select>";
246
echo "</select>";
266
echo "<input type=submit value='$l_apply'>";
247
echo "<input type=submit value='$l_apply'>";
267
echo "<br>$l_DHCP_off_explain";
248
echo "<br>$l_DHCP_off_explain";
268
echo "</FORM>";
249
echo "</FORM>";
269
echo "</td></tr>";
250
echo "</td></tr>";
270
if (strncmp($conf["DHCP"],"on",2) == 0) { require ('network2.php');}
251
if (strncmp($conf["DHCP"],"on",2) == 0) { require ('network2.php');}
271
else { echo "</TABLE>"; }
252
else { echo "</TABLE>"; }
-
 
253
$maxsize=100000;
272
?>
254
?>
-
 
255
 
-
 
256
<table width="100%" border="0" cellspacing="0" cellpadding="0">
-
 
257
	<tr><th>Import de certificat</th></tr>
-
 
258
	<tr bgcolor="#FFCC66"><td><img src="/images/pix.gif" width="1" height="2"></td></tr>
-
 
259
</table>
-
 
260
<table width="100%" border="1" cellspacing="0" cellpadding="0">
-
 
261
	<tr><td>
-
 
262
	<form method="post" action="network.php" enctype="multipart/form-data">
-
 
263
	Clé privée (.key): <input type="file" name="key"/><br/>
-
 
264
	Certificat (.crt):<input type="file" name="crt"/><br/>
-
 
265
	Server-chain (Recommandé : .crt):<input type="file" name="sc"/>
-
 
266
	<input type="hidden" name="MAX_FILE_SIZE" value="<?php echo $maxsize ?>" /><br/>
-
 
267
	<input type="submit" value="Valider"/>
-
 
268
	</form>
-
 
269
	</td><td>
-
 
270
	<form method="post" action="network.php">
-
 
271
	<input type="hidden" name="default"/>
-
 
272
	<input type="submit" value="Retourner aux certificats par défaut"/>
-
 
273
	</form>
-
 
274
	</td>
-
 
275
	</tr>
-
 
276
</table>
-
 
277
 
273
</body>
278
</body>
274
</html>
279
</html>
-
 
280
 
-
 
281
<?php
-
 
282
if(isset($_POST['default'])){
-
 
283
	echo "Retour au certificats par défaut";
-
 
284
	exec("sudo alcasar-defaultcert.sh");
-
 
285
}
-
 
286
if(isset($_POST['MAX_FILE_SIZE'])){
-
 
287
	echo "changement";
-
 
288
	$maxsize = 100000;
-
 
289
	if(isset($_FILES['key']) && isset($_FILES['crt']) && $_FILES['key']['error'] == 0 && $_FILES['crt']['error'] == 0){
-
 
290
		$dest = "/tmp/";
-
 
291
		if($_FILES['key']['size'] <= $maxsize && $_FILES['crt']['size'] <= $maxsize)
-
 
292
		{
-
 
293
			if(pathinfo($_FILES['key']['name'])['extension'] == 'key' && pathinfo($_FILES['crt']['name'])['extension'] == 'crt')
-
 
294
			{
-
 
295
				$scpath = "";
-
 
296
				if(isset($_FILES['sc']) && pathinfo($_FILES['sc']['name'])['extension'] == 'crt')
-
 
297
				{
-
 
298
					$scpath = $dest."server-chain.crt";
-
 
299
					move_uploaded_file($_FILES['key']['tmp_name'], $scpath);
-
 
300
				}
-
 
301
				$keypath = $dest."alcasar.key";
-
 
302
				$crtpath = $dest."alcasar.crt";
-
 
303
				move_uploaded_file($_FILES['key']['tmp_name'], $keypath);
-
 
304
				move_uploaded_file($_FILES['crt']['tmp_name'], $crtpath);
-
 
305
				exec("sudo alcasar-importcert.sh -i $crtpath -k $keypath -c $scpath");
-
 
306
			}
-
 
307
		}
-
 
308
	}
-
 
309
}
-
 
310
?>
-
 
311
 
275
 
312