Subversion Repositories ALCASAR

Rev

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

Rev 1 Rev 30
1
<?php
1
<?php
2
/* written by steweb57 */
2
/* written by steweb57 */
3
 
3
 
4
# Choice of language
4
# Choice of language
5
$Language = 'en';
5
$Language = 'en';
6
if(isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])){
6
if(isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])){
7
	$Langue		= explode(",",$_SERVER['HTTP_ACCEPT_LANGUAGE']);
7
	$Langue		= explode(",",$_SERVER['HTTP_ACCEPT_LANGUAGE']);
8
	$Language	= strtolower(substr(chop($Langue[0]),0,2)); }
8
	$Language	= strtolower(substr(chop($Langue[0]),0,2)); }
9
if($Language == 'fr'){
9
if($Language == 'fr'){
10
	$l_network_title	= "Configuration réseau";
10
	$l_network_title	= "Configuration réseau";
11
	$l_network_title1	= "Gestion de la configuration réseau";
11
	$l_network_title1	= "Gestion de la configuration réseau";
12
	$l_eth0_legend		= "Eth0 (Interface connectée à Internet)";
12
	$l_eth0_legend		= "Eth0 (Interface connectée à Internet)";
13
	$l_eth1_legend		= "Eth1 (Réseau de consultation)";
13
	$l_eth1_legend		= "Eth1 (Réseau de consultation)";
14
	$l_internet_legend	= "INTERNET";
14
	$l_internet_legend	= "INTERNET";
15
	$l_ip_adr			= "Adresse IP";
15
	$l_ip_adr			= "Adresse IP";
16
	$l_ip_mask			= "Masque";
16
	$l_ip_mask			= "Masque";
17
	$l_ip_router		= "Passerelle";
17
	$l_ip_router		= "Passerelle";
18
	$l_ip_public		= "Adresse IP public :";
18
	$l_ip_public		= "Adresse IP public";
19
	$l_ip_dns1			= "DNS1";
19
	$l_ip_dns1			= "DNS1";
-
 
20
	$l_ip_dns2			= "DNS2";
20
} else {
21
} else {
21
	$l_network_title	= "Network configuration";
22
	$l_network_title	= "Network configuration";
22
	$l_eth0_legend		= "Eth0 (Internet connected interface)";
23
	$l_eth0_legend		= "Eth0 (Internet connected interface)";
23
	$l_eth1_legend		= "Eth1 (Private network)";
24
	$l_eth1_legend		= "Eth1 (Private network)";
24
	$l_internet_legend	= "INTERNET";
25
	$l_internet_legend	= "INTERNET";
25
	$l_ip_adr			= "IP Address";
26
	$l_ip_adr			= "IP Address";
26
	$l_ip_mask			= "Mask";
27
	$l_ip_mask			= "Mask";
27
	$l_ip_router		= "Router";
28
	$l_ip_router		= "Router";
28
	$l_ip_public		= "Public IP address:";
29
	$l_ip_public		= "Public IP address";
29
	$l_ip_dns1			= "DNS1 :";
30
	$l_ip_dns1			= "DNS1 :";
-
 
31
	$l_ip_dns2			= "DNS2";
30
}
32
}
31
 
33
 
32
/********************************************************************
34
/********************************************************************
33
*	CONSTANTES AVEC CHEMINS DES FICHIERS DE CONFIGURATION			*
35
*	CONSTANTES AVEC CHEMINS DES FICHIERS DE CONFIGURATION			*
34
*********************************************************************/
36
*********************************************************************/
35
 
37
 
36
define ("ALCASAR_CHILLI", "/etc/chilli/config");
38
define ("ALCASAR_CHILLI", "/etc/chilli/config");
37
define ("ALCASAR_ETH0", "/etc/sysconfig/network-scripts/ifcfg-eth0");
39
define ("ALCASAR_ETH0", "/etc/sysconfig/network-scripts/default-ifcfg-eth0");
38
define ("ALCASAR_ETH1", "/etc/sysconfig/network-scripts/ifcfg-eth1");
40
define ("ALCASAR_ETH1", "/etc/sysconfig/network-scripts/ifcfg-eth1");
39
 
41
 
40
/********************************************************************
42
/********************************************************************
41
*				TEST DES FICHIERS DE CONFIGURATION					*
43
*				TEST DES FICHIERS DE CONFIGURATION					*
42
*********************************************************************/
44
*********************************************************************/
43
 
45
 
44
//Test de présence et des droits en lecture des fichiers de configuration.
46
//Test de présence et des droits en lecture des fichiers de configuration.
45
if (!file_exists(ALCASAR_CHILLI)){
47
if (!file_exists(ALCASAR_CHILLI)){
46
	exit("Fichier de configuration ".ALCASAR_CHILLI." non présent");
48
	exit("Fichier de configuration ".ALCASAR_CHILLI." non présent");
47
}
49
}
48
if (!file_exists(ALCASAR_ETH0)){
50
if (!file_exists(ALCASAR_ETH0)){
49
	exit("Fichier de configuration ".ALCASAR_ETH0." non présent");
51
	exit("Fichier de configuration ".ALCASAR_ETH0." non présent");
50
}
52
}
51
if (!file_exists(ALCASAR_ETH0)){
53
if (!file_exists(ALCASAR_ETH0)){
52
	exit("Fichier de configuration ".ALCASAR_ETH1." non présent");
54
	exit("Fichier de configuration ".ALCASAR_ETH1." non présent");
53
}
55
}
54
if (!is_readable(ALCASAR_ETH0)){
56
if (!is_readable(ALCASAR_ETH0)){
55
	exit("Vous n'avez pas les droits de lecture sur le fichier ".ALCASAR_ETH0);
57
	exit("Vous n'avez pas les droits de lecture sur le fichier ".ALCASAR_ETH0);
56
}
58
}
57
if (!is_readable(ALCASAR_ETH0)){
59
if (!is_readable(ALCASAR_ETH0)){
58
	exit("Vous n'avez pas les droits de lecture sur le fichier ".ALCASAR_ETH1);
60
	exit("Vous n'avez pas les droits de lecture sur le fichier ".ALCASAR_ETH1);
59
}
61
}
60
 
62
 
61
/********************************************************************
63
/********************************************************************
62
*			Lecture du fichier ALCASAR_CHILLI						*
64
*			Lecture du fichier ALCASAR_CHILLI						*
63
*********************************************************************/
65
*********************************************************************/
64
//Lecture du fichier ALCASAR_ETH0
66
//Lecture du fichier ALCASAR_ETH0
65
$ouvre=fopen(ALCASAR_CHILLI,"r");
67
$ouvre=fopen(ALCASAR_CHILLI,"r");
66
if ($ouvre){
68
if ($ouvre){
67
	while (!feof ($ouvre))
69
	while (!feof ($ouvre))
68
	{
70
	{
69
		$tampon = fgets($ouvre, 4096);
71
		$tampon = fgets($ouvre, 4096);
70
		if (strpos($tampon,"=")!==false){
72
		if (strpos($tampon,"=")!==false){
71
			$tmp = explode("=",$tampon);
73
			$tmp = explode("=",$tampon);
72
			$chilli[$tmp[0]] = $tmp[1];
74
			$chilli[$tmp[0]] = $tmp[1];
73
		}
75
		}
74
	}
76
	}
75
}else{
77
}else{
76
	exit("Erreur d'ouverture du fichier ".ALCASAR_CHILLI);
78
	exit("Erreur d'ouverture du fichier ".ALCASAR_CHILLI);
77
}
79
}
78
fclose($ouvre);
80
fclose($ouvre);
79
 
81
 
80
/********************************************************************
82
/********************************************************************
81
*			Lecture du fichier ALCASAR_ETH0							*
83
*			Lecture du fichier ALCASAR_ETH0							*
82
*********************************************************************/
84
*********************************************************************/
83
 
85
 
84
//Lecture du fichier ALCASAR_ETH0
86
//Lecture du fichier ALCASAR_ETH0
85
$ouvre=fopen(ALCASAR_ETH0,"r");
87
$ouvre=fopen(ALCASAR_ETH0,"r");
86
if ($ouvre){
88
if ($ouvre){
87
	while (!feof ($ouvre))
89
	while (!feof ($ouvre))
88
	{
90
	{
89
		$tampon = fgets($ouvre, 4096);
91
		$tampon = fgets($ouvre, 4096);
90
		if (strpos($tampon,"=")!==false){
92
		if (strpos($tampon,"=")!==false){
91
			$tmp = explode("=",$tampon);
93
			$tmp = explode("=",$tampon);
92
			$eth0[$tmp[0]] = $tmp[1];
94
			$eth0[$tmp[0]] = $tmp[1];
93
		}
95
		}
94
	}
96
	}
95
}else{
97
}else{
96
	exit("Erreur d'ouverture du fichier ".ALCASAR_ETH0);
98
	exit("Erreur d'ouverture du fichier ".ALCASAR_ETH0);
97
}
99
}
98
fclose($ouvre);
100
fclose($ouvre);
99
 
101
 
100
/********************************************************************
102
/********************************************************************
101
*			Lecture du fichier ALCASAR_ETH1							*
103
*			Lecture du fichier ALCASAR_ETH1							*
102
*********************************************************************/
104
*********************************************************************/
103
 
105
 
104
//Lecture du fichier ALCASAR_ETH1
106
//Lecture du fichier ALCASAR_ETH1
105
$ouvre=fopen(ALCASAR_ETH1,"r");
107
$ouvre=fopen(ALCASAR_ETH1,"r");
106
if ($ouvre){
108
if ($ouvre){
107
	while (!feof ($ouvre))
109
	while (!feof ($ouvre))
108
	{
110
	{
109
		$tampon = fgets($ouvre, 4096);
111
		$tampon = fgets($ouvre, 4096);
110
		if (strpos($tampon,"=")!==false){
112
		if (strpos($tampon,"=")!==false){
111
			$tmp = explode("=",$tampon);
113
			$tmp = explode("=",$tampon);
112
			$eth1[$tmp[0]] = $tmp[1];
114
			$eth1[$tmp[0]] = $tmp[1];
113
		}
115
		}
114
	}
116
	}
115
}else{
117
}else{
116
	exit("Erreur d'ouverture du fichier ".ALCASAR_ETH1);
118
	exit("Erreur d'ouverture du fichier ".ALCASAR_ETH1);
117
}
119
}
118
fclose($ouvre);
120
fclose($ouvre);
119
 
121
 
120
 
122
 
121
/********************************************************************
123
/********************************************************************
122
*			Recherche IP public										*
124
*			Recherche IP public										*
123
*********************************************************************/
125
*********************************************************************/
124
$IP_PUB = exec ("wget http://checkip.dyndns.org/ -O - -o /dev/null | cut -d: -f 2 | cut -d\< -f 1");
126
$IP_PUB = exec ("wget http://checkip.dyndns.org/ -O - -o /dev/null | cut -d: -f 2 | cut -d\< -f 1");
125
 
127
 
126
 
128
 
127
 
129
 
128
/************************
130
/************************
129
*		TO DO			*
131
*	TO DO		*
130
*************************/
132
*************************/
131
//modification de la conf réseau, cmd : ifconfig eth0 .....
133
//modification de la conf réseau, cmd : ifconfig eth0 .....
132
//synhro de la modification réseau dans les différentes couches d'alcasar
134
//synchro de la modification réseau dans les différentes couches d'alcasar
133
//gestion du dhcp (affichage,modification, ajout @static)
135
//gestion du dhcp (affichage,modification, ajout @static)
134
 
136
 
135
?><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
137
?><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
136
<html><!-- written by steweb57 -->
138
<html><!-- written by steweb57 -->
137
<head>
139
<head>
138
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
140
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
139
<title><?php echo $l_network_title; ?></title>
141
<title><?php echo $l_network_title; ?></title>
140
<link rel="stylesheet" href="../css/style.css" type="text/css">
142
<link rel="stylesheet" href="../css/style.css" type="text/css">
141
</head>
143
</head>
142
<body>
144
<body>
143
<table width="100%" border="0" cellspacing="0" cellpadding="0">
145
<table width="100%" border="0" cellspacing="0" cellpadding="0">
144
	<tr><th><?php echo $l_network_title1; ?></th></tr>
146
	<tr><th><?php echo $l_network_title1; ?></th></tr>
145
	<tr bgcolor="#FFCC66"><td><img src="/images/pix.gif" width="1" height="2"></td></tr>
147
	<tr bgcolor="#FFCC66"><td><img src="/images/pix.gif" width="1" height="2"></td></tr>
146
</table>
148
</table>
147
<TABLE width="100%" border=1 cellspacing=0 cellpadding=1>
149
<TABLE width="100%" border=1 cellspacing=0 cellpadding=1>
148
	<tr><td valign="middle" align="left">
150
	<tr><td valign="middle" align="left">
149
	<fieldset>
151
	<fieldset>
150
	<legend><?php echo $l_eth0_legend; ?></legend>
152
	<legend><?php echo $l_eth0_legend; ?></legend>
151
	<table>
153
	<table>
152
		<tr><td><?php echo $l_ip_adr; ?></td><td><?php echo $eth0["IPADDR"]; ?></td></tr>
154
		<tr><td><?php echo $l_ip_adr." : </td><td>".$eth0["IPADDR"];?></td></tr>
153
		<tr><td><?php echo $l_ip_mask; ?></td><td><?php echo $eth0["NETMASK"]; ?></td></tr>
155
		<tr><td><?php echo $l_ip_mask." : </td><td>".$eth0["NETMASK"];?></td></tr>
154
		<tr><td><?php echo $l_ip_router; ?></td><td><?php echo $eth0["GATEWAY"]; ?></td></tr>
156
		<tr><td><?php echo $l_ip_router." : </td><td>".$eth0["GATEWAY"];?></td></tr>
155
	</table>
157
	</table>
156
	</fieldset>
158
	</fieldset>
157
	<br />
159
	<br />
158
	<fieldset>
160
	<fieldset>
159
	<legend><?php echo $l_eth1_legend; ?></legend>
161
	<legend><?php echo $l_eth1_legend; ?></legend>
160
	<table>
162
	<table>
161
		<tr><td><?php echo $l_ip_adr; ?></td><td><?php echo $eth1["IPADDR"]; ?></td></tr>
163
		<tr><td><?php echo $l_ip_adr." : </td><td>".$eth1["IPADDR"];?></td></tr>
162
		<tr><td><?php echo $l_ip_mask; ?></td><td><?php echo $eth1["NETMASK"]; ?></td></tr>
164
		<tr><td><?php echo $l_ip_mask." : </td><td>".$eth1["NETMASK"];?></td></tr>
163
	</table>
165
	</table>
164
	</fieldset>
166
	</fieldset>
165
	<br />
167
	<br />
166
	<fieldset>
168
	<fieldset>
167
	<legend><?php echo $l_internet_legend; ?></legend>
169
	<legend><?php echo $l_internet_legend; ?></legend>
168
	<table>
170
	<table>
169
		<tr><td> <?php echo $l_ip_public." ".$IP_PUB;?></td></tr>
171
		<tr><td><?php echo $l_ip_public." : </td><td>".$IP_PUB;?></td></tr>
170
		<tr><td><?php echo $l_ip_dns1." ".$eth0["DNS1"]; ?></td></tr>
172
		<tr><td><?php echo $l_ip_dns1." : </td><td>".$eth0["DNS1"];?></td></tr>
-
 
173
		<tr><td><?php echo $l_ip_dns2." : </td><td>".$eth0["DNS2"];?></td></tr>
171
	</table>
174
	</table>
172
	</fieldset>
175
	</fieldset>
173
	<br />
176
	<br />
174
	</td></tr>
177
	</td></tr>
175
</table>
178
</table>
176
</body>
179
</body>
177
</html>
-
 
178
 
180
</html>
-
 
181
 
179

Generated by GNU Enscript 1.6.6.
-
 
180
 
-
 
181
 
-
 
182
 
-